I’m trying to hack on the OCaml grammar, and finding that I can’t load it into the toplevel. I looked at the HACKING.adoc file, and found nothing there that addressed what I’m seeing. I wondered if I’m doing something basic wrong.
My environment:
- ocaml 5.0.0
- Mehnir 20220210
I’ve copied a subset of the files from /parsing – enough to compile parser.mly and lexer.mll to .cmo, and linked all these files into a “pack” – in order to avoid the possibility of name-clashes with existing modules.
My failure:
If I #require
the findlib package I’ve created, I get divergence; control-C produces the backtrace:
../local-install/lib/pa_ppx_parsetree_pattern_parsing/pa_ppx_parsetree_pattern_parsing.cma: loaded
C-c C-cInterrupted.
Camlp5 parsing version (OCaml) 8.00.05
Raised by primitive operation at Parser.xv_xlist_rec_module_declaration_and_module_declaration_.diverge in file "parser.ml", line 18259, characters 24-33
Called from Parser.xv_xlist_rec_module_declaration_and_module_declaration_ in file "parser.ml", line 18259, characters 37-46
Called from Topeval.load_compunit in file "toplevel/byte/topeval.ml", line 229, characters 11-23
#
This is with a 100% original-source set of files – I’ve verified that they’re identical – and the only thing that’s different, is that I had to create .ml
files for parsetree.mli
so that I could like those into the “pack”.
Obviously I started with a modified grammar and other files, but I’ve backtracked to this in debugging.
Is there something obvious I’m missing for how to use a Menhir-generated parser in the OCaml toplevel ?