我有一个用传统 makefile 构建的大项目。我想在我的项目中添加一个像这个项目这样的错误处理机制。
在示例项目中,UnitActionsParser
按照dune的如下规则生成了一个模块:
;; The following two rules create a copy of the file parser.mly named
;; unitActionsParser.mly. This is a copy of the grammar where the semantic
;; actions have been removed and replaced with unit values. It is compiled
;; by Menhir's table back-end to obtain the module UnitActionsParser.
;; The use of [--external-tokens Parser] is required for the two parsers
;; to share a single [token] type. This makes them usable with the same
;; lexer.
(rule
(action
(with-stdout-to unitActionsParser.mly
(run menhir
%{dep:parser.mly}
--only-preprocess-u
))))
(menhir
(modules unitActionsParser)
(flags --table --external-tokens Parser)
)
目前,makefile
我的项目包含如下内容:
OCAMLYACC= $(OCAMLPREFIX)menhir -v
%.ml %.mli: %.mly
$(OCAMLYACC) $*.mly
所以现在,我想知道如何构建这样的UnitActionsParser
模块。最好的办法是修改我的makefile
,有人知道怎么做吗?否则,我们也可以首先手动添加它。我在命令行中尝试过$ menhir --table --external-tokens Parser
,但它返回了我Usage: menhir <options> <filenames>
。有人可以帮忙吗?