@@ -239,7 +239,15 @@ constant_exprt smt2_convt::parse_literal(
239
239
value=string2integer (s.substr (2 ), 16 );
240
240
}
241
241
else
242
- PARSERERROR (" smt2_convt::parse_literal can't parse \" " +s+" \" " );
242
+ {
243
+ // Numeral
244
+ value=string2integer (s);
245
+ }
246
+ }
247
+ else if (src.get_sub ().size ()==2 &&
248
+ src.get_sub ()[0 ].id ()==" -" ) // (- 100)
249
+ {
250
+ value=-string2integer (src.get_sub ()[1 ].id_string ());
243
251
}
244
252
else if (src.get_sub ().size ()==3 &&
245
253
src.get_sub ()[0 ].id ()==" _" &&
@@ -433,6 +441,9 @@ exprt smt2_convt::parse_rec(const irept &src, const typet &_type)
433
441
434
442
if (type.id ()==ID_signedbv ||
435
443
type.id ()==ID_unsignedbv ||
444
+ type.id ()==ID_integer ||
445
+ type.id ()==ID_rational ||
446
+ type.id ()==ID_real ||
436
447
type.id ()==ID_bv ||
437
448
type.id ()==ID_fixedbv ||
438
449
type.id ()==ID_floatbv)
@@ -970,7 +981,9 @@ void smt2_convt::convert_expr(const exprt &expr)
970
981
{
971
982
assert (expr.operands ().size ()==1 );
972
983
973
- if (expr.type ().id ()==ID_rational)
984
+ if (expr.type ().id ()==ID_rational ||
985
+ expr.type ().id ()==ID_integer ||
986
+ expr.type ().id ()==ID_real)
974
987
{
975
988
out << " (- " ;
976
989
convert_expr (expr.op0 ());
@@ -2898,9 +2911,11 @@ void smt2_convt::convert_plus(const plus_exprt &expr)
2898
2911
2899
2912
out << " )" ;
2900
2913
}
2901
- else if (expr.type ().id ()==ID_rational)
2914
+ else if (expr.type ().id ()==ID_rational ||
2915
+ expr.type ().id ()==ID_integer ||
2916
+ expr.type ().id ()==ID_real)
2902
2917
{
2903
- out << " (+" ;
2918
+ out << " (+ " ;
2904
2919
convert_expr (expr.op0 ());
2905
2920
out << " " ;
2906
2921
convert_expr (expr.op1 ());
@@ -3285,7 +3300,9 @@ void smt2_convt::convert_mult(const mult_exprt &expr)
3285
3300
3286
3301
out << " ))" ; // bvmul, extract
3287
3302
}
3288
- else if (expr.type ().id ()==ID_rational)
3303
+ else if (expr.type ().id ()==ID_rational ||
3304
+ expr.type ().id ()==ID_integer ||
3305
+ expr.type ().id ()==ID_real)
3289
3306
{
3290
3307
out << " (*" ;
3291
3308
@@ -4378,7 +4395,8 @@ void smt2_convt::convert_type(const typet &type)
4378
4395
out << " (_ BitVec "
4379
4396
<< floatbv_type.get_width () << " )" ;
4380
4397
}
4381
- else if (type.id ()==ID_rational)
4398
+ else if (type.id ()==ID_rational ||
4399
+ type.id ()==ID_real)
4382
4400
out << " Real" ;
4383
4401
else if (type.id ()==ID_integer)
4384
4402
out << " Int" ;
0 commit comments