The default behavior of Bison’s LR-based parsers is chosen mostly for
historical reasons, but that behavior is often not robust. For example, in
the previous section, we discussed the mysterious conflicts that can be
produced by LALR(1), Bison’s default parser table construction algorithm.
Another example is Bison’s
%define parse.error verbose directive,
which instructs the generated parser to produce verbose syntax error
messages, which can sometimes contain incorrect information.
In this section, we explore several modern features of Bison that allow you to tune fundamental aspects of the generated LR-based parsers. Some of these features easily eliminate shortcomings like those mentioned above. Others can be helpful purely for understanding your parser.
Most of the features discussed in this section are still experimental. More user feedback will help to stabilize them.
|• LR Table Construction||Choose a different construction algorithm.|
|• Default Reductions||Disable default reductions.|
|• LAC||Correct lookahead sets in the parser states.|
|• Unreachable States||Keep unreachable parser states for debugging.|