Implement progn style base level
This commit is contained in:
parent
39d791fcf4
commit
65f17aba82
1 changed files with 19 additions and 1 deletions
|
@ -121,7 +121,7 @@ my %stdctx = (
|
|||
|
||||
sub parser {
|
||||
my @tokens = @_;
|
||||
my $expr = parser_expr(\@tokens);
|
||||
my $expr = parser_prog(\@tokens);
|
||||
|
||||
return sub {
|
||||
my $ctx = shift;
|
||||
|
@ -131,6 +131,24 @@ sub parser {
|
|||
}
|
||||
}
|
||||
|
||||
sub parser_prog {
|
||||
my $ts = shift;
|
||||
|
||||
my @steps;
|
||||
|
||||
while (scalar @$ts)
|
||||
{
|
||||
push @steps, parser_expr($ts);
|
||||
}
|
||||
|
||||
return sub {
|
||||
my $ctx = shift;
|
||||
my $result;
|
||||
$result = $_->($ctx) foreach (@steps);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
sub parser_expr {
|
||||
my $ts = shift;
|
||||
my $tok = shift @$ts;
|
||||
|
|
Loading…
Reference in a new issue