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
- Which of the following properties correctly describe a Regular Grammar? (A) All production rules are of the form A → xB or A → x, where A a…
- If L₁ and L₂ are context-free languages, which one of the following is true about L₁ ∩ L₂?
- Which of the following tasks could be attained using syntax trees in compiler design? (A) Type Checking (B) Code Generation (C) Code Optimi…
- Arrange the following stages of a Turing Machine (TM) operation in the correct order as they occur during computation. (A) Writing a symbol…
- Which of the following languages can be recognized by a Non-Deterministic Finite Automaton (NFA) but cannot be recognized by a Deterministi…
- Arrange the following phases in the correct order as they typically occur in the compilation process. (A) Lexical Analysis (B) Semantic Ana…