Skip to content
Browse files

Work on Stuifzand if: t+

  • Loading branch information...
1 parent 545164e commit 20baa745eaffaa8a5f20a2dfaa4db98b430f4bfb - committed Nov 7, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 sandbox/scanless/infix.pl
View
13 sandbox/scanless/infix.pl
@@ -18,7 +18,11 @@
use strict;
use warnings;
use English qw( -no_match_vars );
-use Marpa::R2 2.023008;
+use lib '../../r2/lib';
+use lib '../../r2/blib/arch';
+use Marpa::R2 2.023010;
+
+say STDERR "Using ", $INC{'Marpa/R2.pm'};
my $infix_grammar = Marpa::R2::Grammar->new(
{ start => 'Script',
@@ -27,17 +31,16 @@
rules => [ <<'END_OF_RULES' ]
Script ::=
Expression
- | kw_say Expression action => do_arg1
+ | (kw_say) Expression
Expression ::=
Number
- | Expression op_add Expression action => do_add
+ | Expression (op_add) Expression action => do_add
END_OF_RULES
}
);
-sub My_Actions::do_add { shift; return $_[0] + $_[2] }
+sub My_Actions::do_add { shift; return $_[0] + $_[1] }
sub My_Actions::do_arg0 { shift; return shift; }
-sub My_Actions::do_arg1 { shift; return $_[1]; }
$infix_grammar->precompute();

0 comments on commit 20baa74

Please sign in to comment.
Something went wrong with that request. Please try again.