@@ -35,24 +35,24 @@ class expr2smvt
3535
3636 // In NuSMV 2.6., ! (not) has a high precedence (above ::), whereas
3737 // in the CMU SMV implementation it has the same as other boolean operators.
38- // We use the CMU SMV precedence for !.
38+ // We use the NuSMV precedence for !.
3939 // Like CMU SMV, we give the same precedence to -> and <->, to avoid ambiguity.
4040 // Note that the precedence of mod in the CMU SMV differs from NuSMV's.
4141 // We use NuSMV's.
4242 enum class precedencet
4343 {
4444 MAX = 16 ,
4545 INDEX = 15 , // [ ] , [ : ]
46- CONCAT = 14 , // ::
46+ NOT = 14 , // !
4747 UMINUS = 13 , // - (unary minus)
48- MULT = 12 , // * / mod
49- PLUS = 11 , // + -
50- SHIFT = 10 , // << >>
51- UNION = 9 , // union
52- IN = 8 , // in
53- REL = 7 , // = != < > <= >=
54- TEMPORAL = 6 , // AX, AF, etc.
55- NOT = 5 , // !
48+ CONCAT = 12 , // ::
49+ MULT = 11 , // * / mod
50+ PLUS = 10 , // + -
51+ SHIFT = 9 , // << >>
52+ UNION = 8 , // union
53+ IN = 7 , // in
54+ REL = 6 , // = != < > <= >=
55+ TEMPORAL = 5 , // AX, AF, etc.
5656 AND = 4 , // &
5757 OR = 3 , // | xor xnor
5858 IF = 2 , // (• ? • : •)
@@ -74,6 +74,26 @@ class expr2smvt
7474 -> <->
7575 */
7676
77+ /* From https://nusmv.fbk.eu/userman/v27/nusmv.pdf
78+
79+ The order of parsing precedence for operators from high to low is:
80+ [ ] , [ : ]
81+ !
82+ - (unary minus)
83+ ::
84+ * / mod
85+ + -
86+ << >>
87+ union
88+ in
89+ = != < > <= >=
90+ &
91+ | xor xnor
92+ (• ? • : •)
93+ <->
94+ ->
95+ */
96+
7797 struct resultt
7898 {
7999 resultt (precedencet _p, std::string _s) : p(_p), s(std::move(_s))
0 commit comments