Consider the grammar:
S → A
A → $B$ | id
B → B, A | A
If I₀ = CLOSURE({[S → ·A]}), then how many items will be in the set GOTO(I₀, $)?
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. 5
Explanation
I₀ = {S → ·A, A → ·$B$, A → ·id}. GOTO(I₀, $) starts from A → $·B$; its closure adds B → ·B,A and B → ·A, and then A → ·$B$ and A → ·id. Total 5 items.More Theory of Computation and Compilers questions
- 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 FOLLO…
- 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…