buildListOfSymbols(n, visited, symbols);
printSMTLIB1VarDeclsToStream(symbols, os);
os << ":formula ";
- SMTLIB_Print(os, n, 0, &SMTLIB1_Print1);
+ SMTLIB_Print(os, n, 0, &SMTLIB1_Print1,true);
os << ")" << endl;
}
buildListOfSymbols(n, visited, symbols);
printVarDeclsToStream(symbols, os);
os << "(assert ";
- SMTLIB_Print(os, n, 0, &SMTLIB2_Print1);
+ SMTLIB_Print(os, n, 0, &SMTLIB2_Print1, false);
os << ")" << endl;
os << "(check-sat)" << endl;
os << "(exit)" << endl;
// Should be a symbol.
assert(a.GetKind()== SYMBOL);
a.nodeprint(os);
- os << " () (";
+
switch (a.GetType())
{
case BEEV::BITVECTOR_TYPE:
- os << "_ BitVec " << a.GetValueWidth() << ")";
+ os << " () (";
+ os << "_ BitVec " << a.GetValueWidth() << ")";
+
break;
case BEEV::ARRAY_TYPE:
- os << "Array (_ BitVec " << a.GetIndexWidth() << ") (_BitVec " << a.GetValueWidth() << ") )";
+ os << " () (";
+ os << "Array (_ BitVec " << a.GetIndexWidth() << ") (_ BitVec " << a.GetValueWidth() << ") )";
break;
case BEEV::BOOLEAN_TYPE:
- os << " Bool ";
+ os << " () Bool ";
break;
default:
BEEV::FatalError("printVarDeclsToStream: Unsupported type",a);
break;
}
- os << ")\n";
+ os << ")\n";
}
} //printVarDeclsToStream
{
unsigned int amount = GetUnsignedConst(c[1]);
if (BVZX == kind)
- os << "(_ zero_extend ";
+ os << "((_ zero_extend ";
else
- os << "(_ sign_extend ";
+ os << "((_ sign_extend ";
os << (amount - c[0].GetValueWidth()) << ") ";
SMTLIB2_Print1(os, c[0], indentation, letize);
unsigned int upper = GetUnsignedConst(c[1]);
unsigned int lower = GetUnsignedConst(c[2]);
assert(upper >= lower);
- os << "((_ extract" << upper << " " << lower << ") ";
+ os << "((_ extract " << upper << " " << lower << ") ";
SMTLIB2_Print1(os, c[0], indentation, letize);
os << ")";
}
return true;
}
-
- static string tolower(const char * name)
- {
- string s(name);
- for (size_t i = 0; i < s.size(); ++i)
- s[i] = ::tolower(s[i]);
- return s;
- }
-
// copied from Presentation Langauge printer.
- ostream& SMTLIB_Print(ostream &os, const ASTNode n, const int indentation, void (*SMTLIB1_Print1)(ostream&, const ASTNode , int , bool ))
+ ostream& SMTLIB_Print(ostream &os, const ASTNode n, const int indentation, void (*SMTLIB1_Print1)(ostream&, const ASTNode , int , bool ), bool smtlib1)
{
// Clear the maps
NodeLetVarMap.clear();
NodeLetVarVec.end();
os << "(let (";
+ if (!smtlib1)
+ os << "(";
//print the let var first
SMTLIB1_Print1(os, it->first, indentation, false);
os << " ";
//print the expr
SMTLIB1_Print1(os, it->second, indentation, false);
os << " )";
+ if (!smtlib1)
+ os << ")";
+
//update the second map for proper printing of LET
NodeLetVarMap1[it->second] = it->first;
{
os << " " << endl;
os << "(let (";
+ if (!smtlib1)
+ os << "(";
//print the let var first
SMTLIB1_Print1(os, it->first, indentation, false);
os << " ";
//print the expr
SMTLIB1_Print1(os, it->second, indentation, false);
os << ")";
+ if (!smtlib1)
+ os << ")";
+
//update the second map for proper printing of LET
NodeLetVarMap1[it->second] = it->first;
closing += ")";
void LetizeNode(const ASTNode& n, BEEV::ASTNodeSet& PLPrintNodeSet);
- ostream& SMTLIB_Print(ostream &os, const ASTNode n, const int indentation, void (*SMTLIB_Print1)(ostream&, const ASTNode , int , bool ));
+ ostream& SMTLIB_Print(ostream &os, const ASTNode n, const int indentation, void (*SMTLIB_Print1)(ostream&, const ASTNode , int , bool ), bool smtlib1);
bool containsAnyArrayOps(const ASTNode& n);
};