| Next | Higher-Order Parsing | 19 |
$expression = conc(lookfor("("),
$expression,
lookfor(")"),
);
We can't use $expression before we've defined it
But we can pull a very sly trick
We'll define a proxy parser, to postpone use of $expression until call time
my $expression;
my $EXPRESSION = sub { $expression->(@_) };
$expression = conc(lookfor("("),
$EXPRESSION,
lookfor(")"),
);
By the time $expression is actually called, it will be completely defined
| Next | ![]() |
![]() |
Copyright © 2007 M. J. Dominus |