Compiler Design Merged
Compiler Design Merged
E -> TE'
E' -> +TE' |
T -> FT'
Also, construct the predictive parsing table for the above mentioned grammar. 7
3 For the following grammar:
E -> E +E E -> E * E E -> (E) E -> id
Generate the sequence of actions taken by the shift-reduce parser for parsing the input string
id1 + id2 * id3 7
4 Explain, how operator procedure parsing relations table is created for evaluating arithmetic
expressions with example. 7
Chapter 3
1 What is synthesized attributes ? 2
2 Give a syntax-directed translation scheme for a " desk calculator" and show the sequence of
moves made by bottom-up-parser of the input 12 * 5 + 4 $. 7
3 Translate the expression
a : = b * - c + b * - c into
(i) Quadruples
(ii) Triples
(iii) indirect triples
4 Translate the following statement into the equivalent three- address code :
IF ( a > b && c < d ) sum = sum + xi
else sum = sum -xi 7
Chapter 4
1 What is symbol table ? 2
2What is the use of activation record ? Explain different fields in the activation record. 7
3Write short notes on the following:
(i) Parameter parsing technique
(ii) Activation trees 7
4Differentiate between static, stack and heap allocation strategies. 7
Chapter 5
1 What is DAG ? 2
2Explain in brief issues in the design of the code generator. 7
3Write short notes on the following :
(i) Global data flow analysis (ii) Induction variable elimination. 7
4Construct the DAG for the following expressions : 7
a + a * ( b - c ) + ( b - c) * d