ocaml/dune

Support for menhir's `.messages` files

开放

#3,284 创建于 2020年3月20日

 (15 条评论) (2 个反应) (0 位负责人)OCaml (478 个派生)github user discovery
enhancementgood first issuemenhir

仓库指标

星标
 (1,882 个星标)
PR 合并指标
 (平均合并 1天 20小时) (30 天内合并 345 个 PR)

描述

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.

贡献者指南