Files
bison/examples/c/bistromathic
Akim Demaille 58e79539fc c: don't emit an error message when the scanner returns YYERRCODE
* data/skeletons/yacc.c (yyparse): When the scanner returns YYERRCODE,
go directly to error recovery (yyerrlab1).
However, don't keep the error token as lookahead, that token is too
special.
* data/skeletons/lalr1.cc: Likewise.

* examples/c/bistromathic/parse.y (yylex): Use that feature to report
nicely invalid characters.
* examples/c/bistromathic/bistromathic.test: Check that.
* examples/test: Neutralize gratuitous differences such as rule
position.

* tests/calc.at: Check that case in C only.
The other case seem to be working, but that's an illusion that the
next commit will address (in fact, they can enter endless loops, and
report the error several times anyway).
2020-04-26 18:05:30 +02:00
..

bistromathic - all the bells and whistles

This example demonstrates best practices when using Bison.

  • Its hand-written scanner tracks locations.
  • Its interface is pure.
  • It uses the error token to get error recovery.
  • Its interface is "incremental", well suited for interaction: it uses the push-parser API to feed the parser with the incoming tokens.
  • It features an interactive command line with completion based on the parser state, based on yyexpected_tokens.
  • It uses Bison's standard catalogue for internationalization of generated messages.
  • It uses a custom syntax error with location, lookahead correction and token internationalization.
  • It supports debug traces with semantic values.
  • It uses named references instead of the traditional $1, $2, etc.