Compiler Design and Construction - Old Questions
Question Answer Details
3. Find first and follow of all the non terminals in the following grammar.
Answer
AI Generated Answer
AI is thinking...
Official Answer
The given grammar is;
Now, the FIRST and FOLLOW of given non-terminals are:
FIRST(A) = FIRST(T) = FIRST(X) = {(, a}
FIRST(E) = {+, ∈}
FIRST(Y) = {*, ∈}
FOLLOW(A) = {), $}
FOLLOW(E) = {), $}
FOLLOW(T) = {), +, $}
FOLLOW(Y) = {), +, $}
FOLLOW(X) = {*, +, ), $}
Non-terminals |
FIRST() |
FOLLOW() |
A |
{(, a} |
{), $} |
E |
{+, ∈} |
{), $} |
T |
{(, a} |
{), +, $} |
Y |
{*, ∈} |
{), +, $} |
X |
{(, a} |
{*, +, ), $} |