|Anonymous | Login | Signup for a new account||2013-05-23 17:58 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005068||OCaml||OCaml general||public||2010-06-08 12:27||2012-09-27 18:04|
|Target Version||later||Fixed in Version|
|Summary||0005068: ocamlc/camlp4 should give better error messages for syntax errors|
|Description||ocamlc often just gives a "Syntax error", and even though it prints line/column range it is not immediately obvious what is wrong.|
It would be useful if a more descriptive error message was given instead of a generic "Syntax error".
The ocaml toplevel, and camlp4 is better sometimes when it comes to syntax errors, however their messages aren't very user friendly either.
Here is an example:
module foo = struct
type t = int
$ ocamlc test.ml
File "test.ml", line 1, characters 7-10:
Error: Syntax error
An experienced ocaml programmer might know its due to the lowercase identifier, for others its not so clear what is wrong.
camlp4 is slightly better, at least it gives more detail about what is wrong,
however one can't ascertain that it is the lowercase first letter just from the message. The error location is wrong for camlp4 also:
$ camlp4o test.ml
File "test.ml", line 1, characters 0-6:
Parse error: "rec" or "type" or [a_UIDENT] expected after "module" (in [str_item]
|Additional Information||It would be nice if ocamlc/camlp4 could give a message like:|
File "test.ml", line1, characters 7-10:
Parse error: "rec" or "type" or identifier with uppercase first letter expected after "module"
|Tags||No tags attached.|
Here is an interesting idea on how to give better syntax errors, without having to edit the grammar parser (or its tables):
Basically you give it an example of a syntax error and the message, and it determines which state your parser would reach for that syntax error, and use your error message there instead of the default "Syntax Error".
Perhaps this could be adapted to OCaml's parsers?
|2010-06-08 12:27||edwin||New Issue|
|2010-06-23 10:31||edwin||Note Added: 0005570|
|2011-06-01 23:31||doligez||Status||new => acknowledged|
|2012-07-10 20:20||doligez||Target Version||=> 4.01.0+dev|
|2012-07-31 13:36||doligez||Target Version||4.01.0+dev => 4.00.1+dev|
|2012-09-18 13:26||doligez||Target Version||4.00.1+dev => later|
|2012-09-27 18:04||doligez||Category||Incoming => OCaml general|
|Copyright © 2000 - 2011 MantisBT Group|