{ cmd = new GetOptionCommand(AntlrInput::tokenText($KEYWORD).c_str() + 1); }
| /* sort declaration */
DECLARE_SORT_TOK { PARSER_STATE->checkThatLogicIsSet(); }
+ { if(!PARSER_STATE->isTheoryEnabled(Smt2::THEORY_UF) &&
+ !PARSER_STATE->isTheoryEnabled(Smt2::THEORY_ARRAYS) &&
+ !PARSER_STATE->isTheoryEnabled(Smt2::THEORY_DATATYPES) &&
+ !PARSER_STATE->isTheoryEnabled(Smt2::THEORY_SETS)) {
+ PARSER_STATE->parseError(std::string("Free sort symbols not allowed in ") + PARSER_STATE->getLogic().getLogicString());
+ }
+ }
symbol[name,CHECK_UNDECLARED,SYM_SORT]
{ PARSER_STATE->checkUserSymbol(name); }
n=INTEGER_LITERAL
sortSymbol[t,CHECK_DECLARED]
{ Debug("parser") << "declare fun: '" << name << "'" << std::endl;
if( sorts.size() > 0 ) {
+ if(!PARSER_STATE->isTheoryEnabled(Smt2::THEORY_UF)) {
+ PARSER_STATE->parseError(std::string("Functions (of non-zero arity) cannot be declared in logic ") + PARSER_STATE->getLogic().getLogicString());
+ }
t = EXPR_MANAGER->mkFunctionType(sorts, t);
}
Expr func = PARSER_STATE->mkVar(name, t);
$cmd = new DeclareFunctionCommand(name, c, t); }
| DECLARE_SORTS_TOK { PARSER_STATE->checkThatLogicIsSet(); }
+ { if(!PARSER_STATE->isTheoryEnabled(Smt2::THEORY_UF) &&
+ !PARSER_STATE->isTheoryEnabled(Smt2::THEORY_ARRAYS) &&
+ !PARSER_STATE->isTheoryEnabled(Smt2::THEORY_DATATYPES) &&
+ !PARSER_STATE->isTheoryEnabled(Smt2::THEORY_SETS)) {
+ PARSER_STATE->parseError(std::string("Free sort symbols not allowed in ") + PARSER_STATE->getLogic().getLogicString());
+ }
+ }
{ $cmd = new CommandSequence(); }
LPAREN_TOK
( symbol[name,CHECK_UNDECLARED,SYM_SORT]
nonemptySortList[sorts] RPAREN_TOK
{ Type t;
if(sorts.size() > 1) {
+ if(!PARSER_STATE->isTheoryEnabled(Smt2::THEORY_UF)) {
+ PARSER_STATE->parseError(std::string("Functions (of non-zero arity) cannot be declared in logic ") + PARSER_STATE->getLogic().getLogicString());
+ }
t = EXPR_MANAGER->mkFunctionType(sorts);
} else {
t = sorts[0];
sortList[sorts] RPAREN_TOK
{ Type t = EXPR_MANAGER->booleanType();
if(sorts.size() > 0) {
+ if(!PARSER_STATE->isTheoryEnabled(Smt2::THEORY_UF)) {
+ PARSER_STATE->parseError(std::string("Predicates (of non-zero arity) cannot be declared in logic ") + PARSER_STATE->getLogic().getLogicString());
+ }
t = EXPR_MANAGER->mkFunctionType(sorts, t);
}
Expr func = PARSER_STATE->mkVar(name, t);
addOperator(kind::SET_SINGLETON, "setenum");
break;
+ case THEORY_DATATYPES:
+ Parser::addOperator(kind::APPLY_CONSTRUCTOR);
+ Parser::addOperator(kind::APPLY_TESTER);
+ Parser::addOperator(kind::APPLY_SELECTOR);
+ break;
+
case THEORY_STRINGS:
defineType("String", getExprManager()->stringType());
addStringOperators();
return d_logic.isTheoryEnabled(theory::THEORY_BV);
case THEORY_CORE:
return true;
+ case THEORY_DATATYPES:
+ return d_logic.isTheoryEnabled(theory::THEORY_DATATYPES);
case THEORY_INTS:
return d_logic.isTheoryEnabled(theory::THEORY_ARITH) &&
d_logic.areIntegersUsed() && ( !d_logic.areRealsUsed() );
addTheory(THEORY_BITVECTORS);
}
+ if(d_logic.isTheoryEnabled(theory::THEORY_DATATYPES)) {
+ addTheory(THEORY_DATATYPES);
+ }
+
if(d_logic.isTheoryEnabled(theory::THEORY_SETS)) {
addTheory(THEORY_SETS);
}