3rd Sess Comp
3rd Sess Comp
Q1. What is syntax directed translation scheme. Explain synthesized and inherited
translation with a suitable example.
(1) P:=0
(2) I:=1
(3) T1:=4*I
(4) T2:=addr(A)-4
(5) T3:=T2[T1]
(6) T4:=addr(B)-4
(7) T5:=T4[T1]
(8) T6:=T3*T5
(9) P:=P+T6
(10) I:=I+1
(11) If I<=20 go to (3)
(b) for(I=0;I<=20;I++)
{ if(I==2)
{ x=x+y+2; }
else
y=x*x+4;
Q5. Translate the expression-
(i) a(a+b)*bb
(ii) (0+1)*(00+11)(0+1)*
Radha Govind Engineering College, Meerut
III Sessional Test – (2005-06)
B.Tech VI Semester (CS)
Compiler Construction (CS 604)
Time: 1:15 hr. MM: 30
Q2. What do you mean by code optimization. Explain with the help of an example.
C[I,j]=A[I,j]+B[I+1,C[I,j]]
Q5. What do you understand by top down parsing? Explain all disadvantages of
top down parsing.
*********************** *******************
Radha Govind Engineering College, Meerut
III Sessional Test – (2004-05)
B.Tech VI Semester (CS) Compiler Construction (CS 604)
Time: 1:15 hr. MM: 30
(1) P: =0
(2) I: =1
(3) T1: =4*I
(4) T2: =addr(A)-4
(5) T3: =T2 [T1]
(6) T4: =addr(B)-4
(7) T5: =T4[T1]
(8) T6: =T3*T5
(9) P: =P+T6
(10) I: =I+1
(11) If I<=20 go to (3)
_______________________________