[antlr-interest] tree transformation in Parser

Gregor Pardella kruemmel99 at yahoo.de
Wed Aug 24 09:41:21 PDT 2005


Hello,

maybe someone is able to help me - I become desperate.

My parser is able to parse a statement like this one:

  a = b = c = 4;

and it generates a tree that looks like:

<ROOT>  
|_ =
   |_ a
   |_ =
      |_ b
      |_ =
         |_ c
         |_ 4

after finishing the expression rules.

Does anybody have an idea how to transform this tree
so
that it looks like this one:

<ROOT>
|_ =
|  |_ a
|  |_ 4
|
|_ =
|   |_ b
|   |_ 4
|      
|_ =
   |_ c
   |_ 4

or 

<ROOT>
|_ =
|  |_ c
|  |_ 4
|
|_ =
|   |_ b
|   |_ c
|      
|_ =
   |_ a
   |_ b


In other terms I want to flat the multi-assignment.

Or does anybody have an idea how to flatten
multi-assignments in another way?

Please help!

Thanks 
Gregor Pardella


	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


More information about the antlr-interest mailing list