You are on page 1of 3

CSE304

Enroll. No. -_____________________


[ET]

END SEMESTER EXAMINATION: APRIL-MAY: 2021


COMPILER CONSTRUCTION
Time :3 Hrs Maximum Marks :60

Note: Attempt questions from all sections as directed.


Section - A : Attempt any Four questions out of Five . Each question carries 06 marks. [24 Marks]

Q1. (a) Discuss the characteristics of Peephole optimization? (3)


(b) Give SDT to translate a*-(b+c) into a syntax tree. (3)
Q2. (a) Write the quadruples, triple and indirect triple for the following expression:

(x+y)*(y+z)+(x+y+z) (3)

(b) Differentiate between lexical and syntactic phase error? (3)


Q3. (a) Discuss the different data structure used to implement symbol table. (2)
(b) Consider the following programs and evaluate the number of tokens?

int max (i,j)

int i, j;

\* return max of i & j */

return i>j?i:j;

} (2)

(c) Check whether the following grammar is LL(1) or not?

(2)

Q4. Prove that the following grammar is ambiguous.

S
Q5. Write short notes on:
(a) Optimization of basic block (3)
(b) Semantic errors and its recovery (3)

Section B : Attempt any two questions out of three. Each question carries 10marks. [20 Marks]

Q6. (a) What is bootstrapping and how it is done on more than one machine? Describe various compiler writing
tools? (4)
(b) Explain the difference between the One-buffer scheme and the Two-buffer scheme? (2)
(c) Show the following grammar is ambiguous.

S (4)

Q7. (a) Check the following grammar is LL(1) or not:

(6)

(b) Compute First() and Follow() of below grammar:

(4)

Q8. (a) What is meant by ambiguous grammar? How ambiguity is avoided? (3)
(b) Discuss the following parameter passing techniques with suitable examples:
(i) Call by value
(ii) Call by reference

(iii) Call by name (3)

(c) Construct the SLR(1) parsing table for the following grammar:

S AA
A aA | b (4)
Section - C : Compulsory question [16 Marks]

Q9. (a) Construct LALR parsing table for the following grammar:

Parse the input string bdc using the table generated by you. (6)

(b) Check the following grammar is CLR(1) or not?

(6)

(c) What are the criteria for achieving machine-dependent optimization and machine-independent
optimization? (4)
********

You might also like