caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re : [Caml-list] Ask for a more efficient way to deallocate memory (full version)
@ 2007-12-11  9:56 Matthieu Wipliez
  2007-12-12  6:54 ` Camlp4 error messages (was Re: Re : [Caml-list] Ask for a more efficient way to deallocate memory) David Teller
  0 siblings, 1 reply; 2+ messages in thread
From: Matthieu Wipliez @ 2007-12-11  9:56 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1985 bytes --]

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


http://www.research.att.com/~yitzhak

 







      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr

[-- Attachment #2: Type: text/html, Size: 5665 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Camlp4 error messages (was Re: Re : [Caml-list] Ask for a more efficient way to deallocate memory)
  2007-12-11  9:56 Re : [Caml-list] Ask for a more efficient way to deallocate memory (full version) Matthieu Wipliez
@ 2007-12-12  6:54 ` David Teller
  0 siblings, 0 replies; 2+ messages in thread
From: David Teller @ 2007-12-12  6:54 UTC (permalink / raw)
  To: Matthieu Wipliez; +Cc: caml-list



> 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

Which might not always be a good thing.
That is, in the revised syntax, for instance, you write "list int"
instead of "int list" -- but the error message remains "int list".

Cheers,
 David


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-12  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-11  9:56 Re : [Caml-list] Ask for a more efficient way to deallocate memory (full version) Matthieu Wipliez
2007-12-12  6:54 ` Camlp4 error messages (was Re: Re : [Caml-list] Ask for a more efficient way to deallocate memory) David Teller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).