Parrot/PGE, parsers Parsers, Perl 6 Rules, and the Parrot Grammar Engine #28

Operator traits

We can use "equiv", "tighter", and "looser" to specify precedence levels relative to operators we've already defined:

proto infix:+ is precedence('=') { ... }
proto infix:- is equiv('infix:+') { ... }

proto infix:&& is looser('infix:+') { ... }
proto infix:|| is looser('infix:&&') { ... }

proto infix:* is tighter('infix:+') { ... }
proto infix:/ is equiv('infix:*') { ... }
proto infix:% is equiv('infix:*') { ... }

proto prefix:- is tighter('infix:*') { ... }
proto prefix:+ is equiv('prefix:-') { ... }

proto infix:** is tighter('prefix:-') { ... }
Copyright © 2006 Patrick Michaud