Professional Documents
Culture Documents
Find the first and follow sets for all the non-terminals in the following grammar.
E -> T E’
18 E’ -> + T E’ | ε
T -> F T’
T’-> * F T’ | ε
F -> ( E ) | id
Write short notes on:
a. Ambiguous grammer
19 b. Left factoring
c. Left recursion
d. YACC compiler
Explain the algorithm for finding the FIRST and FOLLOW positions for a given non-terminal.
Consider the grammar,
21 E ->TE E->+TE|@ T ->FT T->*FT|@ F->(E)|id.
Construct a predictive parsing table for the grammar given above.
Verify whether the input string id + id * id is accepted by the grammar or not.
Find the first and follow sets for all the non-terminals in the following grammar.
E -> T E’
E’ -> + T E’ | ε
T -> F T’
T’-> * F T’ | ε
F -> ( E ) | id
46 Eliminate left recursion and left factoring for the following grammar.
E→E+T|E-T|T
T → a | b | ( E ).