[antlr-interest] Print the actual code after building AST.

Andy Tripp atripp at comcast.net
Fri Apr 1 08:30:37 PST 2005


>
>
> hi,
> I have built a tree parser for a sample code.Thanks for your 
> suggestions Bryan ,I have corrected the mistakes.I want to print the 
> code after adding actions to it.
> As shown in my parser class ,I am indenting the 'map statements' .Now 
> I want to print the resultant code.
> How do i do it?I saw the java.g ...but it does not print the whole 
> inputstream after parsing.
>

Under the "file sharing" section on antlr.org, see the JavaEmitter by 
Terence for a treewalker that pretty-prints a Java AST.
Of, if you prefer, see my JavaEmitter which does the same thing, but 
walks the tree "by hand", rather than
using an ANTLR-generated treewalker.

Andy




More information about the antlr-interest mailing list