[antlr-interest] Whitespace question

Jim Idle jimi at temporal-wave.com
Sat Oct 10 18:42:38 PDT 2009


Indeed I am fond of saying this ;-) For a great example of how much better you can get with those sorts of messages I always quote Visual Studio 2008 and C#. Other examples can be found of course. With these sorts of error catches you can say things like "It looks like you are missing the xyz construct here", or "You cannot use the abc clause in conjunction with the def clause", instead of "Syntax error at PRINT" and so on.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Gavin Lambert
> Sent: Saturday, October 10, 2009 5:53 AM
> To: Reid Rivenburgh; Graham Wideman
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Whitespace question
> 
> At 10:34 10/10/2009, Reid Rivenburgh wrote:
>  >In my particular case, I think it's okay to let a few illegal
>  >constructs through and catch them further down the line.  I was
>  >just hoping that I would be able to easily write a tighter
>  >grammar.
> 
> As Jim Idle is fond of pointing out, it's often better to make the
> grammar fairly tolerant and deal with errors as late as possible
> (usually in the tree parser) -- that way you have more contextual
> information and can often produce a better error message.
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address





More information about the antlr-interest mailing list