OK, I'm at another computer, same system as yours, no older files but copied your code and my replacement from this thread, and downloaded portable Strawberry Perl v5.16.3
C:\>perl rec.pl Enter --> a=2 print 2 2 Enter --> C:\>perl -MParse::RecDescent -wE "say $Parse::RecDescent::VERSION" 1.967015 C:\>perl -v This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x +64-multi-thread
Edit: I think failure to parse should prevent any changes to your "symbol table" i.e. %VARIABLE and suppress output from "print":
# ... expression : INTEGER OP expression { main::expression(@item) } | VARIABLE OP expression { main::expression(@item) } | INTEGER | VARIABLE <defer: $main::VARIABLE{$item{VARIABLE}} ||= 0 > { $main::VARIABLE{$item{VARIABLE}}} print_instruction : /print/i expression <defer: print $item{expression}."\n" > assign_instruction : VARIABLE "=" expression <defer: $main::VARIABLE{$item{VARIABLE}} = $item +{expression} > # ...
Enter --> a=1 Enter --> a=2 print a blah blah ERROR (line 1): Invalid instruction: Was expecting assign instr +uction, or print instruction Error returned by parsing Enter --> print a 1
Though perhaps it's laughable because lacks serious studying about how it really must be built.
In reply to Re^5: how to match entire buffer with Parse::RecDescent
by vr
in thread how to match entire buffer with Parse::RecDescent
by expo1967
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |