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

Jared Klumpp jklumpp at harmonia.com
Thu Oct 29 12:44:21 PDT 2009


I'm trying to create a new DECL for each identifier - if this were C, int a, b; would become (DECL A (TYPE INT)) (DECL B (TYPE INT)).

My rules (untested):
decl: type IDENTS SEMI
-> ^(DECL idents ^(TYPE $type));

idents: IDENT (COMMA IDENT)*
-> IDENT+;

My problem is this creates (DECL A B (TYPE INT)), how can I split this into multiple trees when idents collects the identifiers into one tree?

Thanks,
Jared
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091029/d51d7126/attachment.html 


More information about the antlr-interest mailing list