Next | Higher-Order Parsing | 24 |
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 |