File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1103,6 +1103,38 @@ void smt2_parsert::command(const std::string &c)
1103
1103
entry.type = type;
1104
1104
entry.definition = nil_exprt ();
1105
1105
}
1106
+ else if (c == " define-const" )
1107
+ {
1108
+ if (next_token () != SYMBOL)
1109
+ throw error (" expected a symbol after define-const" );
1110
+
1111
+ const irep_idt id = buffer;
1112
+
1113
+ if (id_map.find (id) != id_map.end ())
1114
+ {
1115
+ std::ostringstream msg;
1116
+ msg << " identifier `" << id << " ' defined twice" ;
1117
+ throw error (msg.str ());
1118
+ }
1119
+
1120
+ const auto type = sort ();
1121
+ const auto value = expression ();
1122
+
1123
+ // check type of value
1124
+ if (value.type () != type)
1125
+ {
1126
+ std::ostringstream msg;
1127
+ msg << " type mismatch in constant definition: expected `"
1128
+ << smt2_format (type) << " ' but got `" << smt2_format (value.type ())
1129
+ << ' \' ' ;
1130
+ throw error (msg.str ());
1131
+ }
1132
+
1133
+ // create the entry
1134
+ auto &entry = id_map[id];
1135
+ entry.type = type;
1136
+ entry.definition = value;
1137
+ }
1106
1138
else if (c==" define-fun" )
1107
1139
{
1108
1140
if (next_token ()!=SYMBOL)
You can’t perform that action at this time.
0 commit comments