calc example - grammar
grammar Calc::Grammar; token TOP { <statement> } rule statement { <term> <addop> <term> } token term { \d+ } token addop { '+' | '-' }
TOP regex indicates where parsing begins
continued...Perl 6 on Parrot | Rakudo Perl - Perl 6 on Parrot | #27 |
grammar Calc::Grammar; token TOP { <statement> } rule statement { <term> <addop> <term> } token term { \d+ } token addop { '+' | '-' }
TOP regex indicates where parsing begins
continued...Copyright © 2008 Patrick Michaud |