edited by
7,088 views
6 votes
6 votes

Consider the augmented grammar with $\{ +, {\ast}, (,),\text{id} \}$ as the set of terminals.

  • $S’ \rightarrow S$
  • $S \rightarrow S + R\; |\; R$
  • $R \rightarrow R {\ast} P \;| \;P$
  • $P \rightarrow (S)\; |\; \text{id} $

If $I_{0}$ is the set of two $\textit{LR}(0)$ items $\{ [S’ \rightarrow S.], [S \rightarrow S. + R] \}$, then $\textit{goto(closure}(I_{0}), +)$ contains exactly ______________ items.

edited by

3 Answers

Best answer
17 votes
17 votes

So Goto$\text{(closure}(I_{0}),+)$ contains exactly $5$ items.

edited by
10 votes
10 votes

Answer: 5 items.

 

 

The productions of $R$ and $P$ are added because of dot $(.)$ before $R$ and $P$ non-terminals. So $goto(closure(I0, +))$ contains exactly $5$ items.

 

 

edited by
5 votes
5 votes

Answer 5

Closure of $I_0$ is same as $I_0$, we can find goto($I_0$) easily -

edited by
Answer:

Related questions

7 votes
7 votes
3 answers
2
Arjun asked Feb 15, 2022
5,745 views
Consider the following grammar along with translation rules.$$\begin{aligned} & S \rightarrow S_{1} \# T \qquad \{S._{\text{val}} =S_{1}. _{\text{val}} \; ^{\ast} T._{\te...
0 votes
0 votes
1 answer
4