A canonical set of items is given below:
S -> L . > R
Q -> L .
On input symbol > the set has:
A. a shift-reduce conflict and a reduce-reduce conflict.
B. a shift-reduce conflict but not a reduce-reduce conflict.
C. a reduce-reduce conflict but not a shift-reduce conflict.
D. neither a shift-reduce nor a reduce-reduce conflict.
GATE 2014 · Compiler Design · LR Parser · medium
Answer: B. a shift-reduce conflict but not a reduce-reduce conflict.
Determine action for each item on input >: Item 1: S -> L . > R — dot is before >, so this item says SHIFT on >. Item 2: Q -> L . — dot is at the end, so this item says REDUCE Q -> L. Both actions apply when input is >.
Identify conflict types: We have: 1 shift action (from item 1) and 1 reduce action (from item 2) on input > — this is a SHIFT-REDUCE conflict. There is only one reduce item (Q -> L .), so there is no second reduce action — thus NO reduce-reduce conflict.