A canonical set of items is given below
On input symbol the set has
View worked solution
Answer: D
To determine if there are any conflicts on the input symbol , let us analyze the actions possible from the given canonical set of items:
-
- The dot is followed by the terminal symbol .
- This indicates a shift action, which is defined only on the terminal .
- There is no shift action defined on the symbol .
-
- This is a completed item (the dot is at the very end).
- This indicates a reduce action () on the lookahead symbols (for LR(1)/LALR(1)) or on the symbols in (for SLR(1)).
Conflict Analysis on Input Symbol :
- Shift-Reduce (S-R) Conflict: For an S-R conflict to occur on a symbol, there must be both a shift action and a reduce action defined on that symbol. Since the only shift action from this state is on , there is no shift action on . Thus, no S-R conflict can occur on .
- Reduce-Reduce (R-R) Conflict: For an R-R conflict to occur, there must be at least two different completed items in the same state that can reduce on the same lookahead symbol. Since there is only one completed item () in this set, a reduce-reduce conflict is impossible on any input symbol, including .
Therefore, on the input symbol , the set has neither a shift-reduce nor a reduce-reduce conflict.
Free practice · Your answers on this page are not saved.
