calc example -- adding actions
grammar Calc::Grammar; token TOP { <statement> } rule statement { <term> <addop> <term> } token term { \d+ } token addop { '+' | '-' }
Add the {*} markers
Perl 6 on Parrot | Rakudo Perl - Perl 6 on Parrot | #37 |
grammar Calc::Grammar; token TOP { <statement> } rule statement { <term> <addop> <term> } token term { \d+ } token addop { '+' | '-' }
Add the {*} markers
Copyright © 2008 Patrick Michaud |