[antlr-interest] ANTLR-based Java grammar for javac compiler

Jim Idle jimi at temporal-wave.com
Thu Nov 13 16:01:28 PST 2008


On Thu, 2008-11-13 at 15:26 -0800, Yang Jiang wrote:
> Andy Tripp wrote:
> > This seems like a good goal for the new ANTLR tree rewrite mechanism.
> > Given the problem of converting a "whatever the java.g author thought
> > was reasonable" AST to a "exactly what javac needs" AST, if the
> > rewrite mechanism can make this easier than just "doing it by hand", then
> > it will be a "good" mechanism, and not just a toy.
> >
> > Having said that, it looks to me like none of the tree rewrite software
> > (e.g. TXL) out there are "good". In other words, they don't look to me 
> > like they
> > are saving anybody any work, even for this typical use case.
> >
> > I'm sure Terence could use ANTLR treewalkers to do this pretty quickly,
> > but I wonder if Jiang could, too.
> Hi Andy,
> I agree with you that rewrite from on AST to another AST could be hard :)
> 
> But what Simon was saying is to use the Antlr tree rewrite + a custom 
> TreeAdaptor to build
> the javac tree directly, rather than using the Antlr tree built from the 
> tree rewrite grammar with a tree walker,
> then generating the javac tree.

I thought about this for JavaFX but decided against it because of the
inability to append new nodes. It would mean having code in the tree
adaptor to work out when a node was 'complete' and this adds more
complication to the system for basically no gain. 

Jim



More information about the antlr-interest mailing list