sorts.push_back(PARSER_STATE->mkSort(*i));
}
}
- sortSymbol[t,CHECK_DECLARED]
+ sortSymbol[t]
{ PARSER_STATE->popScope();
// Do NOT call mkSort, since that creates a new sort!
// This name is not its own distinct sort, it's an alias.
symbol[name,CHECK_NONE,SYM_VARIABLE]
{ PARSER_STATE->checkUserSymbol(name); }
LPAREN_TOK sortList[sorts] RPAREN_TOK
- sortSymbol[t,CHECK_DECLARED]
+ sortSymbol[t]
{ Trace("parser") << "declare fun: '" << name << "'" << std::endl;
if( !sorts.empty() ) {
t = PARSER_STATE->mkFlatFunctionType(sorts, t);
symbol[name,CHECK_UNDECLARED,SYM_VARIABLE]
{ PARSER_STATE->checkUserSymbol(name); }
LPAREN_TOK sortedVarList[sortedVarNames] RPAREN_TOK
- sortSymbol[t,CHECK_DECLARED]
+ sortSymbol[t]
{ /* add variables to parser state before parsing term */
Trace("parser") << "define fun: '" << name << "'" << std::endl;
if( sortedVarNames.size() > 0 ) {
DECLARE_VAR_TOK { PARSER_STATE->checkThatLogicIsSet(); }
symbol[name,CHECK_UNDECLARED,SYM_VARIABLE]
{ PARSER_STATE->checkUserSymbol(name); }
- sortSymbol[t,CHECK_DECLARED]
+ sortSymbol[t]
{
cvc5::Term var = SOLVER->declareSygusVar(name, t);
PARSER_STATE->defineVar(name, var);
{ PARSER_STATE->checkThatLogicIsSet(); }
symbol[name,CHECK_UNDECLARED,SYM_VARIABLE]
LPAREN_TOK sortedVarList[sortedVarNames] RPAREN_TOK
- ( sortSymbol[range,CHECK_DECLARED] )?
+ ( sortSymbol[range] )?
{
PARSER_STATE->pushScope();
sygusVars = PARSER_STATE->bindBoundVars(sortedVarNames);
// error to recognize if the user is using the (deprecated) version 1.0
// sygus syntax.
( LPAREN_TOK symbol[name,CHECK_NONE,SYM_VARIABLE]
- sortSymbol[t,CHECK_DECLARED] (
+ sortSymbol[t] (
// SyGuS version 1.0 expects a grammar ((Start Int ( ...
// SyGuS version 2.0 expects a predeclaration ((Start Int) ...
LPAREN_TOK
LPAREN_TOK
(
LPAREN_TOK
- symbol[name, CHECK_DECLARED, SYM_VARIABLE] sortSymbol[t, CHECK_DECLARED]
+ symbol[name, CHECK_DECLARED, SYM_VARIABLE] sortSymbol[t]
{
// check that it matches sortedVarNames
if (sortedVarNames[dtProcessed].first != name)
// add term as constructor to datatype
ret->addRule(ntSyms[dtProcessed], e);
}
- | LPAREN_TOK SYGUS_CONSTANT_TOK sortSymbol[t, CHECK_DECLARED] RPAREN_TOK {
+ | LPAREN_TOK SYGUS_CONSTANT_TOK sortSymbol[t] RPAREN_TOK {
// allow constants in datatype for ntSyms[dtProcessed]
ret->addAnyConstant(ntSyms[dtProcessed]);
}
- | LPAREN_TOK SYGUS_VARIABLE_TOK sortSymbol[t, CHECK_DECLARED] RPAREN_TOK {
+ | LPAREN_TOK SYGUS_VARIABLE_TOK sortSymbol[t] RPAREN_TOK {
// add variable constructors to datatype
ret->addAnyVariable(ntSyms[dtProcessed]);
}
: DECLARE_CONST_TOK { PARSER_STATE->checkThatLogicIsSet(); }
symbol[name,CHECK_NONE,SYM_VARIABLE]
{ PARSER_STATE->checkUserSymbol(name); }
- sortSymbol[t,CHECK_DECLARED]
+ sortSymbol[t]
{ // allow overloading here
if( PARSER_STATE->sygus() )
{
symbol[fname,CHECK_NONE,SYM_VARIABLE]
{ PARSER_STATE->checkUserSymbol(fname); }
LPAREN_TOK sortedVarList[sortedVarNames] RPAREN_TOK
- sortSymbol[t,CHECK_DECLARED]
+ sortSymbol[t]
{
func =
PARSER_STATE->bindDefineFunRec(fname, sortedVarNames, t, flattenVars);
symbol[fname,CHECK_UNDECLARED,SYM_VARIABLE]
{ PARSER_STATE->checkUserSymbol(fname); }
LPAREN_TOK sortedVarList[sortedVarNames] RPAREN_TOK
- sortSymbol[t,CHECK_DECLARED]
+ sortSymbol[t]
{
flattenVars.clear();
func = PARSER_STATE->bindDefineFunRec(
DEFINE_CONST_TOK { PARSER_STATE->checkThatLogicIsSet(); }
symbol[name,CHECK_UNDECLARED,SYM_VARIABLE]
{ PARSER_STATE->checkUserSymbol(name); }
- sortSymbol[t,CHECK_DECLARED]
+ sortSymbol[t]
term[e, e2]
{
// declare the name down here (while parsing term, signature
cmd->reset(new GetInterpolantNextCommand);
}
| DECLARE_HEAP LPAREN_TOK
- sortSymbol[t, CHECK_DECLARED]
- sortSymbol[s, CHECK_DECLARED]
+ sortSymbol[t]
+ sortSymbol[s]
{ cmd->reset(new DeclareHeapCommand(t, s)); }
RPAREN_TOK
| DECLARE_POOL { PARSER_STATE->checkThatLogicIsSet(); }
symbol[name,CHECK_NONE,SYM_VARIABLE]
{ PARSER_STATE->checkUserSymbol(name); }
- sortSymbol[t,CHECK_DECLARED]
+ sortSymbol[t]
LPAREN_TOK
( term[e, e2]
{ terms.push_back( e ); }
}
: identifier[p]
| LPAREN_TOK AS_TOK
- ( CONST_TOK sortSymbol[type, CHECK_DECLARED]
+ ( CONST_TOK sortSymbol[type]
{
p.d_kind = cvc5::CONST_ARRAY;
PARSER_STATE->parseOpApplyTypeAscription(p, type);
}
| identifier[p]
- sortSymbol[type, CHECK_DECLARED]
+ sortSymbol[type]
{
PARSER_STATE->parseOpApplyTypeAscription(p, type);
}
std::string hexStr = AntlrInput::tokenTextSubstr($HEX_LITERAL, 2);
atomTerm = PARSER_STATE->mkCharConstant(hexStr);
}
- | FMF_CARD_TOK sortSymbol[t,CHECK_DECLARED] INTEGER_LITERAL
+ | FMF_CARD_TOK sortSymbol[t] INTEGER_LITERAL
{
uint32_t ubound = AntlrInput::tokenToUnsigned($INTEGER_LITERAL);
atomTerm = SOLVER->mkCardinalityConstraint(t, ubound);
@declarations {
cvc5::Sort t;
}
- : ( sortSymbol[t,CHECK_DECLARED] { sorts.push_back(t); } )*
+ : ( sortSymbol[t] { sorts.push_back(t); } )*
;
nonemptySortList[std::vector<cvc5::Sort>& sorts]
@declarations {
cvc5::Sort t;
}
- : ( sortSymbol[t,CHECK_DECLARED] { sorts.push_back(t); } )+
+ : ( sortSymbol[t] { sorts.push_back(t); } )+
;
/**
cvc5::Sort t;
}
: ( LPAREN_TOK symbol[name,CHECK_NONE,SYM_VARIABLE]
- sortSymbol[t,CHECK_DECLARED] RPAREN_TOK
+ sortSymbol[t] RPAREN_TOK
{ sortedVars.push_back(make_pair(name, t)); }
)*
;
: symbol[name,check,SYM_SORT]
;
-sortSymbol[cvc5::Sort& t, cvc5::parser::DeclarationCheck check]
+sortSymbol[cvc5::Sort& t]
@declarations {
std::string name;
std::vector<cvc5::Sort> args;
}
: sortName[name,CHECK_NONE]
{
- if(check == CHECK_DECLARED || PARSER_STATE->isDeclared(name, SYM_SORT)) {
- t = PARSER_STATE->getSort(name);
- } else {
- t = PARSER_STATE->mkUnresolvedType(name);
- }
+ t = PARSER_STATE->getSort(name);
}
| LPAREN_TOK (INDEX_TOK {indexed = true;} | {indexed = false;})
symbol[name,CHECK_NONE,SYM_SORT]
t = SOLVER->mkSequenceSort( args[0] );
} else if (name == "Tuple" && !PARSER_STATE->strictModeEnabled()) {
t = SOLVER->mkTupleSort(args);
- } else if(check == CHECK_DECLARED ||
- PARSER_STATE->isDeclared(name, SYM_SORT)) {
- t = PARSER_STATE->getSort(name, args);
} else {
- // make unresolved type
- if(args.empty()) {
- t = PARSER_STATE->mkUnresolvedType(name);
- Trace("parser-param") << "param: make unres type " << name
- << std::endl;
- } else {
- t = PARSER_STATE->mkUnresolvedTypeConstructor(name,args);
- t = t.instantiate( args );
- Trace("parser-param")
- << "param: make unres param type " << name << " " << args.size()
- << " " << PARSER_STATE->getArity( name ) << std::endl;
- }
+ t = PARSER_STATE->getSort(name, args);
}
}
) RPAREN_TOK
std::string id;
cvc5::Sort t, t2;
}
- : symbol[id,CHECK_NONE,SYM_SORT] sortSymbol[t,CHECK_NONE]
+ : symbol[id,CHECK_NONE,SYM_SORT] sortSymbol[t]
{
ctor.addSelector(id, t);
Trace("parser-idt") << "selector: " << id.c_str()