ocaml/dune

Support for menhir's `.messages` files

Open

#3,284 opened on Mar 20, 2020

 (15 comments) (2 reactions) (0 assignees)OCaml (478 forks)github user discovery
enhancementgood first issuemenhir

Repository metrics

Stars
 (1,882 stars)
PR merge metrics
 (Avg merge 1d 20h) (345 merged PRs in 30d)

Description

Desired Behavior

Have builtin rules for .messages files produced by menhir (cf menhir's manual ). This would include:

  • generating a fresh .messages file for a new grammar / menhir parser
  • updating an existing .messages file when the grammar / menhir parser changes
  • compiling the .messages file into an .ml file to make it available in the rest of the project

Note that given that .messages files contain hand-written messages, they should be part of the source tree, hence the first two rules above (generating fresh .messages files and updating them) would need to promote the generated file (potentially overwriting the current one in the case of an update). However, the .ml file generated from the .messages file needn't be promoted.

Apologies if it already exists, but I couldn't find any reference to it neither in the docs (both for stable and latest), nor in the code (after a search for messages, nothing seemed related to menhir).

Example

I already have implemented manual rules for this in one of my projects, see https://github.com/Gbury/dolmen/blob/master/src/languages/smtlib2/v2.6/dune . These rules work however they are somewhat limited by the almost circular dependency of a .messages file on itself because of the updating process, so the example linked requires some user manual intervention to move a new or updated generated .messages file.

Contributor guide