我正在使用需要camlp5的OCaml代码;然而,toplevel(我正在使用utop)会自动加载更新的,不兼容的camlp4。这些是启动消息:
Findlib has been successfully loaded. Additional directives:
#require "package";; to load a package
#list;; to list the available packages
#camlp4o;; to load camlp4 (standard syntax)
#camlp4r;; to load camlp4 (revised syntax)
#predicates "p,q,...";; to set these predicates
Topfind.reset();; to force that packages will be reloaded
#thread;; to enable threads
.ocamlinit
我使用的内容如下所示:
#use "topfind";;
#thread;;
我使用camlp5
安装了opam
,并在我发出ocamlfind list
时显示;文件camlp5.cma
也位于/home/<username>/.opam/4.02.1/lib/camlp5/camlp5.cma
。
但是,尝试加载camlp5o
和camlp5r
会因Unknown directive camlp5o
而失败。
如何让utop
了解camlp5
以及如何将camlp4
替换为camlp5
作为默认预处理器?
非常感谢提前!
答案 0 :(得分:3)
$ ocaml
OCaml version 4.02.1
Findlib has been successfully loaded. Additional directives:
#require "package";; to load a package
#list;; to list the available packages
#camlp4o;; to load camlp4 (standard syntax)
#camlp4r;; to load camlp4 (revised syntax)
#predicates "p,q,...";; to set these predicates
Topfind.reset();; to force that packages will be reloaded
#thread;; to enable threads
# #require "camlp5";;
/home/kakadu/.opam/4.02.1/lib/camlp5: added to search path
# #load "camlp5o.cma";;
Camlp5 parsing version 6.12
#