/********************* */ /*! \file smt2.h ** \verbatim ** Original author: cconway ** Major contributors: mdeters ** Minor contributors (to current version): none ** This file is part of the CVC4 prototype. ** Copyright (c) 2009-2012 New York University and The University of Iowa ** See the file COPYING in the top-level source directory for licensing ** information.\endverbatim ** ** \brief Definitions of SMT2 constants. ** ** Definitions of SMT2 constants. **/ #include "cvc4parser_private.h" #ifndef __CVC4__PARSER__SMT2_H #define __CVC4__PARSER__SMT2_H #include "parser/parser.h" #include "parser/smt1/smt1.h" #include "util/abstract_value.h" #include namespace CVC4 { class SExpr; namespace parser { class Smt2 : public Parser { friend class ParserBuilder; public: enum Theory { THEORY_ARRAYS, THEORY_BITVECTORS, THEORY_CORE, THEORY_INTS, THEORY_REALS, THEORY_REALS_INTS, THEORY_QUANTIFIERS, }; private: bool d_logicSet; Smt1::Logic d_logic; protected: Smt2(ExprManager* exprManager, Input* input, bool strictMode = false, bool parseOnly = false); public: /** * Add theory symbols to the parser state. * * @param theory the theory to open (e.g., Core, Ints) */ void addTheory(Theory theory); bool logicIsSet(); /** * Sets the logic for the current benchmark. Declares any logic and * theory symbols. * * @param name the name of the logic (e.g., QF_UF, AUFLIA) */ void setLogic(const std::string& name); void setInfo(const std::string& flag, const SExpr& sexpr); void setOption(const std::string& flag, const SExpr& sexpr); void checkThatLogicIsSet(); void checkUserSymbol(const std::string& name) { if(name.length() > 0 && (name[0] == '.' || name[0] == '@')) { std::stringstream ss; ss << "cannot declare or define symbol `" << name << "'; symbols starting with . and @ are reserved in SMT-LIB"; parseError(ss.str()); } } 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)))); } private: void addArithmeticOperators(); void addBitvectorOperators(); };/* class Smt2 */ }/* CVC4::parser namespace */ }/* CVC4 namespace */ #endif /* __CVC4__PARSER__SMT2_H */