[antlr-interest] Problem using AST
Austin Hastings
Austin_Hastings at Yahoo.com
Sun Nov 4 12:12:16 PST 2007
Put the subtrees into a queue, and dump them when you're done.
If you have a rule that unifies them, then using antlr it might look like:
var_or_func
: (vars+=VAR
| funcs+=FUNC)
-> $vars $funcs
;
If you don't have a single unifying rule, then you might have to create
an actual queue of nodes, and dump the queue at the end of your
top-level rule.
=Austin
atif azad wrote:
> Dear all
>
> I am using antlr trees and tree walker for a grammer.
>
> my output is
>
> (VAR int x) (VAR int y) (FUNC foo) (VAR int t) (FUCN_BLOCK int p)
> (FUCN base)
>
> What if I want that I should print the nodes starting with VAR ist
> then FUNC at second postion and so on.
> I mean i want the ouput like this
>
>
> (VAR int x) (VAR int y) (VAR int t) (FUNC foo) (FUCN_BLOCK int p )
> (FUCN base)
>
> How could I rearrange my output.
>
>
>
>
> kind Regards
>
> Azad , Atif
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's
> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
>
More information about the antlr-interest
mailing list