[antlr-interest] syntactic predicates and exceptions
dcaton at shorelinesoftware.com
Thu Oct 20 08:00:59 PDT 2005
The whole world isn't using Java, Eclipse and Antlr Studio.
There seems to be a feeling here that there is a tradeoff between efficient
code, and "pretty" or readable code. I love Antlr, but the generated code
isn't all that readable now. Especially when you use #( ... ) to generate
trees, the generated code will make your eyes bleed. It's one huge nested
expression on a single line with no whitespace or any attempt to nicely
format it. Try debugging that when you've accidentally created a tree that
recurses on itself.
In any case, there's no connection between any particular coding construct,
whether it's an if statement or an exception or whatever, and how readable
that code might be. Readability is a matter of style and formatting. You
can take the simplest piece of code and format it in such as way that it is
unreadable. You could take an entire C++ program and put it on a single
line, or you could put line feeds between each token and expand it
vertically to an unreadable level. Could be the best piece of code in the
world, just bad formatting.
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Prashant Deva
Sent: Thursday, October 20, 2005 3:32 AM
To: Nigel Sheridan-Smith
Cc: ANTLR Interest
Subject: Re: [antlr-interest] syntactic predicates and exceptions
>If you remove exception handling for back-tracking, there is one risk: the
>readability of the code (and hence the ease of debugging and tracing) will
With ANTLR Studio available, I dont think debugging the generated code
should be an issue as you can debug right into the grammar file and take a
look at 'live' parse trees and ASTs etc.
So I think it is quite ok that the code is a little cluttered up if the gain
in speed is large.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest