GTU Computer Engineering (Semester 7)
Compiler Design
May 2016
Total marks: --
Total time: --
INSTRUCTIONS
(1) Assume appropriate data and state your reasons
(2) Marks are given to the right of every question
(3) Draw neat diagrams wherever necessary


1 (a) Explain different phases of compiler.
7 M
1 (b) What is regular expression, give all the algebraic properties of regular expression.
7 M

2 (a) Draw the DFA for the regular expression (a|b)*abb using set construction method only.
7 M
Solve any one question from Q2(b) & Q2(c)
2 (b) Unsigned numbers are strings such as 5280, 39.37, 6.336E4 or 1.894E-4, give the regular definitions for the above mentioned strings.
7 M
2 (c) Draw the state transition diagram for the unsigned numbers.
7 M

Solve any two question from Q3(a), Q3(b) & Q3(c), Q3(d)
3 (a) Convert the (a|b|c)*d*(a*|b)ac+# regular expression to DFA directly and draw its DFA.
7 M
3 (b) Write short note on context free grammar (CFG) explain it using suitable example.
7 M
3 (c) Explain all error recovery strategies using suitable examples.
7 M
3 (d) Where do we use operator precedence parsing technique? Give the general precedence table for operating precedence parsing, considering all the generalized rules.
7 M

Solve any two question from Q4(a), Q4(b) & Q4(c), Q4(d)
4 (a) What is left recursion? Eliminate the left recursion from the following grammar.
E → E + T | T T → T * F | F F → ( E ) | id
7 M
4 (b) Translate the expression - (a*b)+(c*d)+(a*b*c) into 1. Quadruples
2. Triples
3. Indirect triples.
7 M
4 (c) Explain SLR parser in detail with the help of a suitable example.
7 M
4 (d) Design the FIRST SET and FOLLOW SET for the following grammar.
E→E+T|T
T→T*F|F
F→(E)|id
7 M

Solve any two question from Q5(a), Q5(b) & Q5(c), Q5(d)
5 (a) Explain how type checking & error reporting is performed in compiler. Draw syntax tree and DAG for the statement a=(a*b+c)^(b+c)*b+c. Write three address codes from both.
7 M
5 (b) Explain peephole optimization.
7 M
5 (c) Differentiate SLR, Canonical LR and LALR. Also justify the statement 'A class of grammar that can be parsed using LR methods is a proper subset of the class of grammars that can be parsed with predictive parser'
7 M
5 (d) What is an activation record? Explain how they are used to access local and global variables.
7 M



More question papers from Compiler Design
SPONSORED ADVERTISEMENTS