in Compiler Design retagged by
17,534 views
20 votes
20 votes

Consider the augmented grammar given below:

  • $S’ \rightarrow S$
  • $S \rightarrow \langle L \rangle \mid id$
  • $L \rightarrow L, S \mid S$

Let $I_0 = \text{CLOSURE} (\{[S’ \rightarrow \cdot S ]\}).$ The number of items in the set $\text{GOTO} (I_0, \langle \: )$ is______

in Compiler Design retagged by
by
17.5k views

4 Comments

It seems ambiguous, The number of items, Not mentioning LR(0) / LR(1) items

IF LR(0)  then 5 items  in GOTO (I0, < )

IF LR(1) then 7 items  in GOTO (I0, < )

1
1

Even if I consider LR(1) items, items shall remain 5 only. Please correct me if I am wrong.

3
3

@Umakant_Mukhiya it is not ambiguous cause we have already given augmented grammar without lookahead. So, it’s clearly Lr(0) or SLR(1).

2
2

4 Answers

37 votes
37 votes
Best answer

Total $5$ items 

edited by

4 Comments

I have marked 2 since 5 will be entry for action-goto and go-to will be for L and S only
0
0

@Satbir

chk this..

 here Action+Goto taking 5 items, but asking for only GoTo state, right??Then why 5??

0
0
I do not know why there is so much confusion regarding this question

People who are saying only $GOTO$ is mentioned not the action part, think of one thing, what do we call GOTO?

From a state if we go to the next state using a NON-Terminal production then that is GOTO

But here in the question it is clearly mentioned that we need to find

The number of items in the set $GOTO(I_0,⟨)$

here $⟨$ is a terminal symbol right? So why so much fuss about non terminal GOTO part

They meant to ask the number  of items in the canonical collection set of $GOTO(I_0,⟨)$
5
5
6 votes
6 votes
reshown by

1 comment

@Ram Swaroop

tell me one thing here Action+Goto taking 5 items, but asking for only GoTo state, right??Then why 5??

0
0
1 vote
1 vote

The canonical collection of items for the above grammar are:

 

GOTO($I_0,<$ ) = $I_2$ which is having 5 items. 

2 Comments

@Tuhin Dutta

tell me one thing here Action+Goto taking 5 items, but asking for only GoTo state, right??Then why 5??

0
0

I think they meant to ask no of items in the canonical collection set of the specified GOTO state and not the GOTO items.

1
1
0 votes
0 votes
It’s asking the number of items in the set GOTO(I0, <).

Means First evaluate I1 = GOTO(I0, <) and then count the number of items present in I1 state.

Answer is 5.
Answer:

Related questions