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.

貢獻者指南