The Gateway to Computer Science Excellence
+3 votes
2.6k 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 by Veteran (424k points)
edited by | 2.6k views
0

@Shaik Masthan

bro check this..

+1

3 Answers

+16 votes
Best answer

Total $5$ items 

by Junior (765 points)
edited by
0
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 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

by Active (4.6k points)
reshown by
0 votes

The canonical collection of items for the above grammar are:

 

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

by Loyal (9.7k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,647 questions
56,461 answers
195,358 comments
100,246 users