Define a grammar - "abc example"
grammar ABC::Grammar;
token TOP { <statement> }
rule statement { <term> <addop> <term> }
token term { \d+ }
token addop { '+' | '-' }
TOP regex indicates where parsing begins
continued...| Parrot Compiler Tools | Parrot Compiler Tools | #11 |
grammar ABC::Grammar;
token TOP { <statement> }
rule statement { <term> <addop> <term> }
token term { \d+ }
token addop { '+' | '-' }
TOP regex indicates where parsing begins
continued...| Copyright © 2007 Patrick Michaud |