GATE 2019 CS – Question 53
Consider the augmented grammar given below:
S' → S
S → ⟨L⟩ | id
L → L,S | S
Let $I_0=\text{CLOSURE}(\{[S'\to\cdot S]\})$. The number of items in the set $\text{GOTO}(I_0,\langle)$ is:
Answer: ________.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 5
Explanation
Taking the transition on "⟨" from $I_0$ moves the dot past it in $[S\to\cdot\langle L\rangle]$ to give $[S\to\langle\cdot L\rangle]$. Its closure adds $[L\to\cdot L,S]$, $[L\to\cdot S]$, $[S\to\cdot\langle L\rangle]$ and $[S\to\cdot id]$. That makes 5 items.