2
$ 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
# 

I am getting this error

Error: Parse error: illegal begin of top_phrase

when I am try to enter a comment in the interpreter. Are comments not allowed in ocaml interpreter or am I doing something wrong?

Animesh
  • 4,926
  • 14
  • 68
  • 110

1 Answers1

5

I'd say you're entering nothing at all, which is a syntax error.

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

Try entering something after the comment:

# (* Hello *) 3 ;;
- : int = 3
Jeffrey Scofield
  • 65,646
  • 2
  • 72
  • 108
  • Thanks, that makes sense. Even python and ruby didn't allow comments like this in their REPLs. Only Erlang and mono-csharp-shell allowed this. So I guess it is fair to not expect something like this. – Animesh Sep 27 '12 at 18:10