Finally, we no longer need to link against GMP and CLN for the parser and the tests.
To actually achieve this, this PR also removes some dead code and unused includes from some parser files.
target_link_libraries(cvc4parser PUBLIC cvc4)
target_link_libraries(cvc4parser PRIVATE ANTLR3)
-if(USE_CLN)
- target_link_libraries(cvc4parser PRIVATE ${CLN_LIBRARIES})
- target_include_directories(cvc4parser PRIVATE $<BUILD_INTERFACE:${CLN_INCLUDE_DIR}>)
-endif()
-target_link_libraries(cvc4parser PRIVATE GMP)
-
install(TARGETS cvc4parser
EXPORT cvc4-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR})
#include "parser/input.h"
#include "parser/line_buffer.h"
#include "parser/parser_exception.h"
-#include "util/bitvector.h"
-#include "util/integer.h"
-#include "util/rational.h"
namespace cvc5 {
namespace parser {
/** Retrieve an unsigned from the text of a token */
static unsigned tokenToUnsigned( pANTLR3_COMMON_TOKEN token );
- /** Retrieve an Integer from the text of a token */
- static Rational tokenToInteger( pANTLR3_COMMON_TOKEN token );
-
- /** Retrieve a Rational from the text of a token */
- static Rational tokenToRational(pANTLR3_COMMON_TOKEN token);
-
- /** Get a bitvector constant from the text of the number and the size token */
- static BitVector tokenToBitvector(pANTLR3_COMMON_TOKEN number, pANTLR3_COMMON_TOKEN size);
-
/** Get the ANTLR3 lexer for this input. */
pANTLR3_LEXER getAntlr3Lexer() { return d_lexer; }
return result;
}
-inline Rational AntlrInput::tokenToInteger(pANTLR3_COMMON_TOKEN token) {
- return Rational( tokenText(token) );
-}
-
-inline Rational AntlrInput::tokenToRational(pANTLR3_COMMON_TOKEN token) {
- return Rational::fromDecimal( tokenText(token) );
-}
-
-inline BitVector AntlrInput::tokenToBitvector(pANTLR3_COMMON_TOKEN number, pANTLR3_COMMON_TOKEN size) {
- std::string number_str = tokenTextSubstr(number, 2);
- unsigned sz = tokenToUnsigned(size);
- Integer val(number_str);
- if(val.modByPow2(sz) != val) {
- std::stringstream ss;
- ss << "Overflow in bitvector construction (specified bitvector size " << sz << " too small to hold value " << tokenText(number) << ")";
- throw std::invalid_argument(ss.str());
- }
- return BitVector(sz, val);
-}
-
} // namespace parser
} // namespace cvc5
#include "parser/antlr_tracing.h"
#include "parser/parser.h"
#include "smt/command.h"
-#include "util/rational.h"
namespace cvc5 {
class Expr;
PARSER_STATE->unimplementedFeature("predicate subtyping not supported in this release");
}
- /* subrange types */
- | LBRACKET bound DOTDOT bound RBRACKET
- {
- PARSER_STATE->unimplementedFeature("subrange typing not supported in this release");
- }
-
/* tuple types / old-style function types */
| LBRACKET ( type[t,check] { types.push_back(t); }
( COMMA type[t,check] { types.push_back(t); } )* )? RBRACKET
( COMMA restrictedType[t,check] { Debug("parser-param") << "t = " << t << std::endl; params.push_back( t ); } )* RBRACKET
;
-bound
- : UNDERSCORE
- | integer
-;
-
typeLetDecl[cvc5::parser::DeclarationCheck check]
@init {
api::Sort t;
* This is a rational constant! Otherwise the parser interprets it as a tuple
* selector! */
| DECIMAL_LITERAL {
- Rational r = AntlrInput::tokenToRational($DECIMAL_LITERAL);
- std::stringstream strRat;
- strRat << r;
- f = SOLVER->mkReal(strRat.str());
+ f = SOLVER->mkReal(AntlrInput::tokenText($DECIMAL_LITERAL));
}
| INTEGER_LITERAL {
- Rational r = AntlrInput::tokenToRational($INTEGER_LITERAL);
- std::stringstream strRat;
- strRat << r;
- f = SOLVER->mkInteger(strRat.str());
+ f = SOLVER->mkInteger(AntlrInput::tokenText($INTEGER_LITERAL));
}
/* bitvector literals */
| HEX_LITERAL
{ $k = AntlrInput::tokenToUnsigned($INTEGER_LITERAL); }
;
-/**
- * Similar to numeral but for arbitrary-precision, signed integer.
- */
-integer returns [cvc5::Rational k = 0]
- : INTEGER_LITERAL
- { $k = AntlrInput::tokenToInteger($INTEGER_LITERAL); }
- | MINUS_TOK INTEGER_LITERAL
- { $k = -AntlrInput::tokenToInteger($INTEGER_LITERAL); }
- ;
-
/**
* Similar to numeral but for strings.
*/
#include "parser/antlr_input.h"
#include "parser/parser.h"
#include "parser/smt2/smt2.h"
-#include "util/floatingpoint.h"
+#include "util/floatingpoint_size.h"
#include "util/hash.h"
-#include "util/integer.h"
-#include "util/rational.h"
using namespace cvc5;
using namespace cvc5::parser;
#include "parser/antlr_input.h"
#include "parser/parser.h"
#include "parser/smt2/smt2_input.h"
-#include "util/bitvector.h"
// ANTLR defines these, which is really bad!
#undef true
#include "parser/parse_op.h"
#include "parser/parser.h"
#include "theory/logic_info.h"
-#include "util/abstract_value.h"
namespace cvc5 {
#include "parser/antlr_input.h"
#include "parser/parser.h"
#include "parser/tptp/tptp.h"
-#include "util/integer.h"
-#include "util/rational.h"
using namespace cvc5;
using namespace cvc5::parser;
add_executable(${name} ${name}.cpp)
target_link_libraries(${name} PUBLIC main-test)
target_compile_definitions(${name} PRIVATE ${CVC5_API_TEST_FLAGS})
- if(USE_CLN)
- target_link_libraries(${name} PRIVATE CLN)
- endif()
- target_link_libraries(${name} PRIVATE GMP)
set_target_properties(${name}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${test_bin_dir})
add_test(api/${name} ${test_bin_dir}/${name})