ocaml/dune

Support for menhir's `.messages` files

Aberta

#3.284 aberto em 20 de mar. de 2020

 (15 comentários) (2 reações) (0 responsável)OCaml (478 forks)github user discovery
enhancementgood first issuemenhir

Métricas do repositório

Stars
 (1.882 estrelas)
Métricas de merge de PR
 (Mesclagem média 1d 20h) (345 fundiu PRs em 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.

Guia do colaborador