compiler model QP
compiler model QP
4. Define CFG.
7. What is DAG?
10. Write the three address code sequence for the assignment statement below.
d:=(a-b)+(a-c)+(a-c)
PART-B
11. (a) Describe various phases of compiler and trace it with a program segment
(0r)
(b) (i) Explain Language Processing system with neat diagram. (8)
(0r)
(b) (i) Explain LL(1) grammar for the sentence S iEts | iEtSeS | aEb. (8)
EE+T|T
TTF|F
FF*|a|b
Construct the SLR parsing table for the above grammar. (8)
13. (a)(i) Construct a syntax directed definition for constructing a syntax tree for assignment
statements. (8)
Sid:=E
EE1+E2
EE1*E2
EE1
E(E1)
Eid
(Or)
(b).Explain about constructing Syntax tree for an expression with example. Write Syntax
directed definition for constructing syntax trees. Draw an annotated parse tree for the
expression a-4+c.
1. t1:= 4*i
2. t2=a[t1]
3. t3:=4*i
4. t4:=b[t3]
5. t5:=t2*t4
6. t6:= prod+t5
7. prod:=t6
8. t7:=i+1
9. i:=t7
PART C
16. (a) Construct the predictive parsing table and describe the moves of the parser on
the input string. Design a predictive parser for the following grammar.
EE+T|T
T T*F|F
F (E) |id. Show the moves of the parser on the input id+id*id.
(or)
16. b. Write and algorithm to convert NFA to DFA and Minimizing DFA. Give an example
for minimization.