A parser for OCaml written in Haskell using the BNF Converter.
BNF Converter uses a grammar in Labelled BNF.
The grammar in Labelled BNF is based on the grammar in the OCaml parser.
For supporting nested comments and quoted strings we extend the Alex file that is generated by BNFC.
The file Lex.x.patch
contains a patch that is used to extend the autogenerated file.
In order to apply this patch the rules of the Alex file need an additional status code.
This status code is added by a fork of the BNF Converter found at https://github.com/HS-Flensburg-PLTP/bnfc.
Install the BNFC from https://github.com/HS-Flensburg-PLTP/bnfc.
Execute the shell script generate-code.sh
.
It generates Haskell code from the grammar definition in ocaml.cf
and applies the patch Lex.x.patch
.