[antlr-interest] Print an AST in original order

Varun Bhargava varun.bhargava at carsales.com.au
Tue Jul 29 01:46:20 PDT 2008


Hi All,

 

I'm using ANTLR3 for C# target. My problem is to load up a statement
into a tree, so some substitutions to the tree and then print out the
tree in original order to re-generate the input statement but with some
substitutions.

 

I cannot seem to print the AST in its original order. For EG;

 

          WHERE

              |

             AND

           /       \

        =           =

      /   \        /  \

     A    5      b    10

 

 

The above tree should be printed as WHERE A=5 AND b = 10

 

However this is not the case in ANTLR. Has anyone done this before? If
yes could you please point me in the right direction or give me some
sample code?

 

Thanks

Varun

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080729/2518d2df/attachment.html 


More information about the antlr-interest mailing list