I have a tokens.ml
file which has a type token
statement in it. I also have a tokens.mli
with the same type token
statement. Now, I have a parser.mly
which uses the tokens from tokens.mly
. I want to keep my tokens in tokens.ml/mli
and my parser in parser.mly
.
So, I tried compiling my parser using the command
menhir parser.mly --table --explain --external-tokens Tokens
This gives me an error saying one of my tokens does not exist. Specifically,
File "parser.mly", line 173, characters 4-12:
Error: OPERATOR is undefined.
So, menhir is not finding the Tokens
module. I don't know how to make it visible to menhir
. I tried making a tokens.cma
library, but even then I still get the same error.
Menhir doesn't seem to care if the module doesn't exist, because if I run the command
menhir parser.mly --table --explain --external-tokens SomeNonExistentModule
It still gives the same error about OPERATOR
being undefined.
How do I get Menhir to find my tokens module. I would prefer to not use ocamlbuild. If you suggest an ocamlbuild solution, please at least explain the intermediate manual steps I could do instead. I want to understand what Menhir expects.