Help for this page
my %actions = '*' => { $^a * $^b }, ... '-' => { $^a - $^b }; ... make %actions{$<op>.ast}.(|$/<lhs rhs>)
rule expression { <lhs=.numeric> <op> <rhs=.numeric> }
method numeric($/) { make +$/ } # ^ convert to a number ... } make $value; }
use v6; grammar Calc { ... say "$m<expression> = $m.ast()"; # vim: ft=perl6
www.com | www.net | www.org
No recent polls found