• edited by
16,609 views
21 21 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.

3 Answers

Best answer
40 40 votes

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

• edited by
17 17 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
12 12 votes

Answer 5

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

• edited by
Answer:
Position:
Show:

Related questions

25 25 votes
3 answers 3 answers
17.5k
17.5k views
Arjun asked Feb 15, 2022
17,466 views
Which one of the following statements is $\text{TRUE}?$The $\textit{LALR}(1)$ parser for a grammar $\textit{G}$ cannot have reduce-reduce conflict if the $\textit{LR}(1)$...
1 1 vote
2 2 answers
895
895 views
admin asked Oct 23, 2022
895 views
Consider the following statements:Statement $\text{I}$: $\text{LALR}$ parser is more powerful than canonical $\text{LR}$ Parser.Statement $\text{II}$: $\text{SLR}$ parser...
1 1 vote
1 1 answer
1.3k
1.3k views
soujanyareddy13 asked Apr 12, 2022
1,262 views
Which of the following statements about the parser is/are correct?Canonical $\text{LR}$ is more powerful than $\text{SLR}.$$\text{SLR}$ is more powerful than $\text{LALR}...
0 0 votes
1 1 answer
1.2k
1.2k views
Souvik33 asked Dec 11, 2022
1,170 views
Consider the following statements regarding the “Parsing Table” of a shift reduce parser, for any given grammarNo. of states/ size of parse table is same for all Shift-Re...