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...Parrot | Parrot Compiler Toolkit | #30 |
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 R. Michaud http://www.pmichaud.com/2008/pres/ |