[antlr-interest] Stringt. propagation in dispatcher rules

Felix Dorner felix_do at web.de
Wed Apr 30 00:00:20 PDT 2008


Hey,

I don't know if this can be handled more elegantly. I have a template 
grammar. The rule 'statement' is a mere dispatcher and doesn't really do 
anything to the output, so I simply need to propagate the template for 
every alternative. It would be great if this would happen by default 
(i.e. if there's no ->). But then it might be unclear which one to 
choose if an alternative invokes two or more subrules..

Thanks, Felix

statement
    : declaration -> {$declaration.st}
    | expression -> {$expression.st}
    | block -> {$block.st}
    | ifStatement -> {$ifStatement.st}
    ;


More information about the antlr-interest mailing list