I found that Menhir provides the --dump and --explain options, and that helps debug a lot. But how to include these parameters in ocamlbuild so that Menhir always generates dump files at compile time?
I tried writing my own myocamlbuild tag with the menhir_dump tag, as shown below:
... snip ... (* OASIS_STOP *) Ocamlbuild_plugin.dispatch ( MyOCamlbuildBase.dispatch_combine [ (function | After_rules -> flag ["menhir_dump"] (S [A "--dump"; A "--explain"]) | _ -> () ); dispatch_default ] )
But when it compiles, the parameters are inserted into the subcommand, and compilation is not performed at the ocamlc stage.
menhir --dump --explain --raw-depend --ocamldep 'ocamlfind ocamldep -modules' src/parser.mly > src/parser.mly.depends menhir --ocamlc 'ocamlfind ocamlc -g -annot -bin-annot --dump --explain -I src -package cmdliner -package menhirLib -I src' --dump --explain --infer src/parser.mly + menhir --ocamlc 'ocamlfind ocamlc -g -annot -bin-annot --dump --explain -I src -package cmdliner -package menhirLib -I src' --dump --explain --infer src/parser.mly ^^^^^^^^^^^^^^^^ ocamlc: unknown option '--dump'. ...snip...
Any suggestions?
ocaml menhir ocamlbuild
Seungcheol jung
source share