Compiler QP
Compiler QP
1
UCS1602
17 K3
Apply direct method to construct DFA for the regular expression CO1
(ab)*abc
F+F*|a| b
construct the SLR parsing table for the given grammar
(OR)
Construct the LALR Parsing table for the following grammar
E’E+T|T
19 K3 T’T*F|F CO2
F’(E) /id
Parse the following string (id + id ) * id
UCS1602 2
UCS1602
(OR)
Write the SDT for declaration statement. Construct symbol table for
the following declaration statements.
a : integer
21 K3 CO3
b:real
c:array (10) of integer
d:‘ integer
22 K2
Explain code generation algorithm and generate assembly language CO4
for the following statement d =a-b*c+e.
(OR)
23 K2
Explain storage allocation strategies and parameter passing CO4
methods in detail.
Explain the algorithm for DAG generation from basic block and
construct the DAG for the following basic block.
1. t1:=4*1
2. t2: =a[tl]
3. t3:=4*i
24 K3
4. t4:-b[t3] COS
5. t5: =t2*t4
6. t6:-prod +t5
7 prod:=t6
8. t7:=i+1
9. i:7
10. ifi<-20 goto (1)
(OR)
Develop three address code for the given source language and
optimize the three address code using various optimization
techniques:
iFl,s-0; COS
25 K3
for(i-1;í<=3;it+)
cli]=stali *b[il;
UCS1602 3