Compiler Design and Construction - Old Questions

8. Find first and follow of all the non terminals in the following grammar.

 TA ; A+TA|ɛ ; TFB ; 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}

{*, +, ), $}