-->

Make menhir add user-defined functions from .mly t

2019-07-29 04:19发布

问题:

Menhir allows to add arbitrary ocaml code to the end of the .mly file, where I want to declare a few functions. But I could not find a way to make menhir add my functions to the .mli file, so that they are visible from the other modules. Is it possible?

回答1:

The answer is simple, it's no. The code defined in the .mly file is only used by the parser.

As stated in the manual :

A header is a piece of OCaml code, surrounded with %{ and %} . It is copied verbatim at the beginning of the .ml file.



标签: ocaml menhir