[antlr-interest] Rewriting to Flat Tree Nodes for Associative Multiary Operators

Randall R Schulz rschulz at sonic.net
Thu Oct 2 15:04:05 PDT 2008


On Thursday 02 October 2008 15:01, Randall R Schulz wrote:
> ...
>
> Whether you include an empty alternative (as you showed) or make the
> entire sub-rule optional, as I'd tried earlier:
>
> op790FormulaFlat
>     :   (op780FormulaFlat -> op780FormulaFlat)
>         ( Or rDisjuncts = op790FormulaFlat) + )
>     ->  ^(Or $op790FormulaFlat $rDisjuncts+)
>     ) ?
>     ;

The missing paren was an editing error of some sort. Naturally, it would 
not compile that way. This was what I'd tried:

op790FormulaFlat
    :   (op780FormulaFlat -> op780FormulaFlat)
    (
        ( Or rDisjuncts = op790FormulaFlat) + )
    ->  ^(Or $op790FormulaFlat $rDisjuncts+)
    ) ?
    ;



RRS


More information about the antlr-interest mailing list