Make menhir add user-defined functions from .mly to .mli

感情迁移 提交于 2019-12-24 06:48:28

问题


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.



来源:https://stackoverflow.com/questions/40514349/make-menhir-add-user-defined-functions-from-mly-to-mli

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!