diff options
author | Morgan Deters <mdeters@gmail.com> | 2012-03-01 14:48:04 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2012-03-01 14:48:04 +0000 |
commit | 45a138c326da72890bf889a3670aad503ef4aa1e (patch) | |
tree | fa0c9a8497d0b33f78a9f19212152a61392825cc /src/printer | |
parent | 8c0b2d6db32103268f84d89c0d0545c7eb504069 (diff) |
Partial merge from kind-backend branch, including Minisat and CNF work to
support incrementality.
Some clean-up work will likely follow, but the CNF/Minisat stuff should be
left pretty much untouched.
Expected performance change negligible; slightly better on memory:
http://church.cims.nyu.edu/regress-results/compare_jobs.php?job_id=3705&reference_id=3697&mode=&category=&p=5
Note that there are crashes, but that these are exhibited in the nightly
regression run too!
Diffstat (limited to 'src/printer')
-rw-r--r-- | src/printer/cvc/cvc_printer.cpp | 21 | ||||
-rw-r--r-- | src/printer/smt2/smt2_printer.cpp | 13 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/printer/cvc/cvc_printer.cpp b/src/printer/cvc/cvc_printer.cpp index 283cdd725..04690f500 100644 --- a/src/printer/cvc/cvc_printer.cpp +++ b/src/printer/cvc/cvc_printer.cpp @@ -94,7 +94,11 @@ void CvcPrinter::toStream(std::ostream& out, TNode n, int depth, bool types, boo break; case kind::CONST_RATIONAL: { const Rational& rat = n.getConst<Rational>(); - out << '(' << rat.getNumerator() << '/' << rat.getDenominator() << ')'; + if(rat.getDenominator() == 1) { + out << rat.getNumerator(); + } else { + out << '(' << rat.getNumerator() << '/' << rat.getDenominator() << ')'; + } break; } case kind::CONST_INTEGER: { @@ -107,6 +111,12 @@ void CvcPrinter::toStream(std::ostream& out, TNode n, int depth, bool types, boo out << num; break; } + case kind::SUBRANGE_TYPE: + out << '[' << n.getConst<SubrangeBounds>() << ']'; + break; + case kind::SUBTYPE_TYPE: + out << "SUBTYPE(" << n.getConst<Predicate>() << ")"; + break; case kind::TYPE_CONSTANT: switch(TypeConstant tc = n.getConst<TypeConstant>()) { case REAL_TYPE: @@ -129,6 +139,7 @@ void CvcPrinter::toStream(std::ostream& out, TNode n, int depth, bool types, boo break; } break; + default: Warning() << "Constant printing not implemented for the case of " << n.getKind() << endl; out << n.getKind(); @@ -340,6 +351,14 @@ void CvcPrinter::toStream(std::ostream& out, TNode n, int depth, bool types, boo op << '/'; opType = INFIX; break; + case kind::INTS_DIVISION: + op << "DIV"; + opType = INFIX; + break; + case kind::INTS_MODULUS: + op << "MOD"; + opType = INFIX; + break; case kind::LT: op << '<'; opType = INFIX; diff --git a/src/printer/smt2/smt2_printer.cpp b/src/printer/smt2/smt2_printer.cpp index 393ad664b..691e96ed7 100644 --- a/src/printer/smt2/smt2_printer.cpp +++ b/src/printer/smt2/smt2_printer.cpp @@ -127,6 +127,19 @@ void Smt2Printer::toStream(std::ostream& out, TNode n, break; } + case kind::SUBRANGE_TYPE: { + const SubrangeBounds& bounds = n.getConst<SubrangeBounds>(); + // No way to represent subranges in SMT-LIBv2; this is inspired + // by yices format (but isn't identical to it). + out << "(subrange " << bounds.lower << ' ' << bounds.upper << ')'; + break; + } + case kind::SUBTYPE_TYPE: + // No way to represent predicate subtypes in SMT-LIBv2; this is + // inspired by yices format (but isn't identical to it). + out << "(subtype " << n.getConst<Predicate>() << ')'; + break; + default: // fall back on whatever operator<< does on underlying type; we // might luck out and be SMT-LIB v2 compliant |