Skip to content

v2.8.4

Compare
Choose a tag to compare
@andreasabel andreasabel released this 10 Oct 16:14
· 418 commits to master since this release

This release adds the OCaml/Menhir backend, a variant of the OCaml backend that uses parser generator menhir instead of ocamlyacc. Beyond that, the focus of this release has been increased robustness and predictability of the BNFC tool:

  • New option --check that only performs sanity checks on the given LBNF grammar file, without calling any backend (#286).
  • New sanity checks (#186, #213, #214) and deprecation warnings.
  • Error messages of BNFC concerning rule or category names are now equipped with the error location.
  • Generated code systematically tries to avoid clashes with language keywords or standard library names (#278, #289).
  • Pragma define now supported by all maintained backends (Agda, Haskell, Haskell/GADT, C, C++, Java).
  • Pragma position token now supported by all maintained backends with the exception of C++/NoSTL.
  • List separators consisting just of whitespace are now accepted. They are used in the generated printers but treated like "" in the generated parsers (#70).

The Haskell backend has seen the following improvements:

  • New option --text-token to use Data.Text instead of String in the generated lexer (#167).
  • Deriving IsString instances for Ident-like token types (#192).
  • The Err monad is now defined as Either String. Module ErrM is only generated for backwards compatibility. Imports of ErrM with an explicit import list may have to modified slightly, see a migration guide at the Haskell backend documentation.
  • Block comments delimiters are no longer restricted to 2 characters.

The C-family backends have been improved as follows:

  • C, C++, Java: Now multiple block comment forms per grammar are allowed (#202).
  • C++/STL: The parser now throws an exception when parsing fails (#288).
  • Java/JFlex: Special characters are properly escaped (#299).
  • Java/ANTLR: Start rules are generated to work around ANTLR issue #2689 (#272).

Further bug fixes: #163, #169, #196, #212, #235, #256, #264, #269, #274, #276, #277, #279, #282, #283, #290.

Building of BNFC 2.8.4 requires GHC ≥ 7.10 and has been tested up to GHC 8.10.2. BNFC can be build using cabal or stack (using one of the enclosed stack-x.y.z.yaml files).