Browse the Github release page for clickable release notes and the latest releases (that might not be listed here).

BNFC 2.9.4

Release notes

  • LBNF: empty token types are now forbidden [#388]
  • Agda: support position information via --functor [#405]
  • C/C++: use size_t and -Wsign-conversion [#391]
  • C++: repair broken --line-numbers [#390], regression in 2.9.2 by [#349]
  • Haskell: fix a problem with layout stop words and top-level layout [#399,#413]
  • Haskell: generated test parser can parse several files now [#400]
  • Java: use L.valueOf() instead of deprecated new L() for literal classes L [#402]
  • Ocaml: non-terminals in generated parser are now type-annotated [#407]
  • Ocaml: sanitize bound variables in define
  • Ocaml/Menhir: update parse error mechanism to Menhir 2021/12/30 [#414]


BNFC 2.9.3

Release notes

  • BNFC now uniformly signs generated files with its version number [#373]
  • C/C++: include stdio.h in parser header files [#381]
  • C++: fixed parser regression in 2.9.2: missing #include <algorithm> [#377]
  • Ocaml: lex CR as whitespace [see also #376]
  • Ocaml: correct position in parse errors [#380]
  • Ocaml/Haskell: make printer for lists categories total [#383]

BNFC 2.9.2

Release notes

Major improvements:

  • Haskell: layout keywords can now be stacked on the same line [#354], see docs
  • C: new methods free_* and clone_* to deallocate and clone syntax trees [#348]
  • C/C++ backends now create reentrant parsers [#349]

Bug fixes and small improvements:

  • Haskell-GADT: generated code is warning free [#346]
  • Haskell: fixes in layout preprocessor [#343,#344,#345,#352,#353]
  • Haskell: print [Char] correctly, removed method prtList [#359]
  • Haskell: added missing import [#368], regression introduced in 2.9.1 by [#331]
  • C: fixed a space leak when parsing from a string in memory [#347]
  • C: removed errorneous defined constructors from Skeleton.c
  • C++: defined constructors now reside in Absyn [#287]
  • Java: defined constructor now reside in [#287]
  • Ocaml: fixed translation of nested defined constructors
  • C/C++/Java: Pre/post/mixfix lists are now printed correctly [#358]
  • all: defined constructors involving list expressions work now [#363]
  • all: printers render braces on their own line [#366]

Cosmetical changes:

  • C/C++: instead of _SYMB_nnn, more readable token names in lexer & parser

BNFC 2.9.1

Release notes

Main new feature:

  • Haskell: the --functor option now produces position-annotated ASTs [#176,#327]. Thanks @Commelina!

Bug fixes and small improvements:

  • Haskell: fix generated Makefile and test parser for --glr mode [#340]
  • Haskell(/GADT): generated modules import Prelude explicitly, compatible with {-# LANGUAGE NoImplicitPrelude #-}
  • Haskell: generated code is warning free [#331]
  • Haskell: generated printer more robust wrt. identifier clashes [#337]
  • Haskell/C: handle token constructors in define expressions [#338]
  • Java/ANTLR: removed more superfluous quotation in lexer character sets [#329]
  • Ocaml: fix syntax error in generated printer [#330]
  • LBNF: more sanity checks [#339]
  • Tested with GHC 9.0

BNFC 2.9.0

Release notes

Major changes:

  • New license: BSD 3-clause [#308]
  • LBNF: removed delimiters pragma [#308]
  • Haskell: removed options --alex1, --alex2, --sharestrings, --profile, and --cnf [#265]
  • C#: backend removed [#265]

Bug fixes:

  • LBNF: allow list categories in entrypoints pragma [#306]
  • LBNF: report clashes between token and ordinary categories [#323]
  • C: strdup is not part of C89 standard, _POSIX_C_SOURCE required [#318]
  • C/C++: fixed buffer overrun in String literal lexer [#316]
  • C++: fixed regressions (one of them #310) introduced by #288
  • C/C++/OCaml: allow unicode characters in token definitions [#324]
  • C/OCaml: sanitize grammar file names [#325]
  • Java/ANTLR: removed superfluous quotation in lexer character sets [#319]

BNFC 2.8.4

Release notes

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).


  • BNFC-2.8.4-mac.pkg: Binary /usr/local/bin/bnfc compiled under Mac OS X Mojave, x86 64bit processor
  • bnfc-2.8.4-win.exe: Binary compiled under Windows 10, x86 64bit processor

BNFC 2.8.3

Release notes

Main new feature:

  • Agda backend: generates bindings to output of Haskell backend

Backend-independent features:

  • GHC 8.8 compatibility
  • Stack installation supported by provided .yaml files [#198]
  • Unicode support in lexer, excl. C, C++ and Ocaml [#249]
  • LBNF: support \r (carriage return) and \f (form feed) in token declaration [#257]
  • LBNF: allow numbered categories (like Foo2) independent of coercions [#210]

C backend:

  • supports now the -l option to give error locations [#238]
  • correct function names in generated skeletons [#239]
  • handle regular expression difference (subtraction) correctly [#237]

Haskell backend:

  • generates now more fine-grained Makefile that invokes bnfc on changed .cf file
  • uses qualified import of AST in generated printer [fixes #128,#228]
  • printer code no longer produces deprecation warning concerning OverlappingInstances [#233]
  • --cnf: fixed problem with Any type in generated code [#216]
  • --cnf: generated test program now same name (Test) as without --cnf
  • --glr: correct module header in .y file [#252]


  • BNFC-2.8.3-mac.pkg: Binary /usr/local/bin/bnfc compiled under Mac OS X Mojave, x86 64bit processor
  • bnfc-2.8.3-win.exe: Binary compiled under Windows 10, x86 64bit processor

BNFC 2.8.2


Source BNFC-2.8.2.tar.gz

Release notes

  • GHC 8.4 compatibility [#227,#236]
  • bnfc now puts current timestamp on all created files, even unchanged ones [#219]
  • bnfc is now more accepting about border-line terminals [#149]
  • Improved error messages [#144] in particular on undefined categories [#151]
  • C: Emit correct function prototypes [#185]
  • C++: Fix buffer overrun in pretty printer [#242]
  • C++: Fix regression introduced in 2.8 in Skeleton.H [#164]
  • C++: Replace %name-prefix with %define api.prefix in bison files [#181]
  • C++: Fix a bug that appeared if you had a category named “List”
  • C, C++: Add usage output to the test program [#141]
  • C, C++: Fix a bug in the parser file when using -p [#172]
  • C, C++, OCaml, Java: Accept ‘ or “ as comment delimiters [#146]
  • Haskell: Generated code mostly hlint-warning free
  • Haskell: Small fixes [#166,#170,#222]
  • Java: Add an experimental ANTLR4 backend [#155]
  • Java: Add support for passing line numbers to parser [#217,#224,#226]
  • OCaml: Reserved symbols now have a higher precedence than predefined tokens as in Haskell
  • Some updates of the documentation [#211,#223]
  • And various small fixes [#139,#159,#195,#201,#215]

BNFC 2.8.1


Source BNFC-2.8.1.tar.gz

Release notes

  • Fix compatibility with GHC 7.10.2 and Alex 3.14

BNFC 2.8

Release notes

  • Builds with ghc 7.10.1
  • Add support for JFlex (java)
  • Add an option to generate files in an other directory
  • Add an experimental option that turns the AST into a parametrized functor (in Haskell only)
  • New pygment backend to generate syntax highlighters
  • Bug fixes

BNFC 2.7.1

Release notes

  • Generated haskell code is now warning free
  • Removed unused terminal in happy
  • Correctly escape backslashes in symbols
  • Fix problem that was preventing custom tokens to work in OCaml if they conflict with the build-in Ident
  • BNFC build is also warning free (ghc 7.4.2)
  • Test programs return non-zerro exit code on parse error


Release notes

  • Fix problem with the latest version of alex


Release notes

  • Add token support for Ocaml
  • New option parser
  • Adds an optional argument to change Makefile name
  • Add a –ghc option to derive Data, Typeable, Generic in Haskell
  • New online documentation (
  • Derive Read for newtype decls in Haskell
  • New option to get the version number –version
  • Remove the F# backend
  • Remove the Java4 backend
  • New Applicative and Alternative instances to Err
  • Remove the coupling between building the parser and the pdf from latex
  • Improvement to the CNF Backend
  • Bug fixes #92, #21, #34, #33, #90, #30, #60

BNFC 2.5.0

Release notes