Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[examples/algebra] updated

- ShowContents is now GGE::ShowContents
- $match<expr> is $match.hash-access('expr') until hash stuff is fixed
- changed a 'say' to a 'warn'
  • Loading branch information...
commit c4fb5b3384bf05c92a70df5bc527cbd454db1ae2 1 parent c48c45b
@masak authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 examples/algebra
View
8 examples/algebra
@@ -2,13 +2,13 @@ use v6;
use GGE::Exp;
use GGE::OPTable;
-class Algebra::Literal is GGE::Exp does ShowContents {
+class Algebra::Literal is GGE::Exp does GGE::ShowContents {
method evaluate() {
+$.ast;
}
}
-class Algebra::BinOp is GGE::Exp does ShowContents {
+class Algebra::BinOp is GGE::Exp does GGE::ShowContents {
}
class Algebra::Addition is Algebra::BinOp {
@@ -35,10 +35,10 @@ given GGE::OPTable.new() -> $optable {
while prompt('> ') -> $input {
my $match = $optable.parse($input);
if $match.to < $input.chars {
- say 'Could not parse the arithmetic expression';
+ warn 'Could not parse the arithmetic expression';
next;
}
- my $expr = $match<expr>;
+ my $expr = $match.hash-access('expr');
say $expr.evaluate;
}
say '';
Please sign in to comment.
Something went wrong with that request. Please try again.