Python on Parrot Python on Parrot #49

Operator precedence parsing

Defining operator tokens and precedence:

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

proto infix:<*> is tighter(infix:<+>) { ... }
proto infix:</> is equiv(infix:<*>) { ... }

This defines the four basic arithmetic operators, and generates code to initialize an operator precedence parser.

These definitions can go in the same grammar input file that defines other rules.

Copyright © 2007 Patrick Michaud