|
7 | 7 | \*******************************************************************/
|
8 | 8 |
|
9 | 9 | #include "expr2smv.h"
|
10 |
| - |
11 |
| -#include <util/arith_tools.h> |
12 |
| -#include <util/bitvector_types.h> |
13 |
| -#include <util/lispexpr.h> |
14 |
| -#include <util/lispirep.h> |
15 |
| -#include <util/namespace.h> |
16 |
| -#include <util/std_expr.h> |
17 |
| -#include <util/symbol.h> |
18 |
| - |
19 |
| -class expr2smvt |
20 |
| -{ |
21 |
| -public: |
22 |
| - explicit expr2smvt(const namespacet &__ns) : ns(__ns) |
23 |
| - { |
24 |
| - } |
25 |
| - |
26 |
| -protected: |
27 |
| - // In NuSMV 2.6., ! (not) has a high precedence (above ::), whereas |
28 |
| - // in the CMU SMV implementation it has the same as other boolean operators. |
29 |
| - // We use the CMU SMV precedence for !. |
30 |
| - // Like CMU SMV, we give the same precedence to -> and <->, to avoid ambiguity. |
31 |
| - // Note that the precedence of mod in the CMU SMV differs from NuSMV's. |
32 |
| - // We use NuSMV's. |
33 |
| - enum class precedencet |
34 |
| - { |
35 |
| - MAX = 16, |
36 |
| - INDEX = 15, // [ ] , [ : ] |
37 |
| - CONCAT = 14, // :: |
38 |
| - UMINUS = 13, // - (unary minus) |
39 |
| - MULT = 12, // * / mod |
40 |
| - PLUS = 11, // + - |
41 |
| - SHIFT = 10, // << >> |
42 |
| - UNION = 9, // union |
43 |
| - IN = 8, // in |
44 |
| - REL = 7, // = != < > <= >= |
45 |
| - TEMPORAL = 6, // AX, AF, etc. |
46 |
| - NOT = 5, // ! |
47 |
| - AND = 4, // & |
48 |
| - OR = 3, // | xor xnor |
49 |
| - IF = 2, // (• ? • : •) |
50 |
| - IFF = 1, // <-> |
51 |
| - IMPLIES = 1 // -> |
52 |
| - }; |
53 |
| - |
54 |
| - /* |
55 |
| - From http://www.cs.cmu.edu/~modelcheck/smv/smvmanual.ps |
56 |
| -
|
57 |
| - The order of precedence from high to low is |
58 |
| - * / |
59 |
| - + - |
60 |
| - mod |
61 |
| - = != < > <= >= |
62 |
| - ! |
63 |
| - & |
64 |
| - | |
65 |
| - -> <-> |
66 |
| - */ |
67 |
| - |
68 |
| -public: |
69 |
| - bool convert_nondet_choice( |
70 |
| - const exprt &src, |
71 |
| - std::string &dest, |
72 |
| - precedencet precedence); |
73 |
| - |
74 |
| - bool convert_binary( |
75 |
| - const exprt &src, |
76 |
| - std::string &dest, |
77 |
| - const std::string &symbol, |
78 |
| - precedencet precedence); |
79 |
| - |
80 |
| - bool convert_rtctl( |
81 |
| - const ternary_exprt &src, |
82 |
| - std::string &dest, |
83 |
| - const std::string &symbol, |
84 |
| - precedencet precedence); |
85 |
| - |
86 |
| - bool convert_rtctl( |
87 |
| - const multi_ary_exprt &src, |
88 |
| - std::string &dest, |
89 |
| - const std::string &symbol1, |
90 |
| - const std::string &symbol2, |
91 |
| - precedencet precedence); |
92 |
| - |
93 |
| - bool convert_unary( |
94 |
| - const unary_exprt &, |
95 |
| - std::string &dest, |
96 |
| - const std::string &symbol, |
97 |
| - precedencet precedence); |
98 |
| - |
99 |
| - bool |
100 |
| - convert_index(const index_exprt &, std::string &dest, precedencet precedence); |
101 |
| - |
102 |
| - bool convert(const exprt &src, std::string &dest, precedencet &precedence); |
103 |
| - |
104 |
| - bool convert_if(const if_exprt &, std::string &dest, precedencet precedence); |
105 |
| - |
106 |
| - std::string convert(const exprt &); |
107 |
| - |
108 |
| - bool convert(const exprt &, std::string &dest); |
109 |
| - |
110 |
| - bool convert_symbol( |
111 |
| - const symbol_exprt &, |
112 |
| - std::string &dest, |
113 |
| - precedencet &precedence); |
114 |
| - |
115 |
| - bool convert_next_symbol( |
116 |
| - const exprt &src, |
117 |
| - std::string &dest, |
118 |
| - precedencet &precedence); |
119 |
| - |
120 |
| - bool convert_constant( |
121 |
| - const constant_exprt &, |
122 |
| - std::string &dest, |
123 |
| - precedencet &precedence); |
124 |
| - |
125 |
| - bool convert_cond(const exprt &src, std::string &dest); |
126 |
| - |
127 |
| - bool |
128 |
| - convert_norep(const exprt &src, std::string &dest, precedencet &precedence); |
129 |
| - |
130 |
| -protected: |
131 |
| - const namespacet &ns; |
132 |
| -}; |
| 10 | +#include "expr2smv_class.h" |
133 | 11 |
|
134 | 12 | /*******************************************************************\
|
135 | 13 |
|
|
0 commit comments