Perl 6 An Introduction to Perl 6 #30

Tokens and rules

'token' is a regex that has backtracking disabled by default

'rule' is a token that understands whitespace separators

token ident { [ <alpha> | '_' ] \w+ }

rule if_statement {
    'if' <EXPR> <block>
    [ 'elsif' <EXPR> <block> ]*
    [ 'else'  <EXPR> <block> ]?
}
Copyright © 2008 Patrick Michaud