I’d like for dune to
Create the Menhir parser.messages
file it it does not exist and
Update the parser.messages
file if it does and my parser.mly
has changed.
I defined two rules
(rule
(targets parser.messages)
(mode fallback)
(action
(with-stdout-to
%{targets}
(run menhir --list-errors %{targets}))))
(rule
(targets parser.messages)
(deps parser.mly)
(action
(with-stdout-to
%{targets}
(run menhir --update-errors %{targets}))))
but this doesn’t work since dune requires 1 rule to target 1 file.
Can I have my cake and eat it too?
Looks like I misunderstood how Menhir works .
nojb
May 23, 2025, 11:23am
3
Dune support for .messages
is being worked on: Add `.messages` support for Menhir by nojb · Pull Request #11753 · ocaml/dune · GitHub . You may find useful information there. And I encourage you to chime in if you have any suggestions.
You may also find useful information in the following post: Dune wish list for 2023 - #60 by zozozo .
Cheers,
Nicolas
2 Likes
JohnJ
May 23, 2025, 2:13pm
4
It’s worth mentioning that the general solution for the Dune question (not specific to Menhir) is that you have to create an intermediary file for each rule, e.g. print --list-errors
to parser.messages.list
. You only need to promote the final file, parser.messages
, to your source tree.
1 Like