Chalmers University of Technology and University of Gothenburg
The BNF Converter is a compiler construction tool generating a compiler front-end from a Labelled BNF grammar. It is currently generating code for the target languages Haskell, Agda, C, C++, Java, and OCaml, as well as XML representations and Pygment syntax highlighters.
Given a Labelled BNF grammar the tool produces:
Install via stack from Stackage:
$ stack install BNFC
Install by Cabal from Hackage:
$ cabal install BNFC
Current development version (source repository on GitHub)
$ git clone https://github.com/BNFC/bnfc
Send questions, bug reports, usage news, etc, to our Google group.
bnfc --haskell -d -m Calc.cf && make bnfc --agda -d -m Calc.cf && make bnfc --c -m Calc.cf && make bnfc --cpp -m Calc.cf && make bnfc --java -m Calc.cf && make bnfc --java-antlr -m Calc.cf && make bnfc --ocaml -m Calc.cf && make bnfc --ocaml-menhir -m Calc.cf && makeRun the test parser, generated e.g. with `--haskell`:
echo "1 + 2 * 3 - 4 / 5" | Calc/Test
BNFC code generator graph" width="200" />
BNFC functionality overview:
A grammar of LBNF. It is at the same time an example LBNF file. The development version of this grammar is used in the implementation of the BNF Converter.
© Andreas Abel, Jonas Almström Duregård, Krasimir Angelov, Jean-Philippe Bernardy, Björn Bringert, Johan Broberg, Kyle Butt, Paul Callaghan, Grégoire Détrez, Markus Forsberg, Ola Frid, Peter Gammie, Thomas Hallgren, Pascal Hof, Simon Huber, Patrik Jansson, Kristofer Johannisson, Antti-Juhani Kaijanaho, Andreas Lööw, Justin Meiners, Kent Mein, Ulf Norell, Gabriele Paganelli, Michael Pellauer, Fabian Ruch, and Aarne Ranta 2002 - 2021.
Free software under the BSD 3-clause license.
Versions until 2.8.4 released under the GNU General Public License (GPL).