Created
May 30, 2010 06:14
-
-
Save ekiru/418828 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
role FoldArithmetic::Actions does PAST::Optimization::Actions { | |
method foldAdd($/) { | |
my ($left, $right) := $<PAST::Val>; | |
my $result := PAST::Val.new(:value(pir::add($left.value(), $right.value()))); | |
make $result; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar FoldArithmetic::Optimization does PAST::Optimization { | |
rule foldAdd { | |
<PAST::Op(<PAST::Val>, <PAST::Val>)> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment