Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
OCaml顶级不解释注释_Ocaml_Ocaml Batteries - Fatal编程技术网

OCaml顶级不解释注释

OCaml顶级不解释注释,ocaml,ocaml-batteries,Ocaml,Ocaml Batteries,我得到了这个错误 $ ocaml Objective Caml version 3.12.1 _________________________ [| + | | Batteries - | |_____|_|_________________| _________________________ | - Type '#help;;' | | + |] |___________________|_|___| Loading syntax exten

我得到了这个错误

$ ocaml
        Objective Caml version 3.12.1
  _________________________
[| +   | |   Batteries   - |
 |_____|_|_________________|
  _________________________
 | -  Type '#help;;' | | + |]
 |___________________|_|___|


Loading syntax extensions...
    Camlp4 Parsing version 3.12.1

# (* i am just a comment. nobody cares about me. oh wait! *);;
# Error: Parse error: illegal begin of top_phrase
# 

当我试图在解释器中输入注释时。ocaml解释器中不允许使用注释,还是我做错了什么?

我认为您根本没有输入任何内容,这是一个语法错误

Error: Parse error: illegal begin of top_phrase
尝试在注释后输入以下内容:

# (* Hello *) ;;
Error: Syntax error

我猜这是因为
;,则code>在注释之外位于注释块内,解释器将期望输入,直到再次以
;终止。谢谢,这很有意义。即使是python和ruby也不允许在其repl中出现这样的注释。只有Erlang和mono csharp shell允许这样做。所以我想,不期望发生这样的事情是公平的。
# (* Hello *) 3 ;;
- : int = 3