0% found this document useful (0 votes)
2 views

Compiler Design Question Bank

The document is a compiler design question bank divided into sections A, B, C, D, and E, covering various topics such as lexemes, tokens, grammar, code optimization, and intermediate code generation. It includes definitions, explanations, algorithms, and practical problems related to compiler design. Each question references specific years and institutions, indicating its academic context.

Uploaded by

rogega2536
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Compiler Design Question Bank

The document is a compiler design question bank divided into sections A, B, C, D, and E, covering various topics such as lexemes, tokens, grammar, code optimization, and intermediate code generation. It includes definitions, explanations, algorithms, and practical problems related to compiler design. Each question references specific years and institutions, indicating its academic context.

Uploaded by

rogega2536
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Compiler Design Question Bank

Section-A
1 Define lexeme, token and pattern. (BPUT,2021)
Define left recursion. Eliminate left recursion from the following grammar E → E+T | T
2 T → T*F | F (BPUT,2018)
F → (E) | id
3 What is the difference between LEX and FLEX ? Explain(BPUT,2021)
4 What is back patching? (BPUT,2022)
5 Mention the advantages of intermediate code generation. (BPUT,2022)
6 What is compiler Design ? Explain. (BPUT,2018)
7 Define the steps to calculate FIRST and FOLLOW in LL(1). (BPUT,2018)
8 What do you mean by handle pruning ? (BPUT,2022)
9 Convert the following to postfix : A*(B+C/D) -E (BPUT,2021)
10 Define a context free grammar. (BPUT,2022)
11 Mention the strategies of storage allocation .(BPUT 2018-19)
12 What are the objectives of code optimization ?(BPUT 2021-22)
13 What are the various problems in code generation ?(BPUT 2017-18)
14 What is a Symbol table ? Explain.(BPUT 2017-18)
15 Explain the functionalities of Inter procedural Analysis(BPUT 2017-18)
Section-B
Write an algorithm for converting a NFA into DFA? Find the NFA for the regular expression
16
(a+b)*a(a+b). Convert the obtained NFA in to DFA. (BPUT,2022)
17 Explain peephole optimization.(BPUT 2018-19)
Explain the various ways of calling procedure? Explain in detail.
18
(BPUT 2021-22)
Section-C
Construct the NFA that consists of all strings of b’s and a’s where the third symbol from the
19 right end is ‘b’. convert the NFA to corresponding DFA.
(BPUT,2019)
Test whether the grammar is LL(1) or not and construct a predictive parsing table it
S → AaAb / BbBa
20
A →ε
B→ε (BPUT,2018)
21 Explain Intermediate code generation techniques. Why it is essential ? (BPUT,2021)
Using Back Patching , generate an intermediate code for following expression A< B OR
22
C< D (BPUT,2022)

a) Find the CLR parser for the following grammar


Consider the following grammar (BPUT,2018)
E → E+T | T
23
T → T*F | F
F → (E) | id
b) Show the parsing of the string “((id + id) * id) + id” using the parsing table constructed
above.
a) List the commonly used intermediate representations. Write the following
expression in all types of intermediate representations you know
(a-b)*(c+d)-(a+b)
24
b) Generate three address code for the following program while(A<C and B>D) do
if(A= = 3) then C=C+1
else
while (A<=D) do
A=A+3 (BPUT,2022)
25 Explain the various phases of compilation? (BPUT,2018)
Find the LR(1) items for the following grammar.
26 S→AA
A→aA | b (BPUT,2022)
Define Context free grammar. Find out the context free grammar for the following languages
that consists of all the strings of a’s and b’s where
27
i) Every string starts and ends with the same symbol.
ii) L={ambncp | n= m+p and m, n, p ≥ 0} (BPUT,2019)
What is three-address code? Mention its types. How would you implement the three address
28
statements? Explain with examples. (BPUT,2022)
What are the various issues associated with grammars in Top-down parsing? Identify and
resolve the issue(s) if any for the following grammar.
E→E+T|T
29 T→T*F|F
F→(E)|id
Find the predictive parsing table for the given grammar. Show acceptance of the input
string”id+id*id” using the constructed predictive parsing table. (BPUT,2022)
What are the various intermediate forms? Mention its types. How would you implement the
three address statements? Generate intermediate code for the following program fragment.
30 Assume there are four bytes per word sum=0;
for(i=1;i<=20;i++)
sum = sum + a[i] + b[i]; (BPUT,2019)
Distinguish between S-attributed and L-attributed definition with suitable example.
31
(BPUT 2018-19)
Differentiate various allocation strategies in memory management.
32
(BPUT 2021-22)
33 Explain the issue in the design of the code generator. (BPUT 2021-22)
Section-D
Construct a DFA equivalent to the NFA, Where M=({p,q,r},{0,1},δ,p,{q,s}) and δ is defined
in the following table.

δ 0 1

→p {q,s} {q}

34
*q {r} {q,r}

r {s} {p}

*s - {p}

(BPUT,2021)
Explain various issues associated with grammars in top-down parsing with suitable example.
35
(BPUT,2018)
Write an Syntax directed translation to convert a binary number to decimal number. For
36 example, when 101.101 is given as an input, it outputs 5.625. Illustrate the Syntax Directed
Translation while parsing the input given in example.(BPUT 2018-19)
Discuss the structure of a symbol table. Explain how the symbol table is created for a block
37
structured language. (BPUT 2017-18)
Section-E
What is an activation record? Draw diagram of General Activation record and explain the
38 purpose of different fields of an activation record.
(BPUT 2018-19)

You might also like