As explained in §
a commit should only be
violated if no parse is possible without crossing the commit.
However, if the penalty level of the parse tried exceeds that of
another parse, due to a call, this call will not be tried
further. Instead, a commit might be crossed to find another
parse, because the parser regards the first alternative as `no parse'
rather than `too high a penalty-level'.
For the input ``test'', one can imagine four possible parse-trees.: B ; PENALTY , B .
B:PENALTY , C ! C .
C: "test" .
1: {A{B{$PENALTY,C}}}
2: {A{$PENALTY,B{C}}}
3: {A{B{C}}}
4: {A{$PENALTY,B{$PENALTY,C}}} )
In stead of generating only the output with the lowest
penalty level without crossing commits (1) something else
happens.
First the first alternative of A is tried. Parse 1 is found without crossing a commit, so the second alternative for rewriting B is not tried (which would result in 3). Then the second alternative of A is tried for another parse. When the first rewriting of B (which would result in 4) is tried, it fails (due to the total-penalty-level), so the second alternative is tried. This leads to parse 2. Therefore, two parses are the result:
{A{B{$PENALTY,C}}}
{A{$PENALTY,B{C}}}
This crossing of a commit due to the total-penalty-level, means that the order of the alternatives is relevant for the result. the following grammar would only get one parsing as we would expect.
: B ; PENALTY , B .
B:PENALTY , C ! C .
C: "test" .