Next Higher-Order Parsing 25 

Parsers

     # expression → "(" expression ")" 
     #             | term ("+" expression | nothing)
     $expression = alt(conc(lookfor("(")),
                            $Expression,
                            lookfor(")"),
                       conc($Term,
                            alt(conc(lookfor("+"), $Expression),
                                \&nothing));
      $expression = L("(") - $Expression - L(")")
                  | $Term - (L("+") - $Expression | $nothing);

Next Copyright © 2007 M. J. Dominus