Subrules
- Generally we want our grammar to contain more structure
- Perl 6 allows us to name and re-use regexes
grammar Calc::Grammar; regex TOP { <integer> <addop> <integer> } regex integer { \d+ } regex addop { [ '+' | '-' ] }
Parrot | Perl6Grammar compiler and parsers | #11 |
grammar Calc::Grammar; regex TOP { <integer> <addop> <integer> } regex integer { \d+ } regex addop { [ '+' | '-' ] }
Copyright © 2009 http://www.pmichaud.com/2009/pres/ |