You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 as Times[Factorial[2], 3] not Times[2, Not[3]]
The text was updated successfully, but these errors were encountered:
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.
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]]
The text was updated successfully, but these errors were encountered: