Parrot Parrot Compiler Toolkit #50

Defining a bottom-up parser

1. Use Perl 6-like proto subs to define tokens

##  terms
token term { <value> {*} }
proto term: is parsed(&term) is precedence('=') { ... }

##  multiplicative
proto infix:<*> is looser('term:')      { ... }
proto infix:</> is equiv(infix:<*>)     { ... }

##  additive
proto infix:<+> is looser(infix:<*>)    { ... }
proto infix:<-> is equiv(infix:<+>)     { ... }
continued...
Copyright © 2008 Patrick R. Michaud
http://www.pmichaud.com/2008/pres/