2.6k 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 | 2.6k 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 .
+1
@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.

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.) ...

edited by
+3
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.
d ans as <. is not in the grammer