[antlr-interest] generating formatted java code from an AST

Andy Tripp antlr at jazillian.com
Mon Mar 27 07:49:57 PST 2006


Vaios Kalpias wrote:

> Hello everybody. I want to generate java code from a given antlr AST 
> tree. I know about the JavaEmitter class, but this class is outdated, 
> as it works only for Java 1.3. Does anybody know where I can get an 
> updated version of the class for Java 1.5? Or maybe you could tell me 
> if there is something similar I could use... I tried to update 
> JavaEmitter on my own, but there are a lot of things I don't 
> understand yet. So any help would be appreciated, because this is 
> extremely important for me!
>
> Thx a lot!
> Vaios.
>
I'll try to update my JavaEmitter to work with Java 1.5 over the next 
few days.

On a related note, I've build a prototype of a WYSIWYG AST Emitter. You 
feed it the ANTLRTokenTypes.txt file and and any AST,
and then you see the AST in a tree on the left and the pretty output on 
the right. You then specify how each
AST node type should be displayed by clicking various nodes in the tree 
and setting properties, and you see the
pretty output get prettier as you do it. It's pretty cool. I was able to 
build a JavaEmitter without any programming in
just a few minutes. This will take a few weeks to a few months to clean 
up and make it more generic so that it works
with any sort of AST.

Andy


More information about the antlr-interest mailing list