calc example -- adding actions
grammar Calc::Grammar;
token TOP { <statement> {*} }
rule statement { <term> <addop> <term> {*} }
token term { \d+ {*} }
token addop { '+' | '-' }
Add the {*} markers
Create action methods for each rule
| Programming Parrot | Programming Parrot | #43 |
grammar Calc::Grammar;
token TOP { <statement> {*} }
rule statement { <term> <addop> <term> {*} }
token term { \d+ {*} }
token addop { '+' | '-' }
Add the {*} markers
Create action methods for each rule
| Copyright © 2008 Patrick Michaud |