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

Specifying operator tokens and precedence

PGE uses a Perl 6-like syntax to specify operator tokens and precedence.

## exponentiation
proto 'infix:**' is precedence('19=') { ... }

## symbolic unary
proto 'prefix:!' is precedence('18=') { ... }
proto 'prefix:+' is equiv('prefix:!') { ... }
proto 'prefix:-' is equiv('prefix:!')
    is post('neg') { ... }

## multiplicative
proto 'infix:*' is precedence('17=')
    is post('mul') { ... }
proto 'infix:/' is equiv('infix:*')
    is post('div') { ... }
Copyright © 2006 Patrick Michaud