Closed sn6uv closed 9 years ago
Try using the precedence argument to pg.production. PLY own docs have a good explanation: www.dabeaz.com/ply/ply.html#ply_nn27. Jump to the part about %prec part. It does the same thing as the precedence arg to pg.production.
Thanks @kirbyfan64. I've opened #40 to document this feature
Is it possible to add precedence directly on productions?
I'm writing a parser for a language that reuses the
!
symbol for both factorial (postfix) and negation (prefix). I'd like to be able to resolve the conflict with precedence but it seems like it's only possible to add precedence to tokens.Example
I want
2 ! 3
to parse asTimes[Factorial[2], 3]
notTimes[2, Not[3]]