[antlr-interest] Using nonterminals as root node in tree parser rules

Ploett, Norbert norbert.ploett at siemens.com
Tue Jul 11 06:32:22 PDT 2006


Hi all, 
 
it seems that this cannot be done in an antlr tree parser:
 
nonterminal :
        TERMINAL1
    |   TERMINAL2
    ;
 
rule : 
        #(nonterminal other_stuff)
    ;
 
So we have several alternative tokens as the tree root that we would
like to match with rule.
Any other elegant way to do this short of
 
rule :
        #(TERMINAL1 other_stuff)
    |   #(TERMINAL2 other_stuff)
    ;
 
?
 
Thanks,
 
 
Norbert


More information about the antlr-interest mailing list