I have a big project built by menhir and traditional makefile. First, I wanted to add a mechanism of error handling like this project to my project.
By following the dune of the sample project, I managed to generate .mly
, .mli
, .ml
, .cmi
and .cmo
of unitActionsParser_e.mly
by the following commands:
$ menhir --only-preprocess-u parser_e.mly > unitActionsParser_e.mly
$ menhir --table --external-tokens Parser_e unitActionsParser_e.mly
$ ocamlfind ocamlc -package menhirLib -c unitActionsParser_e.mli
And the incremental API and error handling did work.
Then, I wanted to add error recovery like this project to my project. Then, items state
raised an error Error: Unbound value items
in my project. Based on the manual and the dune, I guess I need to add --inspection
somewhere.
I tried menhir --explain --inspection --table --dump --infer --external-tokens Parser_e unitActionsParser_e.mly
, then camlfind ocamlc -package menhirLib -c unitActionsParser_e.mli
raised an error Unbound type constructor Parser_e.terminal
.
I also tried to directly work on parser_e.mly
rather than using unitActionsParser_e
by menhir --explain --inspection --table --dump --infer parser_e.mly
, but it returned an error Unbound module Utility
where Utility
is a module in another folder needed by parser_e.mly
. After I manually copied utility.cm*
to the folder of parser_e.mly
, it returned an error Unbound module Sedlexing
(here is a fork where we can reproduce the error) (this is probably related to Interaction with build systems of the manual).
Does anyone know what are the correct commands and flags to generate a parser (either UnitActionsParser_e
or Parser_e
) enabling incremental API and inspection API of menhir?
(* link in discuss.ocaml.org: https://discuss.ocaml.org/t/generate-a-parser-enabling-incremental-api-and-inspection-api/9380 *)