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), and from T → Qx, FOLLOW(Q) = {x}. So FOLLOW(R) = {z, x}.
More Theory of Computation and Compilers questions
- Which of the following tasks could be attained using syntax trees in compiler design ? (A) Type Checking (B) Code Generation (C) Code Optim…
- Arrange the following stages of parsing in the correct order as they typically occur in the compilation process. (A) Lexical Analysis (B) S…
- Arrange the following Language Classes in ascending order according to their expressive power, as defined by Chomsky hierarchy: (A) Context…
- Which of the following is a context-free language? (A) {wⁱ xʲ yᵏ zˡ | i + k = j + l, i, j, k, l ≥ 0} (B) {wⁱ xʲ yᵏ zˡ | i = j, k = l} (C) {…
- Match List I with List II. List I: A. A → aB | a (a ∈ T; A, B ∈ V), B. A → BC | a (a ∈ T; A, B, C ∈ V), C. LL(1) grammar, D. Halting proble…
- For the regular languages and context-free languages which is not correct? A. both are closed under union operation B. both are closed unde…