[antlr-interest] How to create many AST trees from one rule

Jared Klumpp jklumpp at harmonia.com
Fri Oct 30 14:08:09 PDT 2009


--   However, do you have some particular reason to make the tree look like that? It is just as easy to deal with: ^(DECL type ^(VARS A B C)) in a walker.


The method we're using for creating nodes only allows one node to be created at a time and I want the ability to do something like getRecordType("foo").getDefs() and have this return 3 definitions (in your A, B, C example).




Indhu - that method works well in this situation, but do you know how I could make it work when identifiers are on the left? For example if decl were this rule:

decl

scope {

                Token typeTkn;

}

                :               varList type {$decl::typeTkn=$type.start;}
-> varList

                ;

Thanks for the help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091030/1fbbd9b5/attachment.html 


More information about the antlr-interest mailing list