最近,在OCaml官方github上宣布Camlp4
替换为ppx rewriters and extension points
(https://github.com/ocaml/camlp4):
Camlp4 was part of the official OCaml distribution until its version 4.01.0. Since then it has been replaced by a simpler system which is easier to maintain and to learn: ppx rewriters and extension points.
我一直在使用
Camlp4
为DSL(与OCaml分离的语法)编写解析器。那么,我想问一下
ppx rewriters
工具是否可以做同样的事情?感谢您抽出时间阅读我的问题!
最佳答案
不能。PPX专门用于扩展OCaml语言功能,并可能使用属性和扩展点来保持其语法。它不提供像CamlP4这样的解析器生成器。如果要构建与OCaml完全不同的语法,请坚持使用P4。 PPX不能帮助您。
CamlP4不会中断。它成为OCaml编译器的独立工具:https://github.com/ocaml/camlp4您还应该能够使用opam install camlp4
进行安装。
关于ocaml - 使用ppx和扩展点在OCaml中为DSL编写解析器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37810521/