in reply to Parse::RecDescent Puzzlement

Using the builtin "leftop" directive speeds things up quite a bit, e.g.:
lv1expr : <leftop:lv2expr addsub lv1expr> { my @ops = @{$item[1]}; my $res = shift @ops; while (@ops) { my ($op, $num) = (shift@ops, shift@ops); if ($op eq '+') { $res+= $num } else { $res -= $num; } } $return = $res; } # ... addsub: /[-+]/
/s