Dune error when adding a second parser to a Menhir project

Edit: Sorry, I think was actually a simple file naming error… Imagine if the error said “no such file” instead. :joy:

Sorry for spamming the forum. Not much beginner info available online, I’m afraid.

So, I’m testing to add a second parser, to parse a token stream of a small DSL inside the main language. Get a basic error:

10 | (menhir
11 |   (modules parser docblockparser))
Error: No rule found for lib/docblockparser.mly

Full dune file in that folder:

(library
 (libraries base stdio str re dolog expect_test_helpers_kernel)
 (preprocess (pps ppx_deriving.show ppx_deriving.ord ppx_inline_test ppx_assert ppx_expect ppx_compare ppx_sexp_conv))
 (inline_tests)
 (name pholyglot))

(ocamllex
  (modules lexer))

(menhir
  (modules parser docblockparser))

(env
  (dev
    (flags (:standard -warn-error -A))))

Compiling the main parser works fine.

Any ideas?

Sometimes during a Dune build, some files are not present in the source tree but are generated using Dune rules. So it makes some kind of sense that Dune’s error is “No rule found for <filename>”. That being said, a more helpful error message may be “File <filename> not found and no rule found to generate it.”

1 Like