Jl'Li: Jyffl)
Jl'Li: Jyffl)
Jl'Li: Jyffl)
CS/B.TECH(N)/OOO/SEM•5/5506/202
MAULA�A. A,BUL � A�A� AZAD UNIVERSITY.OF TECHNOLOGY, WEST BENGAL
� R1po� Code : PCG-CS501 Complier Design
om
;w:f How many descriptors are used for track both the registers (lor availability) and addresses (location o l values) while
generating the code?
J,Xl A synthesized attribute is an anrlbute whose value at a parse tree node Is defined in terms ol ____
IK1> Ellminatio11 of loop Invariant computation is a peephole opIimizaIion . True/False?
�•
.4
t.c
111 _____ is a loop optimization
4. Find the output, given grammar Gl and associaled semantic rvles and input: aadbd Isl
• S·>AS (priot(1 )}
• S->AB {pri,:it(2))
• A•>a {prinl(3))
m
• B-;,b C (plint(4))
• 8->d 8 (prinl(S))
• C·>C (prin1(6))
)i. What is ambiguity? Show that G2:(S•>aSjSala) is ambiguous [ 5)
p. What is code optimization? Optimize lhe following C-code; 1sI
count..o;
result= 0;
while(counl++ < 20)
I
increment• 2"count;
result .... increment;
}
:?
For the lollowlng grammar I 3+S.s.+2 I
[ E-> E orT_Fr
T->T and F!F
F·> not-Fl(E)I 011
,afElimlnate left recursion from the above grammar
-� Find FIRST(X),Follow(X) for each varlable In the grammar
c) Construct a predictive parser table for the grammar
d) ls the above grammar LL(1 ). Justify your answer
/4 � What is a compiler?
• 2+10+3 J
om
Ill. Find Followpos0 lor every position in the syntax tree
Followpos()
IV. Construct the corresponding DFA for the given RE using
1 l:/9 ) What is LEX?
b) Explain the working of LEX . . tokens
w the step by step cons truct ion of a lexic al analyzer with the following three
c) Sho
t.c
•a
• abb
• a'b+
bu
2;2