Next | Higher-Order Parsing | 22 |
With this definition, a complete definition of atom is:
$atom = alt(lookfor("NUMBER"), lookfor("VAR"), conc(lookfor("FUNC"), lookfor("("), $EXPRESSION, lookfor(")"), ));
Similarly, here's $factor:
# factor → atom ("^" NUMBER | nothing) $factor = conc($ATOM, alt(conc(lookfor("^"), lookfor("NUMBER")), \¬hing));
Here's $term:
# term → factor ("*" term | nothing) $term = conc($FACTOR, alt(conc(lookfor("*"), $TERM), \¬hing));
Next | Copyright © 2007 M. J. Dominus |