Next Higher-Order Parsing 22 

パーサParsers

        $atom = alt(lookfor("NUMBER"),
                    lookfor("VAR"),
                    conc(lookfor("FUNC"),
                         lookfor("("),
                         $EXPRESSION,
                         lookfor(")"),
                        ));
     #  factor → atom ("^" NUMBER | nothing)
     
     $factor = conc($ATOM, alt(conc(lookfor("^"), 
                                    lookfor("NUMBER")),
                               \¬hing));
     #  term → factor ("*" term | nothing)
     
     $term = conc($FACTOR, alt(conc(lookfor("*"), $TERM),
                               \&nothing));

Next Copyright © 2007 M. J. Dominus