-
Notifications
You must be signed in to change notification settings - Fork 469
Using menhir --explain #6865
Description
Before dune.3.0, with the following stanza,
(menhir (modules ...) (flags --explain))when the menhir grammars have conflicts, the reports that menhir generates to describe the conflicts (.conflicts files, one for each .mli file) were available in _build/$profile/.
Since dune.3.0, sandboxing prevents dune from keeping these files, forcing the user to run menhir --explain manually in the source tree to get the reports.
Desired Behavior
The .conflicts files could be copied to the _build/$profile/ directory: that would restore the previous behavior (before dune.3.0), which was better than the current situation, even if I would prefer never have to touch to the ``_build/` directory.
Another behavior could be to promote the .conflicts files in the source tree, which would be close to the experience of using menhir without dune, and which would made the .conflicts file easier to notice. Another possibility could be to dump these files to the standard output when they exist (which can be convenient, but with the same drawbacks than with warnings, that are not displayed again in case of rebuild).
Example
A file test.conflicts should be available somewhere (or its contents should be displayed) after compiling the following file.
test.mly:
%token A
%start<unit> a
%%
let a := A; {} | A; {}
dune:
(library (name test))
(menhir (modules test) (flags --explain))
This issue was previously discussed here: https://discuss.ocaml.org/t/how-to-use-menhir-explain-with-dune/11132