Compiler Design and Construction - Old Questions
8. Find first and follow of all the non terminals in the following grammar.
E ➜ TA ; A➜+TA|ɛ ; T➜FB ; B➜*FB | ɛ ; F➜(E) | id
5 marks
|
Asked in Model Question
Given grammar;
Now, the FIRST and FOLLOW for the non-terminals are:
Non-terminals | FIRST() | FOLLOW() |
E | {(, id} | {), $} |
A | {+, ∈} | {), $} |
T | {(, id} | {), +, $} |
B | {*, ∈} | {), +, $} |
F | {(, id} | {*, +, ), $} |