3.8k views

A canonical set of items is given below

$S \to L .> R$

$Q \to R.$

On input symbol $<$ the set has

1. a shift-reduce conflict and a reduce-reduce conflict.
2. a shift-reduce conflict but not a reduce-reduce conflict.
3. a reduce-reduce conflict but not a shift-reduce conflict.
4. neither a shift-reduce nor a reduce-reduce conflict.
edited | 3.8k views
0
Now, when we have the edited question,

This is a parsing error. as we do not have " < " in the canonical form.
0
What the answer would be if it is  '>'

The given state itself sufferes from SR conflict ? Right ?

Correct me if wrong .
+2
@Arjun sir

Is it possible that these two items come in same cannonical item set??

S→L.>R comes from prev state on shift on L

Q→R. comes from prev state on shift on R

They should be in diff item set rt?
0
Yes different
0
yes sir .
0
it is not given that about which parser it is asking .

if i assume it as LR(0) ,and if it is asking about the set(state) on transition of <,then we come to a state which not exists .so ,there will be no conflict in that state.
(and also these two items can never be present on the same set in practice).
the set given in the question has s/r conflict acc. to lr(0) ,because reduce move goes to every terminal
and on transition by shift move of  '>' .

correct me please if i am wrong.

The question is asked with respect to the symbol  ' < '  which is not present in the given canonical set of items. Hence it is neither a shift-reduce conflict nor a reduce-reduce conflict on symbol '<'. Hence D is the correct option. But if the question would have asked with respect to the symbol  ' > '  then it would have been a shift-reduce conflict.

selected by
+1
S→L.>R // we can reach here by reading L in the previous state only.

Q→R.// we can reach here by reading R

how those both belong even to the same canonical state?

We can't have any type of conflict here.
0
How would there be a conflict on '>'
0

If we consider the grammar to be LR(0) there would be S-R conflict in the given canonical form.

 > $I0 R2/S1 R2 Suppose that the present state is I0 and on transition on > it goes to I1 state. S->L.>R --production number :1 (on correction of existing question) Q->R. ---production number:2 In LR(0) reduced move will be placed in entire row.(under terminal columns) Here we cant determine SLR(1) paring table as the follow of Q is unknow so we dont know how to place the reduced move. Suppose we go with the given question(on transition on <) S->L.>R Q->R. it wont go to any state so no S-R or R-R as that terminal (<) is not present in the canonical set of LR(0). 0 Case 1: If "<" is a valid terminal i.e < is in Grammar Considering given item as LR(0) item as no lookahead  State < >$ Given item state Q->R Q->R / Shift J Q->R .. ... ... ...

In this case there will be reduce operation performed. So no conflict

Case 2: If "<" is a Not valid terminal i.e < is nowhere Grammar

 State > $Given item state Q->R / Shift J Q->R .. ... ... In this case there will be ERROR...But still no conflict Please correct me if i am wrong 0 no conflicts shall be there even if > is used 0 Shift reduce conflict will be there if there would have been '>'. +24 votes Ans : The given input symbol no where in the given grammar so with given symbol we have neither a shift-reduce nor a reduce-reduce conflict. So, correct answer is (D.) ... answered by Active (1.1k points) edited by +4 its just an error and not a conflict rt? 0 Even if we consider that as an typing error or so, then even for '>' this symbol I don't see any option. As Q-->R does not have a '.' So that we can tell if it is reduced or not. +1 Yes Arjun sir , in actuall question as Gate Keeda has mention below comment even for > symbol in actuall paper there is no any symbol that's why it is an error as there is no any entry in parse table so no any conflict but error.. +3 @Gate-keeda I was not telling about typo. Error during parsing. 0 That's for sure will be an error. But I'm saying that the question itself is wrong. 0 hmm q->r in not canonical form..."." is not there.....but if we ignore that nd take q->.r then option (d ) is correct 0 Are Canonical Set of items and LR(0) items same ? +1 Given state itself suffer from SR conflict , right ? Correct me if wrong . 0 Yes SR conflict if Q->R. is the second production and we have ">". 0 what is the meaning of this line "The given input symbol no where in the given grammar.." symbol no where?!? 0 yes on input > it has SR conflict for sure. 0 that cannot be confirmed till we know wheter the parser is lr (0) or slr (1 ) and if > is in follow of Q then it s confirmed to have SR conflict 0 Even if the question had ">", there won't be any conflict on its canonical collection. There will only be shift to$S\rightarrow L>.R\$  and enumerations of R. The current state itself is in SR conflict, and that's a different matter.
0
Can someone send some resources for this topic?
0

may be printing mistake in the question?
but according to the question Option D is right

d ans as <. is not in the grammer
0
this question is just to trap students marking in a hurry!

1
2