// NOTE: do not clear the vectors here!
}
: identifierList[ids,CHECK_NONE,SYM_VARIABLE] COLON type[t,CHECK_DECLARED]
- { const std::vector<Expr>& vars = PARSER_STATE->mkVars(ids, t, false);
+ { const std::vector<Expr>& vars = PARSER_STATE->mkBoundVars(ids, t);
terms.insert(terms.end(), vars.begin(), vars.end());
for(unsigned i = 0; i < vars.size(); ++i) {
types.push_back(t);
* re-declared if topLevel is true (CVC allows re-declaration if the
* types are compatible---if they aren't compatible, an error is
* thrown). Also if topLevel is true, variable definitions are
- * permitted and "cmd" is output.
+ * permitted and "cmd" is output. If topLevel is false, bound vars
+ * are created
*/
declareVariables[CVC4::Command*& cmd, CVC4::Type& t, const std::vector<std::string>& idList, bool topLevel]
@init {
}
} else {
Debug("parser") << " " << *i << " not declared" << std::endl;
- Expr func = PARSER_STATE->mkVar(*i, t, true);
if(topLevel) {
+ Expr func = PARSER_STATE->mkVar(*i, t, true);
Command* decl = new DeclareFunctionCommand(*i, func, t);
seq->addCommand(decl);
+ } else {
+ PARSER_STATE->mkBoundVar(*i, t);
}
}
}
return vars;
}
+std::vector<Expr>
+Parser::mkBoundVars(const std::vector<std::string> names,
+ const Type& type) {
+ std::vector<Expr> vars;
+ for(unsigned i = 0; i < names.size(); ++i) {
+ vars.push_back(mkBoundVar(names[i], type));
+ }
+ return vars;
+}
+
void
Parser::defineVar(const std::string& name, const Expr& val,
bool levelZero) {
/** Create a new CVC4 bound variable expression of the given type. */
Expr mkBoundVar(const std::string& name, const Type& type);
+ /**
+ * Create a set of new CVC4 bound variable expressions of the given type.
+ */
+ std::vector<Expr> mkBoundVars(const std::vector<std::string> names, const Type& type);
+
/** Create a new CVC4 function expression of the given type. */
Expr mkFunction(const std::string& name, const Type& type,
bool levelZero = false);