Unit Ii Syntax Analysis
Unit Ii Syntax Analysis
PART-A
9. Derive the string and construct a syntax tree for the input
string ceaedae using the
grammar S->SaA|A,A->AbB|B,B->cSd|e MAY/JUNE 2009
S->SaA
S->AaA
S->cSdaA
S->cSaAdaA
S->cAaAdaA
S->cBaAdaA
S->ceaBdaA
S->ceaedaB
C->ceaedae
E -> E + T E -> T
T -> T * F T -> F
F -> (E)
F-> id
8. Construct a LALR parsing table for the grammar given above. Verify whether the
input string id + id * id is accepted by the grammar or not MAY/JUNE
2009 APRIL/MAY 2008
9. Check whether the following grammar is a δδ(1) grammar.MAY/JUNE 2016
APRIL/MAY2005
X → Yz | a
Y → bZ | M
10.Consider the grammar E → E – E
E→ExE
E → id
Show the sequence of moves made by the shift-reduce parser on the input id1 + idβ *
idγand determine whether the given string is accepted by the parser or not.
MAY/JUNE2016
11.What is a shift-reduce parser? Explain in detail the conflicts that may occur during
shift-reduce parsing. MAY/JUNE 2012, APRIL/MAY 2012
12.Consider the grammar given below.
E -> E+E
E -> E*E
E -> id
Construct an LR parsing table for the above grammar. Give the moves of LR parser
on id+id+id ) MAY/JUNE 2007
13.Explain the non-recursive predictive parsing with its algorithm. MAY/JUNE
2016,APRIL/MAY 2005, NOV/DEC 2007
14.Explain the LR parsing algorithm in detail.NOV/DEC 2007, APRIL/MAY 2005
15.What is an ambiguous grammar? Is the following grammar ambiguous? Prove E -
> E + E | E * E | (E) | id. MAY/JUNE 2014
16.Construct parse tree for the input string w = cad using top-down parser.NOV/DEC
2016