A Shift/Reduce conflict is a conflict where the parser has two options:
- continuing adding charaters before folding.
- Folding immediately
EXPRESSION DISJUNCTION EXPRESSION
This can be parsed using in a large number of structures: for instance:
You see it can be nested infinitely deep:
Shifting means you will add another token, reducing means you will close the level and process one level up. This means that if you give reducing priority, you will end up with infinite deep recursion.
Therefore a LALR parser gives priority to Shift instead of Reduce operations. A shift/reduce conflict is not an error, it is a warning that you should validate the parser will act like it is supposed to be.
Only Reduce/Reduce conflicts give errors.