Error messages do are different:
> cat syntax_error.ml
let f a b =
a + b *
> ocamlc -c syntax_error.ml
File "syntax_error.ml", line 3, characters 0-0:
Syntax error
> ocamlc -pp camlp4o.opt -c syntax_error.ml
File "syntax_error.ml", line 2, characters 6-7:
Parse error: [expr] expected after [infix operator (level 3) (start with '*', '/', '%')] (in [expr])
Preprocessor error
ocamlc standard parser gives erroneous position, and just complains about "Syntax error", while camlp4 is able to say precisely where the error occurred, and why (here because an expression is expected after the * infix operator). And this really makes the difference for tricky syntax errors (or when
learning
the language - I wish I had been taught of camlp4 back then ^^).
Matthieu Wipliez
----- Message d'origine ----
De : Yitzhak Mandelbaum <yitzhak@research.att.com>
À : caml-list <caml-list@yquem.inria.fr>
Envoyé le : Mardi, 11 Décembre 2007, 3h03mn 57s
Objet : Re: [Caml-list] Ask for a more efficient way to deallocate memory (full version)
On Dec 10, 2007, at 5:59 PM, Jon Harrop wrote:
However, using any camlp4 macros requires using the camlp4 replacement for the
front-end
of the compiler. That uses a different parsing technology (top-down
recursive descent LL rather than bottom-up LALR) so the error messages from
the compiler are completely different.
Just to clarify : the error messages from the *parser* are completely different. Everything after the parser is
the same with or without camlp4. Most importantly, you don't have to learn new type-checker messages.
Yitzhak
--------------------------------------------------
Yitzhak Mandelbaum
AT&T Labs - Research