Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 545

Generate a parser enabling incremental API and inspection API

$
0
0

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 of menhir 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 work on parser_e.mly directly 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.

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 StackOverflow: stackoverflow dot com slash questions slash 71193987 *)

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 545

Trending Articles