All mock tests are FREE till 31 December — register to save your progress
Unit 8 · Theory of Computation and Compilers Paper 2 CS · June 2024 Re-Exam

Consider the grammar:
T → Qx
Q → RS
R → y | ε
S → z | ε
Here x, y, z are terminals and T, Q, R, S are non-terminals. What will be the FOLLOW set of the non-terminal R?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. {z, x}

Explanation

From Q → RS, FOLLOW(R) includes FIRST(S) − {ε} = {z}. Since S can be ε, FOLLOW(R) also includes FOLLOW(Q) = {x}. So FOLLOW(R) = {z, x}.

More Theory of Computation and Compilers questions