[antlr-interest] New article on StringTemplates and Treewalkers

Sohail Somani sohail at taggedtype.net
Tue Jan 10 19:58:17 PST 2006


On Tue, 2006-01-10 at 22:25 -0500, Andy Tripp wrote:
> As I say in the article, it's almost never that simple. In the case of a 
> missing return, I also go
> look at all the calls to the function and if the return value is ever 
> used, I give a warning, because I
> really don't know what value to return. Also, if the function is the 
> special "main" function, I need to
> do a System.exit() rather than a return.

How the heck would you write a pattern based rule for static *flow
analysis* to check if there is a path that does not end in return?

I'll be so bold as to say that you can't unless you hand-coded it.

> >ST has  
> >nothing to do with that.  The tree walker merely guides general  
> >output generation...it would reference a previous pass over the input  
> >that computed the flow analysis.
> >
> Why not just compute the flow analysis as needed?
> 
> My general objection to the tree walker is that I don't see it as 
> "guiding general output generation", but
> rather as "embedding calls to the code that does all the work at 
> arbitrary places in a parser grammar
> amidst ANTLR syntax."

Hardly arbitrary. Is your software open source? I'd like to take a look
at how you managed to do all these wonderful things without writing
code.

> I'd rather have code that says "Here are my 200 rules, in the order they 
> should fire". That seems like
> the better way to "guide output generation".

So rather than use existing languages than tools, invent your own?



More information about the antlr-interest mailing list