sub alt { my @p = @_; my $parser = sub { my $in = shift; for my $p (@p) { if (my ($result, $out) = $p->($in)) { return ($result, $out); } } return; # failure }; return $parser; }