You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在OCaml中用Dune生成Menhir的.automaton文件?

无法通过Dune生成Menhir的.automaton文件

我尝试生成.automaton文件,已在lib目录下的dune文件中添加如下配置:

(menhir
  (flags --explain --dump)
  (modules parser))

执行dune build后,用find . -name '*.automaton'找不到预期的文件。可通过以下步骤复现问题:

git clone https://github.com/dhilst/pfpy.git && cd pfpy
opam install --deps-only .
dune build

更新1
执行dune build --verbose后确认Menhir已执行:

Running[23]: (cd _build/.sandbox/740f245a4e0ba91f52e6ab53118b4542/default && /home/me/.opam/4.14.1/bin/menhir --explain --inspection --table --dump lib/parser.mly --base lib/parser --infer-read-reply lib/parser__mock.mli.inferred)

但构建完成后.sandbox文件夹为空:

$ ls -l _build/.sandbox 
total 0

更新2
目前临时解决方法是直接执行menhir --explain --dump lib/parser.mly,该命令虽返回错误状态,但能生成所需的.automaton文件。


内容的提问来源于stack exchange,提问作者geckos

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 07:02:40