| Next | Higher-Order Parsing | 16 |
expression → "(" expression ")"
| term ("+" expression | nothing)
The simplest parser is the one that corresponds to nothing
It consumes no tokens and always succeeds:
sub nothing {
my $tokens = shift;
return (undef, $tokens);
}
This parser function gets a token list
It examines the tokens
Returns a value and a new token list
The undef here is a dummy value
The new token list is the same as the old one
| Next | ![]() |
![]() |
Copyright © 2007 M. J. Dominus |