Operator precedence parsing
Once again, we've borrowed a bit of Perl 6-like syntax for this:
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.
These definitions can go in the same grammar input file that is provided to pgc.pir . It then creates the code needed to initialize an operator table.