drom
drom copied to clipboard
Add configuration means for better support of `menhir`
At the moment there does not seem to be a way to pass options to menhir
. As a use case, here's what I'd need in the dune
file of a package:
(library
…
(libraries … menhirLib)
…
(menhir (modules parser)
(flags --table))
One can add dune-libraries = "menhirLib"
in [fields]
to deal with the library dependency.
The part I fail to specify is the --table
, and a custom name for the parser
module.
For the second part, it should be in:
dune-trailer = """
(menhir (modules parser)
(flags --table))
"""
I think it should work
For the menhirLib
, you can use:
[[dependencies]]
menhir = { libname = "menhirLib", version = ">=1.2" }
It should put menhir
as the dependency in opam
files, and menhirLib
as the dependency in dune
files.
Ok thanks that's a way.
However note that with the dune trailer added as you suggested along with a generators = [… "menhir"]
, the generated dune
file has multiple rules for a parser parser
, i.e. multiple (menhir (modules parser) …)
structs. Removing "menhir"
from the list of generators leads to a functioning dune
file, yet drom
outputs a little line saying, e.g, no generator for parser.mly
, which looks like a future warning.
Clearly, using dune-trailer
is just a way to make it work, it is not a long term solution. The long term solution would probably to add a menhir-flags
entry or something like that.
Yes indeed. I'll leave the issue open as a reminder.
Soon available in https://github.com/OCamlPro/drom/pull/173