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
Regardless of operator precedence values, there is no parse ambiguity when an infix operator has a prefix operator on its right hand side:
---- MODULETest ----
ASSUMEA&~B
====
For all prefix operators except for negative, SANY follows this rule. The precedence range of the negative prefix operator is 12-12. Every infix operator of precedence 13 or greater (about a quarter of them) will generate a parse conflict where there should not be one; for example:
---- MODULETest ----
ASSUMEA&-B
====
There is no parse ambiguity here and yet SANY outputs a parse error:
****** SANY2 Version 2.2 created 08 July 2020
Parsing file /home/ahelwer/src/tlaplus/java-tools/tlatools/org.lamport.tlatools/Test.tla
Beginning Module definition
Beginning Begin module
Ending Begin module
Beginning Extends
Ending Extends
Beginning Module body
Beginning Definition
Beginning Identifier LHS
Ending Identifier LHS
Beginning Expression
Beginning ExtendableExpr
Beginning Primitive expression
Ending Primitive expression
Beginning Infix Op
Ending Infix Op
Beginning Infix Op
Ending Infix Op
***Parse Error***
Precedence conflict between ops & in block line 2, col 9 to line 2, col 9 of module Test and -..
Residual stack trace follows:
ExtendableExpr starting at line 2, column 7.
Expression starting at line 2, column 7.
Definition starting at line 2, column 1.
Module body starting at line 2, column 1.
Module definition starting at line 1, column 1.
Fatal errors while parsing TLA+ spec in file Test.tla
tla2sany.semantic.AbortException
*** Abort messages: 1
In module Test
Could not parse module Test from file Test.tla
I assume this is because SANY special-cases the negative prefix operator due to its alternative -. symbol-only presentation (for example, it shows up as "minus" in prefix op expressions in the parse tree) so the logic handling these types of expressions are different than with other prefix operators.
The text was updated successfully, but these errors were encountered:
Regardless of operator precedence values, there is no parse ambiguity when an infix operator has a prefix operator on its right hand side:
For all prefix operators except for negative, SANY follows this rule. The precedence range of the negative prefix operator is 12-12. Every infix operator of precedence 13 or greater (about a quarter of them) will generate a parse conflict where there should not be one; for example:
There is no parse ambiguity here and yet SANY outputs a parse error:
I assume this is because SANY special-cases the negative prefix operator due to its alternative
-.
symbol-only presentation (for example, it shows up as "minus" in prefix op expressions in the parse tree) so the logic handling these types of expressions are different than with other prefix operators.The text was updated successfully, but these errors were encountered: