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 @@ -1089,6 +1089,38 @@ void smt2_parsert::command(const std::string &c)
1089
1089
entry.type = type;
1090
1090
entry.definition = nil_exprt ();
1091
1091
}
1092
+ else if (c == " define-const" )
1093
+ {
1094
+ if (next_token () != SYMBOL)
1095
+ throw error (" expected a symbol after define-const" );
1096
+
1097
+ const irep_idt id = buffer;
1098
+
1099
+ if (id_map.find (id) != id_map.end ())
1100
+ {
1101
+ std::ostringstream msg;
1102
+ msg << " identifier `" << id << " ' defined twice" ;
1103
+ throw error (msg.str ());
1104
+ }
1105
+
1106
+ const auto type = sort ();
1107
+ const auto value = expression ();
1108
+
1109
+ // check type of value
1110
+ if (value.type () != type)
1111
+ {
1112
+ std::ostringstream msg;
1113
+ msg << " type mismatch in constant definition: expected `"
1114
+ << smt2_format (type) << " ' but got `" << smt2_format (value.type ())
1115
+ << ' \' ' ;
1116
+ throw error (msg.str ());
1117
+ }
1118
+
1119
+ // create the entry
1120
+ auto &entry = id_map[id];
1121
+ entry.type = type;
1122
+ entry.definition = value;
1123
+ }
1092
1124
else if (c==" define-fun" )
1093
1125
{
1094
1126
if (next_token ()!=SYMBOL)
You can’t perform that action at this time.
0 commit comments