[antlr-interest] Tree building question

Leah Perlmutter lrperlmu at colby.edu
Sun Feb 26 17:55:30 PST 2012


I am using antlr 3.4 and I have the following rule:

postfix_expression
    :   primary_expression
        (   '['^ expression ']'!
        |   '('^ ')'!
        |   '('^ argument_expression_list ')'!
        |   '.'^ IDENTIFIER
        |   '->'^ IDENTIFIER
        |   '++'^
        |   '--'^
        )*
    ;

It works almost the way I want, except in the first 3 cases of the or I
want the root to be an imaginary node with a name of my choosing instead of
the opening punctuation symbol. Is there a good way to do this?

Thanks,
-Leah


More information about the antlr-interest mailing list