Next | Higher-Order Parsing | 26 |
# expression → "(" expression ")" # | term ("+" expression | nothing)
$expression = L("(") - $Expression - L(")") | $Term - (L("+") - $Expression | $nothing);
This looks almost exactly like the grammar rule we're implementing
But it's actually Perl code, not a limited sub-language
We can do similar tricks in SML or Haskell
I'll use this notation from now on
Next | Copyright © 2007 M. J. Dominus |