calc example - grammar
grammar Calc::Grammar;
token TOP { <statement> }
rule statement { <term> <addop> <term> }
token term { \d+ }
token addop { '+' | '-' }
Place the above in src/pct/grammar.pg
continued...| Parrot | Parrot Compiler Toolkit | #31 |
grammar Calc::Grammar;
token TOP { <statement> }
rule statement { <term> <addop> <term> }
token term { \d+ }
token addop { '+' | '-' }
Place the above in src/pct/grammar.pg
continued...|
Copyright © 2009 http://www.pmichaud.com/2009/pres/ |