Towards parser migration, will make the diff of the eventual conversion a bit smaller.
{ /*symtab = PARSER_STATE->getSymbolTable();
PARSER_STATE->useDeclarationsFrom(new SymbolTable());*/ }
formula[f] ( COMMA formula[f2] )? RPAREN
- { /*SymbolTable* old = PARSER_STATE->getSymbolTable();
- PARSER_STATE->useDeclarationsFrom(symtab);
- delete old;*/
+ {
PARSER_STATE->unimplementedFeature("predicate subtyping not supported in this release");
- /*t = f2.isNull() ?
- EXPR_MANAGER->mkPredicateSubtype(f) :
- EXPR_MANAGER->mkPredicateSubtype(f, f2);
- */
}
/* subrange types */
}
;
-pattern[CVC4::Expr& expr]
-@declarations {
- std::vector<Expr> patexpr;
-}
- : LPAREN_TOK termList[patexpr,expr] RPAREN_TOK
- {
- expr = MK_EXPR(kind::INST_PATTERN, patexpr);
- }
- ;
-
simpleSymbolicExprNoKeyword[CVC4::SExpr& sexpr]
@declarations {
CVC4::Kind k;
}
| str[s,false]
{ sexpr = SExpr(s); }
-// | LPAREN_TOK STRCST_TOK
-// ( INTEGER_LITERAL {
-// s_vec.push_back( atoi( AntlrInput::tokenText($INTEGER_LITERAL) ) + 65 );
-// } )* RPAREN_TOK
-// {
-// sexpr = SExpr( MK_CONST( ::CVC4::String(s_vec) ) );
-// }
| symbol[s,CHECK_NONE,SYM_SORT]
{ sexpr = SExpr(SExpr::Keyword(s)); }
| tok=(ASSERT_TOK | CHECK_SAT_TOK | CHECK_SAT_ASSUMING_TOK | DECLARE_FUN_TOK
* "defined" as an unresolved type; don't worry, we check
* below. */
: symbol[id,CHECK_NONE,SYM_SORT] { PARSER_STATE->pushScope(true); }
- /* ( '[' symbol[id2,CHECK_UNDECLARED,SYM_SORT] {
- t = PARSER_STATE->mkSort(id2);
- params.push_back( t );
- }
- ( symbol[id2,CHECK_UNDECLARED,SYM_SORT] {
- t = PARSER_STATE->mkSort(id2);
- params.push_back( t ); }
- )* ']'
- )?*/ //AJR: this isn't necessary if we use z3's style
{ datatypes.push_back(Datatype(EXPR_MANAGER, id, params, isCo));
if(!PARSER_STATE->isUnresolvedType(id)) {
// if not unresolved, must be undeclared
ATTRIBUTE_NO_PATTERN_TOK : ':no-pattern';
ATTRIBUTE_NAMED_TOK : ':named';
ATTRIBUTE_INST_LEVEL : ':quant-inst-max-level';
-ATTRIBUTE_RR_PRIORITY : ':rr-priority';
// operators (NOTE: theory symbols go here)
EXISTS_TOK : 'exists';
}
}
+bool Smt2::isAbstractValue(const std::string& name)
+{
+ return name.length() >= 2 && name[0] == '@' && name[1] != '0'
+ && name.find_first_not_of("0123456789", 1) == std::string::npos;
+}
+
+Expr Smt2::mkAbstractValue(const std::string& name)
+{
+ assert(isAbstractValue(name));
+ // remove the '@'
+ return getExprManager()->mkConst(AbstractValue(Integer(name.substr(1))));
+}
+
void Smt2::mkSygusConstantsForType( const Type& type, std::vector<CVC4::Expr>& ops ) {
if( type.isInteger() ){
ops.push_back(getExprManager()->mkConst(Rational(0)));
return d_lastNamedTerm;
}
- bool isAbstractValue(const std::string& name) {
- return name.length() >= 2 && name[0] == '@' && name[1] != '0' &&
- name.find_first_not_of("0123456789", 1) == std::string::npos;
- }
-
- Expr mkAbstractValue(const std::string& name) {
- assert(isAbstractValue(name));
- return getExprManager()->mkConst(AbstractValue(Integer(name.substr(1))));
- }
+ /** Does name denote an abstract value? (of the form '@n' for numeral n). */
+ bool isAbstractValue(const std::string& name);
- void mkSygusVar(const std::string& name,
- const Type& type,
- bool isPrimed = false);
+ /** Make abstract value
+ *
+ * Abstract values are used for processing get-value calls. The argument
+ * name should be such that isAbstractValue(name) is true.
+ */
+ Expr mkAbstractValue(const std::string& name);
void mkSygusConstantsForType( const Type& type, std::vector<CVC4::Expr>& ops );