#load“unix.cma”导致语法错误

时间:2013-07-06 13:38:09

标签: syntax-error ocaml

我正在尝试在解释器中编译/运行由另一个程序员编写的程序。该程序使用此结构:

#load "unix.cma"
我以前没见过的。我找到了这个页面:http://ocamlunix.forge.ocamlcore.org/generalities.html提到了它,但是在解释器中键入此代码会导致语法错误。当我通过ocamlc使用此指令运行文件时,会发生同样的事情。我错过了什么?

ocamlc -v
The Objective Caml compiler, version 3.12.1
Standard library directory: /usr/lib64/ocaml

1 个答案:

答案 0 :(得分:2)

#load是一个顶级指令,在ocamlcocamlopt编译器中不可用,但只在OCaml toplevel(REPL)ocaml中可用。见http://caml.inria.fr/pub/docs/manual-ocaml/manual023.html#toc91。使用toplevel来运行程序:

ocaml blahblah.ml
相关问题