You are on page 1of 1

& T echnology

Amity School of Engineering th


SE+ M BA/ B.T ech . - CSE -3C (5 semester),
B.Tech. - �SE /CSE (EVE)/C
inor Exam, October 2017
Compiler C onstruet·ion (CSE 304) / M
Max. . Mar ks·. 20
.,
Time: 1 hour

Section A
(Attempt a,ny Three)

Ql. Generate operator precedence table for th,c following grammar


G= { {S,A}, {0,1,a,b, #}, P,S} where �}�\.g;ven as below:
s�os1 IA
A�aAbl#

Q2. Check whether that the given grammar G� ·is LL(l) or not by using predictive parsing
Table
G'= { { X,Y,Z}, { (, ), num, +,y}, P, S} where P is given as below:
X-+ (I? I num
Y-+YXZly
Z-+ +XZI E (4)

Q3. a) Explain analysis and synthesis model ora compiler with the help of a block diagram.
(3)
b) Eliminate left factoring from the givJri'��;mmar:
S -+bSSaaS I bSSaSb I bSb I a (1)
Q4. Design a DFA that can recognize prefix and postfix constructs as given below:
{++id I id++/ --id/ id--}[Note: also folloJ the identifier rule of C.]
(4)

Section B
(Compulsory)

Q5. Construct SLR parsing table for the gram n;ir, G= {{ident, letter
, digit}, {c,d}, P, ident}
where P is given as below:
ident � letter digit
digit_�_ letter �igit I digitle_ttei:LdJJ� _
letter -+ c I e · ·

Also give the D FA using LR(O) items.


(8)

.
************************

You might also like