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

A temporary "if/unless" rule

token statement_control {
    <?ws>
    $<KEY>:=[if|unless] <expression:  {> <block>
        [ <?ws> elsif <expression:  {> <block> ]*
        [ <?ws> else <block> ]?
}

It's temporary because statement_control will likely become a grammatical category hash (i.e., statement_control:<if>)

The ' {' argument to the <expression> subrule tells the bottom-up parser to stop parsing at a top-level brace token (with leading whitespace).

Copyright © 2006 Patrick Michaud