Hi Bill.I think the way to do it is to have the arbitrary action add to the
rule_list List built by ANTLR. try
> spec
> : ^(SPEC r+=rule+)
> { <add nodes to $r list> }
> -> ^(SPEC $r+)
> ;
It might just work :)
T
On Aug 11, 2010, at 12:17 PM, Bill Andersen wrote:
> Hi Folks
>
> Here's the relevant fraction of a tree grammar I'm working on...
>
> spec
> : ^(SPEC rule+)
> ;
>
> rule
> : ^(RULE_DECL ID alts)
> ;
>
> It's a grammar that recognizes a language, the output of which is another
> ANTLR grammar.
>
> I want the first rule to look like this:
>
> spec
> : ^(SPEC rule+)
> { < some action here > }
> -> ^(SPEC < augmented list of rules >)
> ;
>
> In other words, I want to add some extra RULE_DECL trees on to the end of
> whatever rule+ accumulates, based on semantic information gathered during the
> tree parse.
>
> Is there a straightforward way to do this?
>
> Thanks
>
> .bill
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.