我有这段代码,其中包含一个camlp4 引用。
let f_name = "my_func"
<:str_item< value $lid:f_name$ a = a * 2 >>
通过运行它之后camlp4of
,它会产生这个:
Ast.StExp (_loc,
(Ast.ExApp (_loc,
(Ast.ExApp (_loc, (Ast.ExId (_loc, (Ast.IdLid (_loc, "=")))),
(Ast.ExApp (_loc,
(Ast.ExApp (_loc,
(Ast.ExId (_loc, (Ast.IdLid (_loc, "value")))),
(Ast.ExId (_loc, (Ast.IdLid (_loc, f_name)))))),
(Ast.ExId (_loc, (Ast.IdLid (_loc, "a")))))))),
(Ast.ExApp (_loc,
(Ast.ExApp (_loc, (Ast.ExId (_loc, (Ast.IdLid (_loc, "*")))),
(Ast.ExId (_loc, (Ast.IdLid (_loc, "a")))))),
(Ast.ExInt (_loc, "2")))))))
我的问题是,是否有打印生成的 ocaml 代码?我应该使用什么camlp4of
命令或选项来显示代码?我希望从上面的例子中看到的是:
value my_func a = a * 2
那可能吗?原因是因为我想做一些调试,看看生成的 ocaml 代码是什么样子的。