Question

$ 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?

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top