Skip to content

Commit e926415

Browse files
polgreenkroening
authored andcommitted
SMT-LIB2: parse FloatX sorts
This adds parsing for the FloatX sorts to the SMT-LIB2 parser.
1 parent 24dd735 commit e926415

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
basic-fp3.smt2
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\(define-fun a \(\) \(_ FloatingPoint 5 11\) .*\)
7+
\(define-fun b \(\) \(_ FloatingPoint 8 24\) .*\)
8+
\(define-fun c \(\) \(_ FloatingPoint 11 53\) .*\)
9+
\(define-fun d \(\) \(_ FloatingPoint 15 113\) .*\)
10+
--
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(set-logic FP)
2+
3+
(declare-fun a () Float16)
4+
(declare-fun b () Float32)
5+
(declare-fun c () Float64)
6+
(declare-fun d () Float128)
7+
8+
(check-sat)
9+
(get-model)

src/solvers/smt2/smt2_parser.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,19 @@ void smt2_parsert::setup_sorts()
13951395
sorts["Int"] = [] { return integer_typet(); };
13961396
sorts["Real"] = [] { return real_typet(); };
13971397

1398+
sorts["Float16"] = [] {
1399+
return ieee_float_spect::half_precision().to_type();
1400+
};
1401+
sorts["Float32"] = [] {
1402+
return ieee_float_spect::single_precision().to_type();
1403+
};
1404+
sorts["Float64"] = [] {
1405+
return ieee_float_spect::double_precision().to_type();
1406+
};
1407+
sorts["Float128"] = [] {
1408+
return ieee_float_spect::quadruple_precision().to_type();
1409+
};
1410+
13981411
sorts["BitVec"] = [this] {
13991412
if(next_token() != smt2_tokenizert::NUMERAL)
14001413
throw error("expected numeral as bit-width");

0 commit comments

Comments
 (0)