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

Martin Probst mail at martin-probst.com
Mon Mar 27 08:12:16 PST 2006

> 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,

Any reasons why you didn't use Parser._tokenNames[] (or whatever it's
called) instead of the XXXTokenTypes.txt?

> 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.

This might also be handy to generate readable token descriptions, e.g.
the text you can set to get "expected 'class'" instead of "expected


More information about the antlr-interest mailing list