Simple rules
Here's a Perl 6 regex to parse simple addition/subtraction statements
\d+ [ '+' | '-' ] \d+
This says
- Match one or more digits
- followed immediately by a '+' or '-'
- followed by one or more digits
Parrot | Perl6Grammar compiler and parsers | #6 |
Here's a Perl 6 regex to parse simple addition/subtraction statements
\d+ [ '+' | '-' ] \d+
This says
Copyright © 2009 http://www.pmichaud.com/2009/pres/ |