search
Log In
7 votes
5k views

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
edited by
5k views
0

@Shaik Masthan

bro check this..

1

3 Answers

20 votes
 
Best answer

Total $5$ items 


edited by
1
Here GOTO is 5 or SHIFT AND GOTO together are 5,

GOTO is used for  NON-TERMINAL items ?

so entries in GOTO

    S -> <.L>

   L -> .L,S

   L -> .S

 

SHIFT AND GOTO:

  S -> .<L>

  S ->.id

 

@Shaik Masthan please verify
0
Having the same doubt
0

Me too. Then the answer should be 3.

0
Even I have marked 3 thinking it to be Goto move
3

@akash.dinkar12

it is asking number of items in GOTO(I0,<).

therefore first evaluate GOTO(I0,<), then count the no.of items

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

@Satbir

chk this..

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

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,⟨)$
3 votes

A item  is a production rule with dot marker in a particular state.

 

https://cs.stackexchange.com/questions/25924/lr0-parsing-how-can-i-know-sets-of-items-corresponding-to-states


reshown by
0

@Ram Swaroop

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

1 vote

The canonical collection of items for the above grammar are:

 

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

0

@Tuhin Dutta

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

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.

Answer:

Related questions

9 votes
3 answers
1
4.8k views
Consider the grammar given below: $S \rightarrow Aa$ $A \rightarrow BD$ $B \rightarrow b \mid \epsilon $ $D \rightarrow d \mid \epsilon $ Let $a,b,d$ and $\$ be indexed as follows:$\begin{array}{|l|l|l|l|} \hline a & b & d & \$ \\ \hline 3 & 2 & 1 & ... $)$ , then the answer should be $3210$)
asked Feb 7, 2019 in Compiler Design Arjun 4.8k views
5 votes
2 answers
2
3.6k views
Which one of the following kinds of derivation is used by LR parsers? Leftmost Leftmost in reverse Rightmost Rightmost in reverse
asked Feb 7, 2019 in Compiler Design Arjun 3.6k views
6 votes
6 answers
3
4k views
Consider the following grammar and the semantic actions to support that inherited type declaration attributes. Let $X_1, X_2, X_3, X_4, X_5$, and $X_6$ be the placeholders for the non-terminals $D, T, L$ or $L_1$ ... $X_1=L, \: X_2=L, \: X_3=L_1, \: X_4 = T$ $X_1=T, \: X_2=L, \: X_3=T, \: X_4 = L_1$
asked Feb 7, 2019 in Compiler Design Arjun 4k views
12 votes
8 answers
4
5.6k views
The following C program is executed on a Unix/Linux system : #include<unistd.h> int main() { int i; for(i=0; i<10; i++) if(i%2 == 0) fork(); return 0; } The total number of child processes created is ________________ .
asked Feb 7, 2019 in Operating System Arjun 5.6k views
...