Perl 6 Compiler Perl 6 Compiler Status and the Parrot Compiler Toolkit #17

Regexes, Tokens, and Rules

A "rule" is a regex that doesn't backtrack (like a token), but whitespace in the regex is replaced by a <?ws> matching rule.

rule parameter_list 
  { <parameter>[ , <parameter>]*}

is the same as

token parameter_list 
  { <?ws> <parameter> [ <?ws> , <?ws> <parameter>]* }

is the same as

regex parameter_list 
  { <?ws>: <parameter>: [ <?ws>: , <?ws>: <parameter>:]*: }
Copyright © 2006 Patrick Michaud