wisent: Conflicts
2.4 Conflicts
=============
Normally, a grammar should produce an automaton where at each state the
parser has only one action to do (Wisent Parsing).
In certain cases, a grammar can produce an automaton where, at some
states, there are more than one action possible. Such a grammar is
“ambiguous”, and generates “conflicts”.
The parser can’t be driven by an automaton which isn’t completely
“deterministic”, that is which contains conflicts. It is necessary to
resolve the conflicts to eliminate them. Wisent resolves conflicts like
Bison does.
There are two sorts of conflicts:
“shift/reduce conflicts”
When either a shift or a reduction would be valid at the same
state.
Such conflicts are resolved by choosing to shift, unless otherwise
directed by operator precedence declarations. See
(bison)Shift/Reduce, in the Bison manual for more information.
“reduce/reduce conflicts”
That occurs if there are two or more rules that apply to the same
sequence of input. This usually indicates a serious error in the
grammar.
Such conflicts are resolved by choosing to use the rule that
appears first in the grammar, but it is very risky to rely on this.
Every reduce/reduce conflict must be studied and usually
eliminated. See (bison)Reduce/Reduce, in the Bison manual
for more information.
Menu