From b75ee007583081f5bae096e49d67fdad195a010a Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Tue, 25 Oct 2022 15:04:39 +0200 Subject: [PATCH 01/94] Logic: Evaluate "distinct" on constant arguments This is required for a our Model to function properly. Previously, it would just create a term "(distinct 0 1 2)", instead of directly simplifying that to "true". --- src/logics/Logic.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/logics/Logic.cc b/src/logics/Logic.cc index 4e9efbae..e4e04360 100644 --- a/src/logics/Logic.cc +++ b/src/logics/Logic.cc @@ -624,6 +624,13 @@ PTRef Logic::mkDistinct(vec&& args) { } } + // Here we know that no two terms are the same + if (std::all_of(args.begin(), args.end(), [this](PTRef arg) { + return this->isConstant(arg); + })) { + return getTerm_true(); + } + SymRef diseq_sym = term_store.lookupSymbol(tk_distinct, args); assert(!isBooleanOperator(diseq_sym)); PTLKey key; From dc472da7bf62e8d4adad62dece7210fc6ecf6abc Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Tue, 25 Oct 2022 15:17:14 +0200 Subject: [PATCH 02/94] Tests: Add tests for evaluating on constants --- regression/QF_UF/distinct_model_1.smt2 | 10 ++++++++++ .../QF_UF/distinct_model_1.smt2.expected.err | 0 .../QF_UF/distinct_model_1.smt2.expected.out | 2 ++ regression/QF_UF/distinct_model_2.smt2 | 8 ++++++++ .../QF_UF/distinct_model_2.smt2.expected.err | 0 .../QF_UF/distinct_model_2.smt2.expected.out | 1 + test/unit/test_Model.cc | 19 +++++++++++-------- 7 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 regression/QF_UF/distinct_model_1.smt2 create mode 100644 regression/QF_UF/distinct_model_1.smt2.expected.err create mode 100644 regression/QF_UF/distinct_model_1.smt2.expected.out create mode 100644 regression/QF_UF/distinct_model_2.smt2 create mode 100644 regression/QF_UF/distinct_model_2.smt2.expected.err create mode 100644 regression/QF_UF/distinct_model_2.smt2.expected.out diff --git a/regression/QF_UF/distinct_model_1.smt2 b/regression/QF_UF/distinct_model_1.smt2 new file mode 100644 index 00000000..baa46096 --- /dev/null +++ b/regression/QF_UF/distinct_model_1.smt2 @@ -0,0 +1,10 @@ +(set-logic QF_UF) +(declare-sort U 0) +(declare-fun c1 () U) +(declare-fun c2 () U) +(declare-fun c3 () U) +(assert (not (= c1 c2))) +(assert (not (= c1 c3))) +(assert (not (= c2 c3))) +(check-sat) +(get-value ((distinct c1 c2 c3))) diff --git a/regression/QF_UF/distinct_model_1.smt2.expected.err b/regression/QF_UF/distinct_model_1.smt2.expected.err new file mode 100644 index 00000000..e69de29b diff --git a/regression/QF_UF/distinct_model_1.smt2.expected.out b/regression/QF_UF/distinct_model_1.smt2.expected.out new file mode 100644 index 00000000..886ce306 --- /dev/null +++ b/regression/QF_UF/distinct_model_1.smt2.expected.out @@ -0,0 +1,2 @@ +sat +(((distinct c1 c2 c3) true)) diff --git a/regression/QF_UF/distinct_model_2.smt2 b/regression/QF_UF/distinct_model_2.smt2 new file mode 100644 index 00000000..176c5d0d --- /dev/null +++ b/regression/QF_UF/distinct_model_2.smt2 @@ -0,0 +1,8 @@ +(set-logic QF_UF) +(declare-sort U 0) +(declare-fun c1 () U) +(declare-fun c2 () U) +(declare-fun c3 () U) +(assert (distinct c1 c2 c3)) +(assert (= c2 c3)) +(check-sat) diff --git a/regression/QF_UF/distinct_model_2.smt2.expected.err b/regression/QF_UF/distinct_model_2.smt2.expected.err new file mode 100644 index 00000000..e69de29b diff --git a/regression/QF_UF/distinct_model_2.smt2.expected.out b/regression/QF_UF/distinct_model_2.smt2.expected.out new file mode 100644 index 00000000..3f65111b --- /dev/null +++ b/regression/QF_UF/distinct_model_2.smt2.expected.out @@ -0,0 +1 @@ +unsat diff --git a/test/unit/test_Model.cc b/test/unit/test_Model.cc index b8a17ab9..73bce03c 100644 --- a/test/unit/test_Model.cc +++ b/test/unit/test_Model.cc @@ -204,6 +204,8 @@ class LAModelTest : public ::testing::Test { z = logic.mkRealVar("z"); a = logic.mkBoolVar("a"); b = logic.mkBoolVar("b"); + tval = logic.getTerm_true(); + fval = logic.getTerm_false(); } SMTConfig config; ArithLogic logic; @@ -212,6 +214,8 @@ class LAModelTest : public ::testing::Test { PTRef z; PTRef a; PTRef b; + PTRef tval; + PTRef fval; std::unique_ptr getModel() { Model::Evaluation eval { @@ -223,7 +227,6 @@ class LAModelTest : public ::testing::Test { }; return std::unique_ptr(new Model(logic, eval)); } - }; @@ -239,8 +242,6 @@ TEST_F(LAModelTest, test_inputVarValues) { TEST_F(LAModelTest, test_constants) { auto model = getModel(); - PTRef tval = logic.getTerm_true(); - PTRef fval = logic.getTerm_false(); EXPECT_EQ(model->evaluate(fval), fval); EXPECT_EQ(model->evaluate(tval), tval); @@ -254,9 +255,6 @@ TEST_F(LAModelTest, test_constants) { TEST_F(LAModelTest, test_derivedBooleanTerms) { auto model = getModel(); - PTRef tval = logic.getTerm_true(); - PTRef fval = logic.getTerm_false(); - PTRef and_false = logic.mkAnd(a,b); PTRef or_true = logic.mkOr(a,b); PTRef not_true = logic.mkNot(b); @@ -279,8 +277,6 @@ TEST_F(LAModelTest, test_derivedArithmeticTerms) { TEST_F(LAModelTest, test_derivedArithmeticAtoms) { auto model = getModel(); - PTRef tval = logic.getTerm_true(); - PTRef fval = logic.getTerm_false(); EXPECT_EQ(model->evaluate(logic.mkLeq(x, y)), fval); EXPECT_EQ(model->evaluate(logic.mkLt(x, y)), fval); @@ -296,6 +292,13 @@ TEST_F(LAModelTest, test_derivedArithmeticAtoms) { EXPECT_EQ(model->evaluate(logic.mkLt(x, z)), fval); EXPECT_EQ(model->evaluate(logic.mkGeq(x, z)), tval); EXPECT_EQ(model->evaluate(logic.mkGt(x, z)), fval); +} + +TEST_F(LAModelTest, test_distinctOperator) { + auto model = getModel(); + + PTRef distinct = logic.mkDistinct({logic.getTerm_RealZero(), logic.getTerm_RealMinusOne(), x}); + EXPECT_EQ(model->evaluate(distinct), tval); } From 6c8b1701c35813de3ec106f6c49dccc0f8ac9e38 Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Mon, 31 Oct 2022 19:22:54 +0100 Subject: [PATCH 03/94] Changelog: Add entry for changes in distinct --- Changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.md b/Changelog.md index d5218e06..a9c096c3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,7 @@ ### 2.4.3 (unreleased) +Bug fixes: + - Logic: Evaluate `distinct` function on constant arguments (required for model evaluation) ### 2.4.2 (2022-10-24) From bfe41d441cbf30591c1b4f2efa11ad16c71290f2 Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Fri, 4 Nov 2022 10:54:04 +0100 Subject: [PATCH 04/94] LASolver: Set `has_explanation` flag properly It seems that LASolver was always setting `has_explanation` flag to true, but never to false. This, in combination with inverted solver schedule in UFLA, led to a subtle bug where UF would detect conflict, but LA solver would also signal that it has a conflict (even though this would not be true) and then return an empty explanation. This resulted in incorrect UNSAT answers. --- src/tsolvers/lasolver/LASolver.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tsolvers/lasolver/LASolver.cc b/src/tsolvers/lasolver/LASolver.cc index 503c19c6..185a70ce 100644 --- a/src/tsolvers/lasolver/LASolver.cc +++ b/src/tsolvers/lasolver/LASolver.cc @@ -620,8 +620,7 @@ inline bool LASolver::getStatus( ) bool LASolver::setStatus( LASolverStatus s ) { status = s; - if (s == UNSAT) - has_explanation = true; + has_explanation = (s == UNSAT); return getStatus( ); } From 3eb606f93862fab92e0f6a5eb1944782efaf514b Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Fri, 4 Nov 2022 10:46:57 +0100 Subject: [PATCH 05/94] Tests: Add regression test for UFLRA bug --- regression/QF_UFLRA/regression_12.smt2 | 6 ++++++ regression/QF_UFLRA/regression_12.smt2.expected.err | 0 regression/QF_UFLRA/regression_12.smt2.expected.out | 1 + 3 files changed, 7 insertions(+) create mode 100644 regression/QF_UFLRA/regression_12.smt2 create mode 100644 regression/QF_UFLRA/regression_12.smt2.expected.err create mode 100644 regression/QF_UFLRA/regression_12.smt2.expected.out diff --git a/regression/QF_UFLRA/regression_12.smt2 b/regression/QF_UFLRA/regression_12.smt2 new file mode 100644 index 00000000..75996fd1 --- /dev/null +++ b/regression/QF_UFLRA/regression_12.smt2 @@ -0,0 +1,6 @@ +(set-logic QF_UFLRA) +(set-info :status sat) +(declare-fun f (Real) Real) +(declare-fun x () Real) +(assert (and (>= (f 1.0) 0) (< (- x) 0) (= (f x) (- 1)))) +(check-sat) diff --git a/regression/QF_UFLRA/regression_12.smt2.expected.err b/regression/QF_UFLRA/regression_12.smt2.expected.err new file mode 100644 index 00000000..e69de29b diff --git a/regression/QF_UFLRA/regression_12.smt2.expected.out b/regression/QF_UFLRA/regression_12.smt2.expected.out new file mode 100644 index 00000000..6b8a2c3d --- /dev/null +++ b/regression/QF_UFLRA/regression_12.smt2.expected.out @@ -0,0 +1 @@ +sat From 8c58827a9a33469e586158be66df860aa5a2ad35 Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Fri, 4 Nov 2022 10:45:17 +0100 Subject: [PATCH 06/94] TSolvers: Fix solver schedule for UFLA Before the change regarding the T-solvers schedule, in UFLA, UF solver was always checked before the LA solver. However, it seems that the solver schedule in UFLATHandler had LA solver scheduled before UF solver. This commit schedules UF solver first. I believe that in general UF solver should always be scheduled first. However, for model building, values for LA variables must be known before UF can compute values for other terms, so here the model building in LA must happen before model building in UF. --- src/tsolvers/TSolverHandler.h | 3 +-- src/tsolvers/UFLATHandler.cc | 8 +++++++- src/tsolvers/UFLATHandler.h | 2 ++ src/tsolvers/lasolver/LASolver.h | 3 +-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/tsolvers/TSolverHandler.h b/src/tsolvers/TSolverHandler.h index 4560a845..d039bd93 100644 --- a/src/tsolvers/TSolverHandler.h +++ b/src/tsolvers/TSolverHandler.h @@ -56,15 +56,14 @@ class TSolverHandler virtual const Logic& getLogic() const = 0; virtual PTRef getInterpolant(const ipartitions_t& mask, std::map*, PartitionManager& pmanager) = 0; - void fillTheoryFunctions(ModelBuilder& modelBuilder) const; void computeModel (); // Computes a model in the solver if necessary bool assertLit (PtAsgn); // Push the assignment to all theory solvers void informNewSplit(PTRef); // Recompute split datastructures virtual void declareAtom(PTRef tr); // Declare atom to the appropriate solver -// virtual SolverId getId() const { return my_id; } virtual lbool getPolaritySuggestion(PTRef) const { return l_Undef; } virtual TRes check(bool); virtual vec getSplitClauses(); + virtual void fillTheoryFunctions(ModelBuilder & modelBuilder) const; private: // Helper method for computing reasons TSolver* getReasoningSolverFor(PTRef ptref) const; diff --git a/src/tsolvers/UFLATHandler.cc b/src/tsolvers/UFLATHandler.cc index db602dc5..f2d48d5d 100644 --- a/src/tsolvers/UFLATHandler.cc +++ b/src/tsolvers/UFLATHandler.cc @@ -9,7 +9,7 @@ UFLATHandler::UFLATHandler(SMTConfig & c, ArithLogic & l) { lasolver = new LASolver(config, logic); ufsolver = new Egraph(config, logic); - setSolverSchedule({lasolver, ufsolver}); + setSolverSchedule({ufsolver,lasolver}); } PTRef UFLATHandler::getInterpolant(const ipartitions_t&, std::map *, PartitionManager &) @@ -77,3 +77,9 @@ vec UFLATHandler::getSplitClauses() { return res; } +void UFLATHandler::fillTheoryFunctions(ModelBuilder & modelBuilder) const { + // MB: To properly build model in UF solver, we already need values for the LA variables from LA solver. + lasolver->fillTheoryFunctions(modelBuilder); + ufsolver->fillTheoryFunctions(modelBuilder); +} + diff --git a/src/tsolvers/UFLATHandler.h b/src/tsolvers/UFLATHandler.h index e348e69e..c436d004 100644 --- a/src/tsolvers/UFLATHandler.h +++ b/src/tsolvers/UFLATHandler.h @@ -60,6 +60,8 @@ class UFLATHandler : public TSolverHandler void setInterfaceVars(vec && vars) { vars.moveTo(interfaceVars); } vec getSplitClauses() override; + + void fillTheoryFunctions(ModelBuilder & modelBuilder) const override; }; #endif diff --git a/src/tsolvers/lasolver/LASolver.h b/src/tsolvers/lasolver/LASolver.h index 43b9060a..faf5ce55 100644 --- a/src/tsolvers/lasolver/LASolver.h +++ b/src/tsolvers/lasolver/LASolver.h @@ -111,6 +111,7 @@ class LASolver: public TSolver void popBacktrackPoint ( ) override; // Backtrack to last saved point void popBacktrackPoints ( unsigned int ) override; // Backtrack given number of saved points lbool getPolaritySuggestion(PTRef) const; + void fillTheoryFunctions(ModelBuilder & modelBuilder) const override; vec collectEqualitiesFor(vec const & vars, std::unordered_set const & knownEqualities) override; PTRef getRealInterpolant(const ipartitions_t &, std::map*, PartitionManager & pmanager); @@ -175,8 +176,6 @@ class LASolver: public TSolver LASolverStatus status; // Internal status of the solver (different from bool) - void fillTheoryFunctions(ModelBuilder & modelBuilder) const override; - PTRef interpolateUsingEngine(FarkasInterpolator &) const; inline int verbose ( ) const { return config.verbosity(); } From 26fc2cd7bd07dbee7b7e20f340e33285d34679f0 Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Sat, 5 Nov 2022 10:11:12 +0100 Subject: [PATCH 07/94] ArithLogic: Fix substitutions in presence of UF Previously, in `collectSingleEqualitySubstitutions`, the variables were processed in order as stored in `unordered_map`. Additionally, UF terms are treated as variables in ArithLogic. This meant that from an equality f(x) = x (with x being Real), the code could derive a substitution "x -> f(x)". However, such substitution results in an infinite cycle in the function that computes transitive closure of substitutions. We fix this by forcing an order in which variables are checked, starting from variables with higher PTRef, which mean they they were created later. This ensures for the above case, that f(x) will be considered before x, so the computed substitution will be "f(x) -> x". --- src/logics/ArithLogic.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/logics/ArithLogic.cc b/src/logics/ArithLogic.cc index 3c3aff6c..0fd73ea4 100644 --- a/src/logics/ArithLogic.cc +++ b/src/logics/ArithLogic.cc @@ -10,6 +10,7 @@ #include "StringConv.h" #include "TreeOps.h" +#include #include #include @@ -341,9 +342,15 @@ PTRef polyToPTRef(ArithLogic & logic, poly_t const & poly) { } Logic::SubstMap collectSingleEqualitySubstitutions(ArithLogic & logic, std::vector & zeroPolynomials) { - Logic::SubstMap substitutions; - std::unordered_map, PTRefHash> varToPolyIndices; + // MB: We enforce order to ensure that later-created terms are processed first. + // This ensures that from an equality "f(x) = x" we get a substitution "f(x) -> x" and not the other way + // around, which would cause infinite cycle in transitive closure + struct PTRefGreaterThan { + bool operator()(PTRef first, PTRef second) const { return first.x > second.x; } + }; + std::map, PTRefGreaterThan> varToPolyIndices; + Logic::SubstMap substitutions; for (std::size_t i = 0; i < zeroPolynomials.size(); ++i) { auto const & poly = zeroPolynomials[i]; for (auto const & term : poly) { From 1fb821e9c68116b2c8504c6141ab8664715f1891 Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Sun, 6 Nov 2022 10:52:24 +0100 Subject: [PATCH 08/94] Tests: Rename test file --- test/unit/CMakeLists.txt | 2 +- ...test_LIASubstitutionsRegression.cc => test_Substitutions.cc} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename test/unit/{test_LIASubstitutionsRegression.cc => test_Substitutions.cc} (100%) diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 610f6a07..9d54259b 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -87,7 +87,7 @@ gtest_add_tests(TARGET STPSolverTest) add_executable(SubstitutionsTest) target_sources(SubstitutionsTest PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/test_SubstitutionBreaker.cpp" - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/test_LIASubstitutionsRegression.cc" + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/test_Substitutions.cc" ) target_link_libraries(SubstitutionsTest OpenSMT gtest gtest_main) diff --git a/test/unit/test_LIASubstitutionsRegression.cc b/test/unit/test_Substitutions.cc similarity index 100% rename from test/unit/test_LIASubstitutionsRegression.cc rename to test/unit/test_Substitutions.cc From 0c2664272341ac306b882884561ed0c5c38a7735 Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Sun, 6 Nov 2022 10:52:53 +0100 Subject: [PATCH 09/94] Tests: Add unit test for not computing bad substitutions --- test/unit/test_Substitutions.cc | 52 +++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/test/unit/test_Substitutions.cc b/test/unit/test_Substitutions.cc index 3cf45c78..5bff5e95 100644 --- a/test/unit/test_Substitutions.cc +++ b/test/unit/test_Substitutions.cc @@ -1,6 +1,9 @@ -// -// Created by Martin Blicha on 17.06.20. -// +/* + * Copyright (c) 2020-2022, Martin Blicha + * + * SPDX-License-Identifier: MIT + * + */ #include #include @@ -12,6 +15,30 @@ class LIASubstitutionsRegression: public ::testing::Test { } }; +class UFLRASubstitutionsRegression: public ::testing::Test { +protected: + ArithLogic logic; + SymRef f; + PTRef a,b,c,x,y,z; + PTRef fa,fb,fc,fx,fy,fz; +public: + UFLRASubstitutionsRegression() : logic(opensmt::Logic_t::QF_UFLRA) { + f = logic.declareFun("f", logic.getSort_real(), {logic.getSort_real()}); + x = logic.mkRealVar("x"); + y = logic.mkRealVar("y"); + z = logic.mkRealVar("z"); + a = logic.mkRealVar("a"); + b = logic.mkRealVar("b"); + c = logic.mkRealVar("c"); + fx = logic.mkUninterpFun(f,{x}); + fy = logic.mkUninterpFun(f,{y}); + fz = logic.mkUninterpFun(f,{z}); + fa = logic.mkUninterpFun(f,{a}); + fb = logic.mkUninterpFun(f,{b}); + fc = logic.mkUninterpFun(f,{c}); + } +}; + TEST_F(LIASubstitutionsRegression, test_LIAsubstitution) { auto const osmt = getLIAOsmt(); auto & mainSolver = osmt->getMainSolver(); @@ -93,3 +120,22 @@ TEST_F(LIASubstitutionsRegression, test_TwoVarsEqual) { PTRef value = substMap[key]; ASSERT_TRUE((key == x and value == y) or (key == y and value == x)); } + +TEST_F(UFLRASubstitutionsRegression, test_NoProblematicSubstitutions) { + vec equalities; + equalities.push(logic.mkEq(x,fx)); + equalities.push(logic.mkEq(y,fy)); + equalities.push(logic.mkEq(z,fz)); + equalities.push(logic.mkEq(a,fa)); + equalities.push(logic.mkEq(b,fb)); + equalities.push(logic.mkEq(c,fc)); + Logic::SubstMap map; + logic.arithmeticElimination(equalities, map); + // Substitutions of the form 'var -> term' where term contains the variable are forbidden! + EXPECT_FALSE(map.has(x)); + EXPECT_FALSE(map.has(y)); + EXPECT_FALSE(map.has(z)); + EXPECT_FALSE(map.has(a)); + EXPECT_FALSE(map.has(b)); + EXPECT_FALSE(map.has(c)); +} From 29ad21fe783b6d17c2a4161d729ecad4bd23a72f Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Sun, 6 Nov 2022 10:56:47 +0100 Subject: [PATCH 10/94] Add changelog entry --- Changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.md b/Changelog.md index a9c096c3..ec3924da 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,8 @@ ### 2.4.3 (unreleased) Bug fixes: + - UFLA: Fix unsoundness bug due to LASolver not signalling the presence of conflict correctly + - ArithLogic: Fix substitution computation in the presence of uninterpreted functions - Logic: Evaluate `distinct` function on constant arguments (required for model evaluation) ### 2.4.2 (2022-10-24) From d07c43b11e009cc1bab40293d61a3b92b3331040 Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Sat, 5 Nov 2022 16:28:49 +0100 Subject: [PATCH 11/94] CMake: Update gtest and googlebenchmark version --- benchmark/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 4ae50371..4a93d6f1 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( googlebenchmark GIT_REPOSITORY https://github.com/google/benchmark.git - GIT_TAG v1.6.1 + GIT_TAG v1.7.0 ) FetchContent_GetProperties(googlebenchmark) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 897f9c2d..556dfb8f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.11.0 + GIT_TAG release-1.12.1 ) FetchContent_GetProperties(googletest) From 0483e696396ce1d66240c58ea7c2677981cac77d Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Mon, 21 Nov 2022 19:56:30 +0100 Subject: [PATCH 12/94] Post-release version bump --- CMakeLists.txt | 4 ++-- Changelog.md | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87b055b5..7079bdaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_policy(SET CMP0074 NEW) endif() set(OPENSMT_VERSION_MAJOR 2) -set(OPENSMT_VERSION_MINOR 4) -set(OPENSMT_VERSION_PATCH 3) +set(OPENSMT_VERSION_MINOR 5) +set(OPENSMT_VERSION_PATCH 0) set(OPENSMT_VERSION ${OPENSMT_VERSION_MAJOR}.${OPENSMT_VERSION_MINOR}.${OPENSMT_VERSION_PATCH}) project(opensmt VERSION ${OPENSMT_VERSION} LANGUAGES CXX) diff --git a/Changelog.md b/Changelog.md index ec3924da..f2e48c5c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,8 @@ -### 2.4.3 (unreleased) +### 2.5.0 (unreleased) + + + +### 2.4.3 (2022-11-21) Bug fixes: - UFLA: Fix unsoundness bug due to LASolver not signalling the presence of conflict correctly From ee0e9e07ee5c1b8989bf170c13daae409d374af7 Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Thu, 24 Nov 2022 08:39:39 +0100 Subject: [PATCH 13/94] ArithLogic: Simplify mkMinus ArithLogic::mkNeg is a simpler operation now than ArithLogic::mkTimes. In fact the latter uses the former as a subprocedure. Thus, to negate the second argument of `minus`, it is better to directly call mkNeg. Additional benefit is that this avoids allocation of a temporary vector. --- src/logics/ArithLogic.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/logics/ArithLogic.cc b/src/logics/ArithLogic.cc index 0fd73ea4..bad9efc5 100644 --- a/src/logics/ArithLogic.cc +++ b/src/logics/ArithLogic.cc @@ -545,7 +545,6 @@ PTRef ArithLogic::mkConst(SRef sort, opensmt::Number const & c) PTRef ArithLogic::mkMinus(vec && args) { - SRef sort = checkArithSortCompatible(args); assert(args.size() > 0); if (args.size() == 1) { return mkNeg(args[0]); @@ -553,9 +552,7 @@ PTRef ArithLogic::mkMinus(vec && args) assert(args.size() == 2); if (args.size() > 2) { throw OsmtApiException("Too many terms provided to LALogic::mkNumMinus"); } - PTRef mo = getMinusOneForSort(sort); - - PTRef fact = mkTimes(mo, args[1]); + PTRef fact = mkNeg(args[1]); assert(fact != PTRef_Undef); args[1] = fact; return mkPlus(std::move(args)); From b92769119b9c1495b4ff39001a25c8e6023b876a Mon Sep 17 00:00:00 2001 From: Martin Blicha Date: Sun, 20 Nov 2022 22:25:56 +0100 Subject: [PATCH 14/94] ArithLogic: Simplify method SimplifyConst::simplifyConstOp The first branch before the change did not make sense, because it was trying to get sort from the first term in an empty list. Since this method is internal to ArithLogic.cc, we have control about how it is called. It is better to just assert that the input will never be an empty list. --- src/logics/ArithLogic.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/logics/ArithLogic.cc b/src/logics/ArithLogic.cc index bad9efc5..69540c4d 100644 --- a/src/logics/ArithLogic.cc +++ b/src/logics/ArithLogic.cc @@ -1083,21 +1083,16 @@ void SimplifyConstDiv::constSimplify(SymRef s, vec const & terms, SymRef s_new = s; } -// Return a term corresponding to the operation applied to the constant -// terms. The list may contain terms of the form (* -1 a) for constant -// a. -PTRef SimplifyConst::simplifyConstOp(const vec & terms) -{ - if (terms.size() == 0) { - opensmt::Number s = getIdOp(); - return l.mkConst(l.getSortRef(terms[0]), s); - } else if (terms.size() == 1) { +// Returns a term corresponding to the operation applied to the constant terms. +PTRef SimplifyConst::simplifyConstOp(vec const & terms) { + assert(terms.size() != 0); + if (terms.size() == 1) { return terms[0]; } else { opensmt::Number s = l.getNumConst(terms[0]); - for (int i = 1; i < terms.size(); i++) { + for (int i = 1; i < terms.size(); ++i) { assert(l.isConstant((terms[i]))); - opensmt::Number const& val = l.getNumConst(terms[i]); + opensmt::Number const & val = l.getNumConst(terms[i]); Op(s, val); } return l.mkConst(l.getSortRef(terms[0]), s); From a838804c4efe8d48963bea9df59dc08e76f3d7ee Mon Sep 17 00:00:00 2001 From: Antti Hyvarinen Date: Fri, 25 Nov 2022 07:28:46 +0100 Subject: [PATCH 15/94] interpret: Improve let term parsing Current master checks for redundant "parallel" let bindings of the form `(let ((l a) (l b)) f)` and gives an error if one is present. The smt-lib standard does not forbid these constructs and other solvers seem to parse them without errors. Hence one can argue that the checking in opensmt unnecessarily introduces complication in the code and in principle also a performance overhead (I haven't measured this) This commit introduces a semantic in which the last binding prevails (in the example above `(l b)`). --- src/api/Interpret.cc | 40 ++++++++++++++-------------------------- src/api/Interpret.h | 36 +++++++++++++++++++----------------- 2 files changed, 33 insertions(+), 43 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index aea515bd..be3dc1b4 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -374,24 +374,13 @@ void Interpret::interp(ASTNode& n) { } } - -bool Interpret::addLetFrame(const vec & names, vec const& args, LetRecords& letRecords) { - assert(names.size() == args.size()); - if (names.size() > 1) { - // check that they are pairwise distinct; - std::unordered_set> namesAsSet(names.begin(), names.end()); - if (namesAsSet.size() != names.size_()) { - comment_formatted("Overloading let variables makes no sense"); - return false; - } - } - for (int i = 0; i < names.size(); ++i) { - const char* name = names[i]; - if (logic->hasSym(name) && logic->getSym(logic->symNameToRef(name)[0]).noScoping()) { - comment_formatted("Names marked as no scoping cannot be overloaded with let variables: %s", name); +bool Interpret::addLetFrame(std::vector> const & bindings, LetRecords& letRecords) { + for (auto const & [arg, name] : bindings) { + if (logic->hasSym(name.c_str()) and logic->getSym(logic->symNameToRef(name.c_str())[0]).noScoping()) { + notify_formatted(true, "Names marked as no scoping cannot be overloaded with let variables: %s", name.c_str()); return false; } - letRecords.addBinding(name, args[i]); + letRecords.addBinding(name, arg); } return true; } @@ -493,27 +482,26 @@ PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { else if (t == LET_T) { auto ch = term.children->begin(); auto vbl = (**ch).children->begin(); - vec tmp_args; - vec names; + // use RAII idiom to guard the scope of new LetFrame (and ensure the cleaup of names) class Guard { LetRecords& rec; - vec& names; public: - Guard(LetRecords& rec, vec& names): rec(rec), names(names) { rec.pushFrame(); } - ~Guard() { rec.popFrame(); for (int i = 0; i < names.size(); i++) { free(names[i]); }} - } scopeGuard(letRecords, names); + Guard(LetRecords& rec): rec(rec) { rec.pushFrame(); } + ~Guard() { rec.popFrame(); } + } scopeGuard(letRecords); + + std::vector> bindings; + // First read the term declarations in the let statement while (vbl != (**ch).children->end()) { PTRef let_tr = parseTerm(**((**vbl).children->begin()), letRecords); if (let_tr == PTRef_Undef) return PTRef_Undef; - tmp_args.push(let_tr); - char* name = strdup((**vbl).getValue()); - names.push(name); + bindings.push_back({let_tr, (**vbl).getValue()}); vbl++; } // Only then insert them to the table - bool success = addLetFrame(names, tmp_args, letRecords); + bool success = addLetFrame(bindings, letRecords); if (not success) { comment_formatted("Let name addition failed"); return PTRef_Undef; diff --git a/src/api/Interpret.h b/src/api/Interpret.h index 05d3b2ad..a7169327 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -35,6 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "ScopedVector.h" #include +#include class DefinedFunctions { std::unordered_map defined_functions; @@ -65,32 +66,28 @@ class DefinedFunctions { class LetBinder { PTRef currentValue; - std::vector* shadowedValues; + vec shadowedValues; public: - LetBinder(PTRef val) : currentValue(val), shadowedValues(nullptr) {} - ~LetBinder() { delete shadowedValues; } + LetBinder(PTRef val) : currentValue(val) {} LetBinder(const LetBinder&) = delete; LetBinder& operator=(const LetBinder&) = delete; LetBinder(LetBinder&&) = default; LetBinder& operator=(LetBinder&&) = default; PTRef getValue() const { return currentValue; } - bool hasShadowValue() const { return shadowedValues && !shadowedValues->empty(); } - void restoreShadowedValue() { assert(hasShadowValue()); currentValue = shadowedValues->back(); shadowedValues->pop_back(); } + bool hasShadowValue() const { return shadowedValues.size() != 0; } + void restoreShadowedValue() { currentValue = shadowedValues.last(); shadowedValues.pop(); } void addValue(PTRef val) { - if (not shadowedValues) { - shadowedValues = new std::vector(); - } - shadowedValues->push_back(currentValue); + shadowedValues.push(currentValue); currentValue = val; } }; class LetRecords { - std::unordered_map > letBinders; - std::vector knownBinders; + std::unordered_map letBinders; + std::vector knownBinders; std::vector frameLimits; - bool has(const char* name) const { return letBinders.count(name) != 0; } + bool has(std::string const & name) const { return letBinders.find(name) != letBinders.end(); } public: PTRef getOrUndef(const char* letSymbol) const { auto it = letBinders.find(letSymbol); @@ -104,7 +101,7 @@ class LetRecords { auto limit = frameLimits.back(); frameLimits.pop_back(); while (knownBinders.size() > limit) { - const char* binder = knownBinders.back(); + std::string const & binder = knownBinders.back(); knownBinders.pop_back(); assert(this->has(binder)); auto& values = letBinders.at(binder); @@ -116,13 +113,18 @@ class LetRecords { } } - void addBinding(const char* name, PTRef arg) { - knownBinders.push_back(name); + /** + * Bind `name` to `arg` in this let scope. + * @param name + * @param arg + */ + void addBinding(std::string const & name, PTRef arg) { if (not this->has(name)) { - letBinders.insert(std::make_pair(name, LetBinder(arg))); + letBinders.insert({name, LetBinder(arg)}); } else { letBinders.at(name).addValue(arg); } + knownBinders.push_back(name); } }; @@ -176,7 +178,7 @@ class Interpret { void notify_success(); void comment_formatted(const char* s, ...) const; - bool addLetFrame(const vec & names, vec const& args, LetRecords& letRecords); + bool addLetFrame(std::vector> const & bindings, LetRecords& letRecords); PTRef letNameResolve(const char* s, const LetRecords& letRecords) const; PTRef resolveQualifiedIdentifier(const char * name, ASTNode const & sort, bool isQuoted); From 400e3b3eb3fd5e5aa228ad0343ae273c93c0d8b3 Mon Sep 17 00:00:00 2001 From: Antti Hyvarinen Date: Fri, 25 Nov 2022 07:34:23 +0100 Subject: [PATCH 16/94] Interpret: let overload regression tests --- regression/generic/let-overload.smt2 | 4 ++++ regression/generic/let-overload.smt2.expected.err | 0 regression/generic/let-overload.smt2.expected.out | 1 + regression/generic/let-overload2.smt2 | 4 ++++ regression/generic/let-overload2.smt2.expected.err | 0 regression/generic/let-overload2.smt2.expected.out | 1 + 6 files changed, 10 insertions(+) create mode 100644 regression/generic/let-overload.smt2 create mode 100644 regression/generic/let-overload.smt2.expected.err create mode 100644 regression/generic/let-overload.smt2.expected.out create mode 100644 regression/generic/let-overload2.smt2 create mode 100644 regression/generic/let-overload2.smt2.expected.err create mode 100644 regression/generic/let-overload2.smt2.expected.out diff --git a/regression/generic/let-overload.smt2 b/regression/generic/let-overload.smt2 new file mode 100644 index 00000000..dce67f80 --- /dev/null +++ b/regression/generic/let-overload.smt2 @@ -0,0 +1,4 @@ +(set-logic QF_UF) +(set-info :status sat) +(assert (let ((l false) (l true)) l)) +(check-sat) diff --git a/regression/generic/let-overload.smt2.expected.err b/regression/generic/let-overload.smt2.expected.err new file mode 100644 index 00000000..e69de29b diff --git a/regression/generic/let-overload.smt2.expected.out b/regression/generic/let-overload.smt2.expected.out new file mode 100644 index 00000000..6b8a2c3d --- /dev/null +++ b/regression/generic/let-overload.smt2.expected.out @@ -0,0 +1 @@ +sat diff --git a/regression/generic/let-overload2.smt2 b/regression/generic/let-overload2.smt2 new file mode 100644 index 00000000..28cac990 --- /dev/null +++ b/regression/generic/let-overload2.smt2 @@ -0,0 +1,4 @@ +(set-logic QF_UF) +(set-info :status unsat) +(assert (let ((l true) (l false)) l)) +(check-sat) diff --git a/regression/generic/let-overload2.smt2.expected.err b/regression/generic/let-overload2.smt2.expected.err new file mode 100644 index 00000000..e69de29b diff --git a/regression/generic/let-overload2.smt2.expected.out b/regression/generic/let-overload2.smt2.expected.out new file mode 100644 index 00000000..3f65111b --- /dev/null +++ b/regression/generic/let-overload2.smt2.expected.out @@ -0,0 +1 @@ +unsat From 7ec38bc6e7089c90e3b661db37704d81ca6b730b Mon Sep 17 00:00:00 2001 From: Antti Hyvarinen Date: Sat, 26 Nov 2022 07:05:48 +0100 Subject: [PATCH 17/94] Interpret: no const vector --- src/api/Interpret.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/Interpret.h b/src/api/Interpret.h index a7169327..2bf6e760 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -84,7 +84,7 @@ class LetBinder { class LetRecords { std::unordered_map letBinders; - std::vector knownBinders; + std::vector knownBinders; std::vector frameLimits; bool has(std::string const & name) const { return letBinders.find(name) != letBinders.end(); } From 81cb3ee87ea296e27dc29cd9e784dac640a1bc47 Mon Sep 17 00:00:00 2001 From: Antti Hyvarinen Date: Sat, 26 Nov 2022 17:10:31 +0100 Subject: [PATCH 18/94] Interpret: fix undefined behaviour --- src/api/Interpret.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/Interpret.h b/src/api/Interpret.h index 2bf6e760..8bfff2bf 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -101,7 +101,7 @@ class LetRecords { auto limit = frameLimits.back(); frameLimits.pop_back(); while (knownBinders.size() > limit) { - std::string const & binder = knownBinders.back(); + std::string binder = std::move(knownBinders.back()); knownBinders.pop_back(); assert(this->has(binder)); auto& values = letBinders.at(binder); From e32fd84d1ce2339fd3f49d777516c885f50f265d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Wed, 15 Jun 2022 16:15:26 +0200 Subject: [PATCH 19/94] parser: Some cleanup [WiP] --- src/api/Interpret.cc | 369 ++++++++--------- src/api/Interpret.h | 24 +- src/api/MainSolver.cc | 7 +- src/options/SMTConfig.cc | 273 +++++-------- src/options/SMTConfig.h | 566 +++++++++++---------------- src/parsers/smt2new/smt2newlexer.ll | 78 ++-- src/parsers/smt2new/smt2newparser.yy | 397 +++++++------------ src/proof/InterpolationContext.cc | 14 +- src/proof/InterpolationContext.h | 12 +- src/tsolvers/egraph/UFInterpolator.h | 6 +- src/tsolvers/lasolver/LASolver.cc | 10 +- 11 files changed, 734 insertions(+), 1022 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index be3dc1b4..da90f30f 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -39,12 +39,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Class defining interpreter ***********************************************************/ -Interpret::~Interpret() { - for (int i = 0; i < term_names.size(); ++i) { - free(term_names[i]); - } -} - PTRef Interpret::getParsedFormula() { @@ -52,77 +46,60 @@ Interpret::getParsedFormula() return root; } -void Interpret::setInfo(ASTNode& n) { - assert(n.getType() == UATTR_T || n.getType() == PATTR_T); +void Interpret::setInfo(ASTNode const & n) { + assert(n.getType() == ASTType::UATTR_T || n.getType() == ASTType::PATTR_T); - char* name = NULL; - if (n.getValue() == NULL) { - ASTNode& an = **(n.children->begin()); - assert(an.getType() == UATTR_T || an.getType() == PATTR_T); - name = strdup(an.getValue()); + std::string name; + if (n.getValue().empty()) { + ASTNode const & an = n.children[0]; + assert(an.getType() == ASTType::UATTR_T || an.getType() == ASTType::PATTR_T); + name = an.getValue(); } else // Normal option - name = strdup(n.getValue()); + name = n.getValue(); Info value(n); - config.setInfo(name, value); - free(name); + config.setInfo(std::move(name), value); } -void Interpret::getInfo(ASTNode& n) { - assert(n.getType() == INFO_T); - - const char* name; - - if (n.getValue() != NULL) - name = n.getValue(); - else { - assert(n.children != NULL); - name = (**(n.children->begin())).getValue(); - } +void Interpret::getInfo(ASTNode const & n) { + assert(n.getType() == ASTType::INFO_T); + assert(n.getValue().empty() or not n.children.empty()); + std::string const & name = n.getValue().empty() ? "" : n.children[0].getValue(); const Info& value = config.getInfo(name); if (value.isEmpty()) - notify_formatted(true, "no value for info %s", name); + notify_formatted(true, "no value for info %s", name.c_str()); else { auto val_str = value.toString(); - notify_formatted(false, "%s %s", name, val_str.c_str()); + notify_formatted(false, "%s %s", name.c_str(), val_str.c_str()); } } -void Interpret::setOption(ASTNode& n) { - assert(n.getType() == OPTION_T); - char* name = NULL; - - if (n.getValue() == NULL) { - // Attribute - ASTNode& an = **(n.children->begin()); - assert(an.getType() == UATTR_T || an.getType() == PATTR_T); - name = strdup(an.getValue()); - } - else // Normal option - name = strdup(n.getValue()); +void Interpret::setOption(ASTNode const & n) { + assert(n.getType() == ASTType::OPTION_T); + assert(not n.getValue().empty() or not n.children.empty()); + std::string const & name = n.getValue().empty() ? n.children[0].getValue() : n.getValue(); SMTOption value(n); const char* msg = "ok"; bool rval = config.setOption(name, value, msg); if (rval == false) - notify_formatted(true, "set-option failed for %s: %s", name, msg); - free(name); + notify_formatted(true, "set-option failed for %s: %s", name.c_str(), msg); } -void Interpret::getOption(ASTNode& n) { - assert(n.getType() == UATTR_T || n.getType() == PATTR_T ); +void Interpret::getOption(ASTNode const & n) { + assert(n.getType() == ASTType::UATTR_T || n.getType() == ASTType::PATTR_T ); - assert(n.getValue() != NULL); - const char* name = n.getValue(); + assert(not n.getValue().empty()); + std::string const & name = n.getValue(); const SMTOption& value = config.getOption(name); if (value.isEmpty()) - notify_formatted(true, "No value for attr %s", name); + notify_formatted(true, "No value for attr %s", name.c_str()); else { auto str_val = value.toString(); notify_formatted(false, "%s",str_val.c_str()); @@ -137,20 +114,20 @@ using opensmt::Logic_t; using opensmt::getLogicFromString; using namespace osmttokens; -void Interpret::interp(ASTNode& n) { - assert(n.getType() == CMD_T); +void Interpret::interp(ASTNode const & n) { + assert(n.getType() == ASTType::CMD_T); const smt2token cmd = n.getToken(); try { switch (cmd.x) { case t_setlogic: { - ASTNode &logic_n = **(n.children->begin()); - const char *logic_name = logic_n.getValue(); + ASTNode const & logic_n = *n.children.begin(); + std::string const & logic_name = logic_n.getValue(); if (isInitialized()) { notify_formatted(true, "logic has already been set to %s", main_solver->getLogic().getName().data()); } else { auto logic_type = getLogicFromString(logic_name); if (logic_type == Logic_t::UNDEF) { - notify_formatted(true, "unknown logic %s", logic_name); + notify_formatted(true, "unknown logic %s", logic_name.c_str()); break; } initializeLogic(logic_type); @@ -161,37 +138,35 @@ void Interpret::interp(ASTNode& n) { break; } case t_setinfo: { - setInfo(**(n.children->begin())); + setInfo(n.children[0]); notify_success(); break; } case t_getinfo: { - getInfo(**(n.children->begin())); + getInfo(n.children[0]); break; } case t_setoption: { - setOption(**(n.children->begin())); + setOption(n.children[0]); notify_success(); break; } case t_getoption: { - getOption(**(n.children->begin())); + getOption(n.children[0]); break; } case t_declaresort: { if (isInitialized()) { - assert(n.children and n.children->size() == 2); - auto it = n.children->begin(); - ASTNode & symbolNode = **it; - assert(symbolNode.getType() == SYM_T or symbolNode.getType() == QSYM_T); - ++it; - ASTNode & numNode = **it; - assert(numNode.getType() == NUM_T); - int arity = atoi(numNode.getValue()); // MB: TODO: take care of out-of-range input + assert(n.children.size() == 2); + ASTNode const & symbolNode = n.children[0]; + assert(symbolNode.getType() == ASTType::SYM_T or symbolNode.getType() == ASTType::QSYM_T); + ASTNode const & numNode = n.children[1]; + assert(numNode.getType() == ASTType::NUM_T); + int arity = std::stoi(numNode.getValue()); // MB: TODO: take care of out-of-range input SortSymbol symbol(symbolNode.getValue(), arity); SSymRef ssref; if (logic->peekSortSymbol(symbol, ssref)) { - notify_formatted(true, "sort %s already declared", symbolNode.getValue()); + notify_formatted(true, "sort %s already declared", symbolNode.getValue().c_str()); } else { logic->declareSortSymbol(std::move(symbol)); notify_success(); @@ -218,7 +193,7 @@ void Interpret::interp(ASTNode& n) { case t_assert: { if (isInitialized()) { sstat status; - ASTNode &asrt = **(n.children->begin()); + ASTNode const &asrt = n.children[0]; LetRecords letRecords; PTRef tr = parseTerm(asrt, letRecords); if (tr == PTRef_Undef) @@ -323,14 +298,14 @@ void Interpret::interp(ASTNode& n) { if (status == s_Error) notify_formatted(true, "write-state"); } else { - writeState((**(n.children->begin())).getValue()); + writeState(n.children[0].getValue()); } } break; } case t_echo: { - const char *str = (**(n.children->begin())).getValue(); - notify_formatted(false, "%s", str); + std::string const & str = n.children[0].getValue(); + notify_formatted(false, "%s", str.c_str()); break; } case t_push: { @@ -338,7 +313,7 @@ void Interpret::interp(ASTNode& n) { notify_formatted(true, "Illegal command before set-logic: push"); } else { try { - int num = std::stoi((**(n.children->begin())).getValue()); + int num = std::stoi(n.children[0].getValue()); push(num); } catch (std::out_of_range const & e) { notify_formatted(true, "Illegal push command: %s", e.what()); @@ -351,8 +326,7 @@ void Interpret::interp(ASTNode& n) { notify_formatted(true, "Illegal command before set-logic: pop"); } else { try { - std::string str((**(n.children->begin())).getValue()); - int num = std::stoi(str); + int num = std::stoi(n.children[0].getValue()); pop(num); } catch (std::out_of_range const &ex) { notify_formatted(true, "Illegal pop command: %s", ex.what()); @@ -413,39 +387,37 @@ PTRef Interpret::resolveTerm(const char* s, vec&& args, SRef sortRef, Sym PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { ASTType t = term.getType(); - if (t == TERM_T) { - const char* name = (**(term.children->begin())).getValue(); + if (t == ASTType::TERM_T) { + std::string const & name = term.children[0].getValue(); // comment_formatted("Processing term %s", name); PTRef tr = PTRef_Undef; try { - tr = logic->mkConst(name); + tr = logic->mkConst(name.c_str()); } catch (OsmtApiException const & e) { - comment_formatted("While processing %s: %s", name, e.what()); + comment_formatted("While processing %s: %s", name.c_str(), e.what()); } return tr; } - else if (t == QID_T) { - if ((**(term.children->begin())).getType() == AS_T) { - auto const & as_node = **(term.children->begin()); - ASTNode const * symbolNode = (*as_node.children)[0]; - bool isQuoted = symbolNode->getType() == QSYM_T; - const char * name = (*as_node.children)[0]->getValue(); - ASTNode const & sortNode = *(*as_node.children)[1]; - assert(name != nullptr); - PTRef tr = resolveQualifiedIdentifier(name, sortNode, isQuoted); + else if (t == ASTType::QID_T) { + if (term.children[0].getType() == ASTType::AS_T) { + ASTNode const & as_node = term.children[0]; + ASTNode const & symbolNode = as_node.children[0]; + bool isQuoted = symbolNode.getType() == ASTType::QSYM_T; + std::string const & name = as_node.children[0].getValue(); + ASTNode const & sortNode = as_node.children[1]; + assert(not name.empty()); + PTRef tr = resolveQualifiedIdentifier(name.c_str(), sortNode, isQuoted); return tr; } else { - ASTNode const * symbolNode = (*(term.children->begin())); - char const * name = symbolNode->getValue(); - bool isQuoted = symbolNode->getType() == QSYM_T; - assert(name != nullptr); - PTRef tr = letNameResolve(name, letRecords); + ASTNode const & symbolNode = term.children[0]; + std::string const & name = symbolNode.getValue(); + bool isQuoted = symbolNode.getType() == ASTType::QSYM_T; + PTRef tr = letNameResolve(name.c_str(), letRecords); if (tr != PTRef_Undef) { return tr; - } - try { - tr = resolveTerm(name, {}, SRef_Undef, isQuoted ? SymbolMatcher::Uninterpreted : SymbolMatcher::Any); + } try { + tr = resolveTerm(name.c_str(), {}, SRef_Undef, isQuoted ? SymbolMatcher::Uninterpreted : SymbolMatcher::Any); } catch (OsmtApiException & e) { reportError(e.what()); } @@ -453,35 +425,36 @@ PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { } } - else if ( t == LQID_T ) { + else if ( t == ASTType::LQID_T ) { // Multi-argument term - auto node_iter = term.children->begin(); + assert(term.children.size() > 1); + auto const & astArgs = opensmt::span(&term.children[1], term.children.size()-1); + std::string const & name = term.children[0].getValue(); vec args; - const char* name = (**node_iter).getValue(); node_iter++; - // Parse the arguments - for (; node_iter != term.children->end(); node_iter++) { - PTRef arg_term = parseTerm(**node_iter, letRecords); - if (arg_term == PTRef_Undef) + for (auto const & arg : astArgs) { + PTRef arg_tr = parseTerm(arg, letRecords); + if (arg_tr == PTRef_Undef) { return PTRef_Undef; - else - args.push(arg_term); + } else { + args.push(arg_tr); + } } + assert(args.size() > 0); PTRef tr = PTRef_Undef; try { - tr = resolveTerm(name, std::move(args)); + tr = resolveTerm(name.c_str(), std::move(args)); } catch (ArithDivisionByZeroException &ex) { reportError(ex.what()); } catch (OsmtApiException &e) { reportError(e.what()); } return tr; - } - - else if (t == LET_T) { - auto ch = term.children->begin(); - auto vbl = (**ch).children->begin(); + } else if (t == ASTType::LET_T) { + assert(term.children.size() == 2); + std::vector const & varList = term.children[0].children; + ASTNode const & letBoundedTerm = term.children[1]; // use RAII idiom to guard the scope of new LetFrame (and ensure the cleaup of names) class Guard { @@ -494,21 +467,20 @@ PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { std::vector> bindings; // First read the term declarations in the let statement - while (vbl != (**ch).children->end()) { - PTRef let_tr = parseTerm(**((**vbl).children->begin()), letRecords); + for (auto const & varListEl : varList) { + PTRef let_tr = parseTerm(varListEl.children[0], letRecords); if (let_tr == PTRef_Undef) return PTRef_Undef; - bindings.push_back({let_tr, (**vbl).getValue()}); - vbl++; + bindings.push_back({let_tr, varListEl.getValue()}); } + // Only then insert them to the table bool success = addLetFrame(bindings, letRecords); if (not success) { comment_formatted("Let name addition failed"); return PTRef_Undef; } - ch++; // This is now constructed with the let declarations context in let_branch - PTRef tr = parseTerm(**(ch), letRecords); + PTRef tr = parseTerm(letBoundedTerm, letRecords); if (tr == PTRef_Undef) { comment_formatted("Failed in parsing the let scoped term"); return PTRef_Undef; @@ -516,34 +488,34 @@ PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { return tr; } - else if (t == BANG_T) { - assert(term.children->size() == 2); - auto ch = term.children->begin(); - ASTNode& named_term = **ch; - ASTNode& attr_l = **(++ ch); - assert(attr_l.getType() == GATTRL_T); - assert(attr_l.children->size() == 1); - ASTNode& name_attr = **(attr_l.children->begin()); + else if (t == ASTType::BANG_T) { + assert(term.children.size() == 2); + + ASTNode const & named_term = term.children[0]; + ASTNode const & attr_l = term.children[1]; + assert(attr_l.getType() == ASTType::GATTRL_T); + assert(attr_l.children.size() == 1); + ASTNode const & name_attr = attr_l.children[0]; PTRef tr = parseTerm(named_term, letRecords); if (tr == PTRef_Undef) return tr; - if (strcmp(name_attr.getValue(), ":named") == 0) { - ASTNode& sym = **(name_attr.children->begin()); - assert(sym.getType() == SYM_T or sym.getType() == QSYM_T); - if (nameToTerm.has(sym.getValue())) { - notify_formatted(true, "name %s already exists", sym.getValue()); + if (name_attr.getValue() == ":named") { + ASTNode const & sym = name_attr.children[0]; + assert(sym.getType() == ASTType::SYM_T or sym.getType() == ASTType::QSYM_T); + if (nameToTerm.has(sym.getValue().c_str())) { + notify_formatted(true, "name %s already exists", sym.getValue().c_str()); return PTRef_Undef; } - char* name = strdup(sym.getValue()); + std::string name = sym.getValue(); // MB: term_names becomes the owner of the string and is responsible for deleting - term_names.push(name); - nameToTerm.insert(name, tr); + term_names.push_back(name); + nameToTerm.insert(name.c_str(), tr); if (!termToNames.has(tr)) { vec v; termToNames.insert(tr, v); } - termToNames[tr].push(name); + termToNames[tr].push(name.c_str()); } return tr; } @@ -579,10 +551,9 @@ sstat Interpret::checkSat() { if (res == s_Undef) { const SMTOption& o_dump_state = config.getOption(":dump-state"); const SpType o_split = config.sat_split_type(); - char* name = config.dump_state(); + std::string name = config.dump_state(); if (!o_dump_state.isEmpty() && o_split == spt_none) writeState(name); - free(name); } return res; @@ -637,8 +608,8 @@ bool Interpret::getAssignment() { std::stringstream ss; ss << '('; for (int i = 0; i < term_names.size(); i++) { - const char* name = term_names[i]; - PTRef tr = nameToTerm[name]; + std::string const & name = term_names[i]; + PTRef tr = nameToTerm[name.c_str()]; lbool val = main_solver->getTermValue(tr); ss << '(' << name << ' ' << (val == l_True ? "true" : (val == l_False ? "false" : "unknown")) << ')' << (i < term_names.size() - 1 ? " " : ""); @@ -649,13 +620,12 @@ bool Interpret::getAssignment() { return true; } -void Interpret::getValue(const std::vector* terms) +void Interpret::getValue(std::vector const & terms) { auto model = main_solver->getModel(); Logic& logic = main_solver->getLogic(); std::vector> values; - for (auto term_it = terms->begin(); term_it != terms->end(); ++term_it) { - const ASTNode& term = **term_it; + for (auto const & term : terms) { LetRecords tmp; PTRef tr = parseTerm(term, tmp); if (tr != PTRef_Undef) { @@ -663,7 +633,7 @@ void Interpret::getValue(const std::vector* terms) auto pt_str = logic.printTerm(tr); comment_formatted("Found the term %s", pt_str.c_str()); } else - comment_formatted("Error parsing the term %s", (**(term.children->begin())).getValue()); + comment_formatted("Error parsing the term %s", term.children[0].getValue().c_str()); } printf("("); for (auto const & valPair : values) { @@ -806,12 +776,12 @@ std::string Interpret::printDefinitionSmtlib(TemplateFunction const & templateFu return ss.str(); } -void Interpret::writeState(const char* filename) +void Interpret::writeState(std::string const & filename) { char* msg; bool rval; - rval = main_solver->writeSolverState_smtlib2(filename, &msg); + rval = main_solver->writeSolverState_smtlib2(filename.c_str(), &msg); if (!rval) { notify_formatted("%s", msg); @@ -820,13 +790,12 @@ void Interpret::writeState(const char* filename) bool Interpret::declareFun(ASTNode const & n) // (const char* fname, const vec& args) { - auto it = n.children->begin(); - ASTNode const & name_node = **(it++); - ASTNode const & args_node = **(it++); - ASTNode const & ret_node = **(it++); - assert(it == n.children->end()); + assert(n.children.size() == 3); + ASTNode const & name_node = n.children[0]; + ASTNode const & args_node = n.children[1]; + ASTNode const & ret_node = n.children[2]; - const char* fname = name_node.getValue(); + std::string const & fname = name_node.getValue(); vec args; @@ -834,16 +803,16 @@ bool Interpret::declareFun(ASTNode const & n) // (const char* fname, const vecdeclareFun(fname, rsort, args2); if (rval == SymRef_Undef) { - comment_formatted("Error while declare-fun %s", fname); + comment_formatted("Error while declare-fun %s", fname.c_str()); return false; } user_declarations.push(rval); return true; } -bool Interpret::declareConst(ASTNode& n) //(const char* fname, const SRef ret_sort) +bool Interpret::declareConst(ASTNode const & n) //(const char* fname, const SRef ret_sort) { - assert(n.children and n.children->size() == 3); - auto it = n.children->begin(); - ASTNode const & name_node = **(it++); - it++; // args_node - ASTNode const & ret_node = **(it++); - const char* fname = name_node.getValue(); + assert(n.children.size() == 3); + ASTNode const & name_node = n.children[0]; + // n.children[1] is the args node, which is empty + ASTNode const & ret_node = n.children[2]; + + std::string const & fname = name_node.getValue(); SRef ret_sort = sortFromASTNode(ret_node); if (ret_sort == SRef_Undef) { - notify_formatted(true, "Failed to declare constant %s", fname); - notify_formatted(true, "Unknown return sort %s of %s", sortSymbolFromASTNode(ret_node).name.c_str(), fname); + notify_formatted(true, "Failed to declare constant %s", fname.c_str()); + notify_formatted(true, "Unknown return sort %s of %s", sortSymbolFromASTNode(ret_node).name.c_str(), fname.c_str()); return false; } SymRef rval = logic->declareFun(fname, ret_sort, {}); if (rval == SymRef_Undef) { - comment_formatted("Error while declare-const %s", fname); + comment_formatted("Error while declare-const %s", fname.c_str()); return false; } user_declarations.push(rval); @@ -891,26 +860,25 @@ bool Interpret::declareConst(ASTNode& n) //(const char* fname, const SRef ret_so bool Interpret::defineFun(const ASTNode& n) { - auto it = n.children->begin(); - ASTNode const & name_node = **(it++); - ASTNode const & args_node = **(it++); - ASTNode const & ret_node = **(it++); - ASTNode const & term_node = **(it++); - assert(it == n.children->end()); + assert(n.children.size() == 4); + + ASTNode const & name_node = n.children[0]; + ASTNode const & args_node = n.children[1]; + ASTNode const & ret_node = n.children[2]; + ASTNode const & term_node = n.children[3]; - const char* fname = name_node.getValue(); + std::string const & fname = name_node.getValue(); // Get the argument sorts vec arg_sorts; vec arg_trs; - for (auto childNodePtr : *args_node.children) { - ASTNode const & childNode = *childNodePtr; - assert(childNode.children->size() == 1); + for (auto const & childNode : args_node.children) { + assert(childNode.children.size() == 1); std::string varName = childNode.getValue(); - ASTNode const & sortNode = **(childNode.children->begin()); + ASTNode const & sortNode = childNode.children[0]; SRef sortRef = sortFromASTNode(sortNode); if (sortRef == SRef_Undef) { - notify_formatted(true, "Undefined sort %s in function %s", sortSymbolFromASTNode(sortNode).name.c_str(), fname); + notify_formatted(true, "Undefined sort %s in function %s", sortSymbolFromASTNode(sortNode).name.c_str(), fname.c_str()); return false; } arg_sorts.push(sortRef); @@ -921,7 +889,7 @@ bool Interpret::defineFun(const ASTNode& n) // The return sort SRef ret_sort = sortFromASTNode(ret_node); if (ret_sort == SRef_Undef) { - notify_formatted(true, "Unknown return sort %s of %s", sortSymbolFromASTNode(ret_node).name.c_str(), fname); + notify_formatted(true, "Unknown return sort %s of %s", sortSymbolFromASTNode(ret_node).name.c_str(), fname.c_str()); return false; } sstat status; @@ -1030,11 +998,9 @@ void Interpret::notify_success() { } void Interpret::execute(const ASTNode* r) { - auto i = r->children->begin(); - for (; i != r->children->end() && !f_exit; i++) { - interp(**i); - delete *i; - *i = nullptr; + for (auto const & command : r->children) { + if (f_exit) break; + interp(command); } } @@ -1176,47 +1142,49 @@ int Interpret::interpPipe() { SortSymbol Interpret::sortSymbolFromASTNode(ASTNode const & node) { auto type = node.getType(); - if (type == SYM_T or type == QSYM_T) { + if (type == ASTType::SYM_T or type == ASTType::QSYM_T) { return {node.getValue(), 0}; } else { - assert(type == LID_T and node.children and not node.children->empty()); - ASTNode const & name = **(node.children->begin()); - return {name.getValue(), static_cast(node.children->size() - 1)}; + assert(type == ASTType::LID_T and not node.children.empty()); + ASTNode const & name = node.children[0]; + return {name.getValue(), static_cast(node.children.size() - 1)}; } } SRef Interpret::sortFromASTNode(ASTNode const & node) const { auto type = node.getType(); - if (type == SYM_T or type == QSYM_T) { + if (type == ASTType::SYM_T or type == ASTType::QSYM_T) { SortSymbol symbol(node.getValue(), 0); SSymRef symRef; bool known = logic->peekSortSymbol(symbol, symRef); if (not known) { return SRef_Undef; } return logic->getSort(symRef, {}); } else { - assert(type == LID_T and node.children and not node.children->empty()); - ASTNode const & name = **(node.children->begin()); - SortSymbol symbol(name.getValue(), node.children->size() - 1); + assert(type == ASTType::LID_T and not node.children.empty()); + ASTNode const & name = node.children[0]; + SortSymbol symbol(name.getValue(), node.children.size() - 1); SSymRef symRef; bool known = logic->peekSortSymbol(symbol, symRef); if (not known) { return SRef_Undef; } vec args; - for (auto it = node.children->begin() + 1; it != node.children->end(); ++it) { - SRef argSortRef = sortFromASTNode(**it); + auto astArgs = opensmt::span(&node.children[1], node.children.size()-1); + for (auto const & astArg : astArgs) { + SRef argSortRef = sortFromASTNode(astArg); if (argSortRef == SRef_Undef) { return SRef_Undef; } args.push(argSortRef); } return logic->getSort(symRef, std::move(args)); } - assert(type == LID_T and node.children and not node.children->empty()); - ASTNode const & name = **(node.children->begin()); - SortSymbol symbol(name.getValue(), node.children->size() - 1); + assert(type == ASTType::LID_T and not node.children.empty()); + ASTNode const & name = node.children[0]; + SortSymbol symbol(name.getValue(), node.children.size() - 1); SSymRef symRef; bool known = logic->peekSortSymbol(symbol, symRef); if (not known) { return SRef_Undef; } vec args; - for (auto it = node.children->begin() + 1; it != node.children->end(); ++it) { - SRef argSortRef = sortFromASTNode(**it); + auto astSortArgs = opensmt::span(&node.children[1], node.children.size()-1); + for (auto const & astSortArg : astSortArgs) { + SRef argSortRef = sortFromASTNode(astSortArg); if (argSortRef == SRef_Undef) { return SRef_Undef; } args.push(argSortRef); } @@ -1225,7 +1193,7 @@ SRef Interpret::sortFromASTNode(ASTNode const & node) const { void Interpret::getInterpolants(const ASTNode& n) { - auto exps = *n.children; + auto const & exps = n.children; vec grouping; // Consists of PTRefs that we want to group LetRecords letRecords; letRecords.pushFrame(); @@ -1233,8 +1201,7 @@ void Interpret::getInterpolants(const ASTNode& n) letRecords.addBinding(key, nameToTerm[key]); } - for (auto e : exps) { - ASTNode& c = *e; + for (auto const & c : exps) { PTRef tr = parseTerm(c, letRecords); // printf("Itp'ing a term %s\n", logic->pp(tr)); grouping.push(tr); @@ -1313,8 +1280,8 @@ void Interpret::initializeLogic(opensmt::Logic_t logicType) { logic.reset(opensmt::LogicFactory::getInstance(logicType)); } -std::unique_ptr Interpret::createMainSolver(const char* logic_name) { - return std::make_unique(*logic, config, std::string(logic_name) + " solver"); +std::unique_ptr Interpret::createMainSolver(std::string const & logic_name) { + return std::make_unique(*logic, config, logic_name + " solver"); } diff --git a/src/api/Interpret.h b/src/api/Interpret.h index 8bfff2bf..bb527b63 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -139,7 +139,7 @@ class Interpret { // Named terms for getting variable values MapWithKeys> nameToTerm; VecMap > termToNames; - vec term_names; // For (! :named ) constructs. if Itp is enabled, this maps a + std::vector term_names; // For (! :named ) constructs. if Itp is enabled, this maps a // partition to it name. vec assertions; vec user_declarations; @@ -150,16 +150,16 @@ class Interpret { SRef sortFromASTNode(ASTNode const & n) const; static SortSymbol sortSymbolFromASTNode(ASTNode const & node); - void setInfo(ASTNode& n); - void getInfo(ASTNode& n); - void setOption(ASTNode& n); - void getOption(ASTNode& n); - void writeState(const char* fname); + void setInfo(ASTNode const & n); + void getInfo(ASTNode const & n); + void setOption(ASTNode const & n); + void getOption(ASTNode const & n); + void writeState(std::string const & fname); bool declareFun(ASTNode const & n); //(const char* fname, const vec& args); - bool declareConst(ASTNode& n); //(const char* fname, const SRef ret_sort); - bool defineFun(const ASTNode& n); + bool declareConst(ASTNode const & n); //(const char* fname, const SRef ret_sort); + bool defineFun(ASTNode const & n); virtual sstat checkSat(); - void getValue(const std::vector* term); + void getValue(std::vector const & term); void getModel(); std::string printDefinitionSmtlib(PTRef tr, PTRef val); std::string printDefinitionSmtlib(const TemplateFunction &templateFun) const; @@ -172,7 +172,7 @@ class Interpret { virtual void exit(); void getInterpolants(const ASTNode& n); - void interp (ASTNode& n); + void interp (ASTNode const & n); void notify_formatted(bool error, const char* s, ...); void notify_success(); @@ -182,7 +182,7 @@ class Interpret { PTRef letNameResolve(const char* s, const LetRecords& letRecords) const; PTRef resolveQualifiedIdentifier(const char * name, ASTNode const & sort, bool isQuoted); - virtual std::unique_ptr createMainSolver(const char* logic_name); + virtual std::unique_ptr createMainSolver(std::string const & logic_name); public: @@ -191,8 +191,6 @@ class Interpret { , f_exit (false) { } - ~Interpret(); - int interpFile(FILE* in); int interpFile(char *content); int interpPipe(); diff --git a/src/api/MainSolver.cc b/src/api/MainSolver.cc index ceb3754f..e1efac30 100644 --- a/src/api/MainSolver.cc +++ b/src/api/MainSolver.cc @@ -245,12 +245,12 @@ bool MainSolver::writeSolverState_smtlib2(const char* file, char** msg) const void MainSolver::printFramesAsQuery() const { - char* base_name = config.dump_query_name(); - if (base_name == NULL) + auto base_name = config.dump_query_name(); + if (base_name.empty()) getTheory().printFramesAsQuery(frames.getFrameReferences(), std::cout); else { char* s_file_name; - int chars_written = asprintf(&s_file_name, "%s-%d.smt2", base_name, check_called); + int chars_written = asprintf(&s_file_name, "%s-%d.smt2", base_name.c_str(), check_called); (void)chars_written; std::ofstream stream; stream.open(s_file_name); @@ -258,7 +258,6 @@ void MainSolver::printFramesAsQuery() const stream.close(); free(s_file_name); } - free(base_name); } sstat MainSolver::check() diff --git a/src/options/SMTConfig.cc b/src/options/SMTConfig.cc index 3952b319..30485ffc 100644 --- a/src/options/SMTConfig.cc +++ b/src/options/SMTConfig.cc @@ -30,55 +30,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -void ASTNode::print(std::ostream& o, int indent) { - for (int i = 0; i < indent; i++) - printf(" "); - o << "" << std::endl; - if (children == NULL) return; - for (auto i = children->begin(); i != children->end(); i++) - (*i)->print(o, indent+1); -} - -const char* ASTNode::typestr[] = { - "command" , "command-list" // CMD - , "symbol" , "symbol-list" // SYM - , "number" , "number_list" // NUM - , "sort" , "sort-list" // SORT - , "sorted-var" , "sorted-var-list" // SV - , "user-attr" , "user-attr-list" // UATTR - , "predef-attr" , "predef-attr-list" // PATTR - , "gen-attr" , "gen-attr-list" // GATTR - , "spec-const" , "spec-const-list" // SPECC - , "s-expr" , "s-expr-list" // SEXPR - , "identifier" , "identifier-list" // ID - , "long-identifier" , "long-identifier-list" // LID - , "decimal" , "decimal-list" // DEC - , "hex" , "hex-list" // HEX - , "binary" , "binary-list" // BIN - , "string" , "string-list" // STR - , "as" , "as-list" // AS - , "var-binding" , "var-binding-list" // VARB - , "term" , "term-list" // TERM - , "qualified-id" , "qualified-id-list" // QID - , "long-qual-id" , "long-qual-id-list" // LQID - , "let" , "let-list" // LET - , "forall" , "forall-list" // FORALL - , "exists" , "exists-list" // EXISTS - , "!" , "!-list" // BANG - , "sort-sym-decl" , "sort-sym-decl-list" // SSYMD - , "fun-sym-decl" , "fun-sym-decl-list" // FSYMD - , "par-fun-sym-decl", "par-fun-sym-decl-list" // PFSYMD - , "pf-2nd" , "pf-2nd-list" // PFID - , "theory-attr" , "theory-attr-list" // TATTR - , "theory-decl" , "theory-decl-list" // TDECL - , "logic-attr" , "logic-attr-list" // LATTR - , "logic" , "logic-list" // LOGIC - , "bool" , "bool-list" // BOOL - , "option" , "option-list" // OPTION - , "info-flag" , "info-flag-list" // INFO -}; - - /********************************************************************* * Generic configuration class, used for both set-info and set-option *********************************************************************/ @@ -89,61 +40,60 @@ ConfValue::ConfValue(const char* s) { } ConfValue::ConfValue(const ASTNode& s_expr_n) { - if (s_expr_n.getType() == SEXPRL_T) { + if (s_expr_n.getType() == ASTType::SEXPRL_T) { type = O_LIST; configs = new std::list; - for (auto i = s_expr_n.children->begin(); i != s_expr_n.children->end(); i++) - configs->push_back(new ConfValue(**i)); - } - else if (s_expr_n.getType() == SYM_T) { + for (auto const & i : s_expr_n.children) { + configs->push_back(new ConfValue(i)); + } + } else if (s_expr_n.getType() == ASTType::SYM_T) { type = O_SYM; - strval = strdup(s_expr_n.getValue()); - } - else if (s_expr_n.getType() == SPECC_T) { - ASTNode& spn = **(s_expr_n.children->begin()); - if (spn.getType() == NUM_T) { + strval = s_expr_n.getValue(); + } else if (s_expr_n.getType() == ASTType::SPECC_T) { + assert(s_expr_n.children.size() > 0); + ASTNode const & spn = s_expr_n.children[0]; + if (spn.getType() == ASTType::NUM_T) { type = O_NUM; - numval = atoi(spn.getValue()); - } - else if (spn.getType() == DEC_T) { + numval = std::stoi(spn.getValue()); + } else if (spn.getType() == ASTType::DEC_T) { type = O_DEC; - char* end; - decval = strtod(spn.getValue(), &end); - assert(end != NULL); - } - else if (spn.getType() == HEX_T) { + decval = std::stod(spn.getValue()); + } else if (spn.getType() == ASTType::HEX_T) { type = O_HEX; std::string tmp(spn.getValue()); tmp.erase(0,2); char* end; unumval = strtoul(tmp.c_str(), &end, 16); - assert(end != NULL); + assert(end); } - else if (spn.getType() == BIN_T) { + else if (spn.getType() == ASTType::BIN_T) { type = O_BIN; std::string tmp(spn.getValue()); tmp.erase(0,2); char* end; unumval = strtoul(tmp.c_str(), &end, 2); - assert(end != NULL); + assert(end); } - else if (spn.getType() == STR_T) { + else if (spn.getType() == ASTType::STR_T) { type = O_STR; - strval = strdup(spn.getValue()); + strval = spn.getValue(); } - else assert(false); - } - else if (s_expr_n.getType() == UATTR_T) { + else { + assert(false); + } + } else if (s_expr_n.getType() == ASTType::UATTR_T) { type = O_ATTR; - strval = strdup(s_expr_n.getValue()); + strval = s_expr_n.getValue(); + } + else { + assert(false); //Not implemented } - else assert(false); //Not implemented } ConfValue::ConfValue(const ConfValue& other) { type = other.type; if (type == O_NUM) numval = other.numval; - else if (type == O_STR) strval = strdup(other.strval); + else if (type == O_STR) strval = other.strval; else if (type == O_DEC) decval = other.decval; else if (type == O_LIST) { configs = new std::list; @@ -151,13 +101,13 @@ ConfValue::ConfValue(const ConfValue& other) { configs->push_back(new ConfValue(*value)); } else if (type == O_SYM) - strval = strdup(other.strval); + strval = other.strval; else if (type == O_HEX) unumval = other.unumval; else if (type == O_BIN) unumval = other.unumval; else if (type == O_ATTR) - strval = strdup(other.strval); + strval = other.strval; else if (type == O_BOOL) numval = other.numval; else if (type == O_EMPTY) @@ -169,7 +119,7 @@ ConfValue& ConfValue::operator=(const ConfValue& other) { type = other.type; if (type == O_NUM) numval = other.numval; - else if (type == O_STR) strval = strdup(other.strval); + else if (type == O_STR) strval = other.strval; else if (type == O_DEC) decval = other.decval; else if (type == O_LIST) { configs = new std::list; @@ -177,13 +127,13 @@ ConfValue& ConfValue::operator=(const ConfValue& other) configs->push_back(new ConfValue(*value)); } else if (type == O_SYM) - strval = strdup(other.strval); + strval = other.strval; else if (type == O_HEX) unumval = other.unumval; else if (type == O_BIN) unumval = other.unumval; else if (type == O_ATTR) - strval = strdup(other.strval); + strval = other.strval; else if (type == O_BOOL) numval = other.numval; else if (type == O_EMPTY) @@ -192,23 +142,13 @@ ConfValue& ConfValue::operator=(const ConfValue& other) return *this; } -ConfValue::~ConfValue() -{ - if (type == O_STR && strval != NULL) { - free(strval); - strval = NULL; - } - else if (type == O_EMPTY) - free(strval); - else if (type == O_LIST) { - for (auto * value : *configs) +ConfValue::~ConfValue() { + if (type == O_LIST) { + for (auto * value : *configs) { delete value; + } delete configs; } - else if (type == O_SYM) - free(strval); - else if (type == O_ATTR) - free(strval); } std::string ConfValue::toString() const { @@ -255,20 +195,19 @@ std::string ConfValue::toString() const { ***********************************************************/ Info::Info(ASTNode const & n) { - assert(n.getType() == UATTR_T or n.getType() == PATTR_T); - if (n.children == NULL) { + assert(n.getType() == ASTType::UATTR_T or n.getType() == ASTType::PATTR_T); + if (n.children.empty()) { value.type = O_EMPTY; return; - } - else { + } else { // child is attribute_value - ASTNode const & child = **(n.children->begin()); + ASTNode const & child = n.children[0]; - if (child.getType() == SPECC_T or child.getType() == SEXPRL_T) { + if (child.getType() == ASTType::SPECC_T or child.getType() == ASTType::SEXPRL_T) { value = ConfValue(child); } - else if (child.getType() == SYM_T or child.getType() == QSYM_T) { - value.strval = strdup(child.getValue()); + else if (child.getType() == ASTType::SYM_T or child.getType() == ASTType::QSYM_T) { + value.strval = child.getValue(); value.type = O_STR; } else assert(false); @@ -285,55 +224,52 @@ Info::Info(const Info& other) ***********************************************************/ SMTOption::SMTOption(ASTNode const & n) { - assert(n.children); + assert(not n.children.empty()); - ASTNode const & child = **(n.children->begin()); + ASTNode const & child = n.children[0]; - if (child.getType() == BOOL_T) { + if (child.getType() == ASTType::BOOL_T) { value.type = O_BOOL; - value.numval = strcmp(child.getValue(), "true") == 0 ? 1 : 0; + value.numval = child.getValue() == "true" ? 1 : 0; return; } - if (child.getType() == STR_T) { + if (child.getType() == ASTType::STR_T) { value.type = O_STR; - value.strval = strdup(child.getValue()); + value.strval = child.getValue(); return; } - if (child.getType() == NUM_T) { + if (child.getType() == ASTType::NUM_T) { value.type = O_NUM; - value.numval = atoi(child.getValue()); + value.numval = std::stoi(child.getValue()); return; } - if (child.getType() == DEC_T) { + if (child.getType() == ASTType::DEC_T) { value.type = O_DEC; - sscanf(child.getValue(), "%lf", &value.decval); + value.decval = std::stod(child.getValue()); } - assert(child.getType() == UATTR_T or child.getType() == PATTR_T); + assert(child.getType() == ASTType::UATTR_T or child.getType() == ASTType::PATTR_T); // The option is an attribute - if (not child.children) { + if (child.children.empty()) { value.type = O_EMPTY; return; - } - else { + } else { // n is now attribute_value - ASTNode const & attributeValue = **(child.children->begin()); + ASTNode const & attributeValue = child.children[0]; - if (attributeValue.getType() == SPECC_T or attributeValue.getType() == SEXPRL_T) { + if (attributeValue.getType() == ASTType::SPECC_T or attributeValue.getType() == ASTType::SEXPRL_T) { value = ConfValue(attributeValue); } - else if (attributeValue.getType() == SYM_T) { - if (strcmp(attributeValue.getValue(), "true") == 0) { + else if (attributeValue.getType() == ASTType::SYM_T) { + if (attributeValue.getValue() == "true") { value.type = O_BOOL; value.numval = 1; - } - else if (strcmp(attributeValue.getValue(), "false") == 0) { + } else if (attributeValue.getValue() == "false") { value.type = O_BOOL; value.numval = 0; - } - else { - value.strval = strdup(attributeValue.getValue()); + } else { + value.strval = attributeValue.getValue(); value.type = O_STR; } return; @@ -345,7 +281,7 @@ SMTOption::SMTOption(ASTNode const & n) { //--------------------------------------------------------------------------------- // SMTConfig -bool SMTConfig::setOption(const char* name, const SMTOption& value, const char*& msg) { +bool SMTConfig::setOption(std::string const & name, const SMTOption& value, const char*& msg) { msg = "ok"; if (usedForInitialization && isPreInitializationOption(name)) { msg = "Option cannot be changed at this point"; @@ -353,11 +289,11 @@ bool SMTConfig::setOption(const char* name, const SMTOption& value, const char*& } // Special options: // stats_out - if (strcmp(name, o_stats_out) == 0) { + if (name == o_stats_out) { if (value.getValue().type != O_STR) { msg = s_err_not_str; return false; } - if (!optionTable.has(name)) + if (optionTable.find(name) == optionTable.end()) stats_out.open(value.getValue().strval, std::ios_base::out); - else if (strcmp(optionTable[name]->getValue().strval, value.getValue().strval) != 0) { + else if (optionTable[name]->getValue().strval != value.getValue().strval) { if (stats_out.is_open()) { stats_out.close(); stats_out.open(value.getValue().strval, std::ios_base::out); @@ -367,79 +303,80 @@ bool SMTConfig::setOption(const char* name, const SMTOption& value, const char*& } // produce stats - if (strcmp(name, o_produce_stats) == 0) { + if (name == o_produce_stats) { if (value.getValue().type != O_BOOL) { msg = s_err_not_bool; return false; } if (value.getValue().numval == 1) { // Gets set to true - if (!optionTable.has(o_stats_out)) { - if (!optionTable.has(o_produce_stats) || optionTable[o_produce_stats]->getValue().numval == 0) { + if (optionTable.find(o_stats_out) == optionTable.end()) { + if (optionTable.find(o_produce_stats) == optionTable.end() || optionTable[o_produce_stats]->getValue().numval == 0) { // Insert the default value insertOption(o_stats_out, new SMTOption("/dev/stdout")); - } - else if (optionTable.has(o_produce_stats) && optionTable[o_produce_stats]->getValue().numval == 1) + } else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats]->getValue().numval == 1) { assert(false); + } } else { } // No action required if (!stats_out.is_open()) stats_out.open(optionTable[o_stats_out]->getValue().strval, std::ios_base::out); } - else if (optionTable.has(o_produce_stats) && optionTable[o_produce_stats]->getValue().numval == 1) { + else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats]->getValue().numval == 1) { // gets set to false and was previously true - if (optionTable.has(o_stats_out)) { - if (optionTable[o_stats_out]->getValue().numval == 0) assert(false); + if (optionTable.find(o_stats_out) != optionTable.end()) { + if (optionTable.at(o_stats_out)->getValue().numval == 0) assert(false); else if (stats_out.is_open()) stats_out.close(); } } } - if (strcmp(name, o_random_seed) == 0) { + if (name == o_random_seed) { if (value.getValue().type != O_NUM) { msg = s_err_not_num; return false; } int seed = value.getValue().numval; if (seed == 0) { msg = s_err_seed_zero; return false; } } - if (strcmp(name, o_sat_split_type) == 0) { + if (name == o_sat_split_type) { if (value.getValue().type != O_STR) { msg = s_err_not_str; return false; } - const char* val = value.getValue().strval; - if (strcmp(val, spts_lookahead) != 0 && - strcmp(val, spts_scatter) != 0 && - strcmp(val, spts_none) != 0) - { msg = s_err_unknown_split; return false; } + std::string val = value.getValue().strval; + if (val != spts_lookahead && val != spts_scatter && val != spts_none) { + msg = s_err_unknown_split; + return false; + } } - if (strcmp(name, o_sat_split_units) == 0) { + if (name == o_sat_split_units) { if (value.getValue().type != O_STR) { msg = s_err_not_str; return false; } - const char* val = value.getValue().strval; - if (strcmp(val, spts_time) != 0 && - strcmp(val, spts_search_counter) != 0) - { msg = s_err_unknown_units; return false; } + std::string val = value.getValue().strval; + if (val != spts_time && val != spts_search_counter) { + msg = s_err_unknown_units; + return false; + } + } + auto itr = optionTable.find(name); + if (itr != optionTable.end()) { + optionTable.erase(itr); } - if (optionTable.has(name)) - optionTable.remove(name); insertOption(name, new SMTOption(value)); return true; } -const SMTOption& SMTConfig::getOption(const char* name) const { - if (optionTable.has(name)) - return *optionTable[name]; +const SMTOption& SMTConfig::getOption(std::string const & name) const { + auto itr = optionTable.find(name); + if (itr != optionTable.end()) + return *itr->second; else return option_Empty; } -bool SMTConfig::setInfo(const char* name_, const Info& value) { - if (infoTable.has(name_)) - infoTable.remove(name_); - Info* value_new = new Info(value); - char* name = strdup(name_); - infos.push(value_new); - info_names.push(name); - infoTable.insert(name, value_new); +bool SMTConfig::setInfo(std::string && name_, const Info& value) { + if (infoTable.find(name_) != infoTable.end()) + infoTable.erase(infoTable.find(name_)); + infos.emplace_back(Info(value)); + infoTable.insert({name_, &infos.back()}); return true; } -const Info& SMTConfig::getInfo(const char* name) const { - if (infoTable.has(name)) - return *infoTable[name]; +const Info& SMTConfig::getInfo(std::string const & name) const { + if (infoTable.find(name) != infoTable.end()) + return *infoTable.at(name); else return info_Empty; } diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index 3869fae5..87c1af25 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -38,7 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -enum ASTType { +enum class ASTType { CMD_T , CMDL_T , SYM_T , SYML_T , QSYM_T , QSYML_T @@ -77,35 +77,28 @@ enum ASTType { , OPTION_T , OPTIONL_T , INFO_T , INFOL_T , CONST_T , CONSTL_T + , UNDEF_T }; class ASTNode { private: - ASTType type; - osmttokens::smt2token tok; - char* val; - static const char* typestr[]; + ASTType type; + osmttokens::smt2token tok; + std::string val; public: - std::vector< ASTNode* >*children; - ASTNode(ASTType t, osmttokens::smt2token tok) : type(t), tok(tok), val(NULL), children(NULL) {} - ASTNode(ASTType t, char* v) : type(t), tok({osmttokens::t_none}), val(v), children(NULL) {} + std::vector children; + + ASTNode(ASTType t, osmttokens::smt2token tok = {osmttokens::t_none}, std::string && v = "", std::vector && children = {}) + : type(t), tok(tok), val(std::move(v)), children(std::move(children)) {} + ASTNode() : ASTNode(ASTType::UNDEF_T) {} ASTNode(ASTNode const &) = delete; + ASTNode(ASTNode &&) = default; ASTNode & operator=(ASTNode const &) = delete; - ~ASTNode() { - if (children) { - for (auto ci = children->begin(); ci != children->end(); ci++) { - delete *ci; - }; - delete children; - } - free(val); - } - void print(std::ostream& o, int indent); - inline const char *typeToStr() const { return typestr[type]; } - inline ASTType getType() const { return type; } - inline const char *getValue() const { return val; } - inline const osmttokens::smt2token getToken() const { return tok; } + void print(std::ostream& o, int indent) const; + ASTType getType() const { return type; } + std::string const & getValue() const { return val; } + const osmttokens::smt2token getToken() const { return tok; } }; @@ -114,7 +107,7 @@ enum ConfType { O_EMPTY, O_STR, O_SYM, O_NUM, O_DEC, O_HEX, O_BIN, O_LIST, O_ATT class ConfValue { public: ConfType type; - union { char* strval; int numval; double decval; uint32_t unumval; std::list* configs; }; + union { std::string strval; int numval; double decval; uint32_t unumval; std::list* configs; }; ConfValue() : type(O_EMPTY), strval(NULL) {}; ConfValue(const ASTNode& s_expr_n); ConfValue(int i) : type(O_NUM), numval(i) {}; @@ -158,22 +151,14 @@ typedef struct SpPref { int t; } SpPref; typedef struct SpFormat { int t; } SpFormat; -struct ItpAlgorithm { int x; bool operator==(const ItpAlgorithm& o) const { return x == o.x; }}; -static const struct ItpAlgorithm itp_alg_mcmillan = { 0 }; -static const struct ItpAlgorithm itp_alg_pudlak = { 1 }; -static const struct ItpAlgorithm itp_alg_mcmillanp = { 2 }; -static const struct ItpAlgorithm itp_alg_ps = { 3 }; -static const struct ItpAlgorithm itp_alg_psw = { 4 }; -static const struct ItpAlgorithm itp_alg_pss = { 5 }; -static const struct ItpAlgorithm itp_euf_alg_strong = { 0 }; -static const struct ItpAlgorithm itp_euf_alg_weak = { 2 }; -static const struct ItpAlgorithm itp_euf_alg_random = { 3 }; -static const struct ItpAlgorithm itp_lra_alg_strong = { 0 }; -static const struct ItpAlgorithm itp_lra_alg_weak = { 2 }; -static const struct ItpAlgorithm itp_lra_alg_factor = { 3 }; -static const struct ItpAlgorithm itp_lra_alg_decomposing_strong = {4 }; -static const struct ItpAlgorithm itp_lra_alg_decomposing_weak = {5 }; -static const char *itp_lra_factor_0 = "1/2"; +enum class ItpAlgorithm { + itp_alg_mcmillan, itp_alg_pudlak, itp_alg_mcmillanp, + itp_alg_ps, itp_alg_psw, itp_alg_pss, itp_euf_alg_strong, + itp_euf_alg_weak, itp_euf_alg_random, itp_lra_alg_strong, + itp_lra_alg_weak, itp_lra_alg_factor, itp_lra_alg_decomposing_strong, + itp_lra_alg_decomposing_weak}; + +static const std::string itp_lra_factor_0 = "1/2"; inline bool operator==(const SpType& s1, const SpType& s2) { return s1.t == s2.t; } inline bool operator!=(const SpType& s1, const SpType& s2) { return s1.t != s2.t; } @@ -324,92 +309,58 @@ struct SMTConfig Info info_Empty; SMTOption option_Empty; - vec options; - vec option_names; - vec infos; - vec info_names; - Map > infoTable; - Map > optionTable; + std::vector options; + std::vector option_names; + std::vector infos; + std::unordered_map infoTable; + std::unordered_map optionTable; bool usedForInitialization = false; // Some options can be changed only before this config is used for initialization of MainSolver - bool isPreInitializationOption(const char* o_name) { - return strcmp(o_name, o_produce_inter) == 0 || strcmp(o_name, o_produce_proofs) == 0 - || strcmp(o_name, o_sat_pure_lookahead) == 0 || strcmp(o_name, o_sat_lookahead_split) == 0 - || strcmp(o_name, o_sat_scatter_split) == 0 - || strcmp(o_name, o_ghost_vars) == 0; + bool isPreInitializationOption(std::string const & o_name) { + return o_name == o_produce_inter or o_name == o_produce_proofs + or o_name == o_sat_pure_lookahead or o_name == o_sat_lookahead_split + or o_name == o_sat_scatter_split or o_name == o_ghost_vars; } - void insertOption(const char* o_name, SMTOption* o) { - options.push(o); - if (optionTable.has(o_name)) optionTable[o_name] = o; + void insertOption(std::string const & o_name, SMTOption* o) { + options.push_back(o); + if (optionTable.find(o_name) != optionTable.end()) optionTable[o_name] = o; else { - char* my_name = strdup(o_name); - option_names.push(my_name); - optionTable.insert(my_name, o); + option_names.push_back(o_name); + optionTable.insert({o_name, o}); } } - char* append_output_dir(const char* name) const + std::string append_output_dir(std::string const & name) const { - const char* path = output_dir(); + std::string path = output_dir(); // If output_dir() is not defined (or is empty), just return (copy of) name - if (strlen(path) == 0) - return strdup(name); - // Otherwise, use name but prepend output_dir. - char* tmp_name = strdup(name); - char* base = basename(tmp_name); - int full_length = strlen(base)+1+strlen(output_dir()); - char *full_str = (char*)malloc(full_length+1); - char* ptr = full_str; - for (unsigned int i = 0; i < strlen(path); i++) { - *ptr = path[i]; - ptr++; - } - (*ptr) = '/'; - ptr++; - for (unsigned int i = 0; i < strlen(base); i++) { - *ptr = base[i]; - ptr++; + if (path.empty()) { + return name; + } else { + return path + '/' + name; } - *ptr = '\0'; - free(tmp_name); - return full_str; } // // For standard executable // public: - SMTConfig(int argc, char* argv[]) : rocset(false), docset(false) { - initializeConfig( ); - // Parse command-line options - parseCMDLine( argc, argv ); - } // // For API // - SMTConfig () : rocset(false), docset(false) { + SMTConfig () { initializeConfig( ); } - ~SMTConfig ( ) - { - if ( produceStats() ) stats_out.close( ); - if ( rocset ) out.close( ); - if ( docset ) err.close( ); - for (int i = 0; i < options.size(); i++) - delete options[i]; - for (int i = 0; i < option_names.size(); i++) - free(option_names[i]); - for (int i = 0; i < infos.size(); i++) - delete infos[i]; - for (int i = 0; i < info_names.size(); i++) - free(info_names[i]); + ~SMTConfig () { + for (auto i : options) + delete i; } - bool setOption(const char* name, const SMTOption& value, const char*& msg); - const SMTOption& getOption(const char* name) const; + bool setOption(std::string const & name, const SMTOption& value, const char*& msg); + const SMTOption& getOption(std::string const & name) const; - bool setInfo (const char* name, const Info& value); - const Info& getInfo (const char* name) const; + bool setInfo (std::string && name, const Info& value); + const Info& getInfo (std::string const & name) const; void initializeConfig ( ); @@ -418,21 +369,18 @@ struct SMTConfig void printHelp ( ); void printConfig ( std::ostream & out ); - inline std::ostream & getStatsOut ( ) { assert( optionTable.has(o_produce_stats) ); return stats_out; } - inline std::ostream & getRegularOut ( ) { return rocset ? out : std::cout; } - inline std::ostream & getDiagnosticOut( ) { return docset ? err : std::cerr; } - inline int getRandomSeed ( ) const { return optionTable.has(o_random_seed) ? optionTable[o_random_seed]->getValue().numval : 91648253; } + inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed)->getValue().numval : 91648253; } inline void setProduceModels( ) { insertOption(o_produce_models, new SMTOption(1)); } inline bool setRandomSeed(int seed) { insertOption(o_random_seed, new SMTOption(seed)); return true; } void setUsedForInitiliazation() { usedForInitialization = true; } inline bool produceProof( ) { - return optionTable.has(o_produce_proofs) ? optionTable[o_produce_proofs]->getValue().numval > 0 : false; + return optionTable.find(o_produce_proofs) != optionTable.end() ? optionTable[o_produce_proofs]->getValue().numval > 0 : false; } void setTimeQueries() { insertOption(o_time_queries, new SMTOption(1)); } - bool timeQueries() { return optionTable.has(o_time_queries) ? optionTable[o_time_queries]->getValue().numval : false; } + bool timeQueries() { return optionTable.find(o_time_queries) != optionTable.end() ? optionTable[o_time_queries]->getValue().numval : false; } // Set reduction params inline void setReduction(int r) { insertOption(o_proof_reduce, new SMTOption(r)); } @@ -442,11 +390,11 @@ struct SMTConfig // Set interpolation algorithms inline void setBooleanInterpolationAlgorithm( ItpAlgorithm i ) { - insertOption(o_itp_bool_alg, new SMTOption(i.x)); } + insertOption(o_itp_bool_alg, new SMTOption(static_cast(i))); } - inline void setEUFInterpolationAlgorithm( ItpAlgorithm i ) { insertOption(o_itp_euf_alg, new SMTOption(i.x)); } + inline void setEUFInterpolationAlgorithm( ItpAlgorithm i ) { insertOption(o_itp_euf_alg, new SMTOption(static_cast(i))); } - inline void setLRAInterpolationAlgorithm( ItpAlgorithm i ) { insertOption(o_itp_lra_alg, new SMTOption(i.x)); } + inline void setLRAInterpolationAlgorithm( ItpAlgorithm i ) { insertOption(o_itp_lra_alg, new SMTOption(static_cast(i))); } inline void setLRAStrengthFactor(const char *factor) { insertOption(o_itp_lra_factor, new SMTOption(factor)); } @@ -454,230 +402,196 @@ struct SMTConfig // Get interpolation algorithms inline ItpAlgorithm getBooleanInterpolationAlgorithm() const { - if (optionTable.has(o_itp_bool_alg)) { return { optionTable[o_itp_bool_alg]->getValue().numval }; } - else { return itp_alg_mcmillan; }} - + return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg)->getValue().numval) + : ItpAlgorithm::itp_alg_mcmillan; + } inline ItpAlgorithm getEUFInterpolationAlgorithm() const { - if (optionTable.has(o_itp_euf_alg)) { return { optionTable[o_itp_euf_alg]->getValue().numval }; } - else { return itp_euf_alg_strong; }} + return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg)->getValue().numval) + : ItpAlgorithm::itp_euf_alg_strong; + } inline ItpAlgorithm getLRAInterpolationAlgorithm() const { - if (optionTable.has(o_itp_lra_alg)) { return { optionTable[o_itp_lra_alg]->getValue().numval }; } - else { return itp_lra_alg_strong; }} - - inline const char* getLRAStrengthFactor() const { - if (optionTable.has(o_itp_lra_factor)) { return optionTable[o_itp_lra_factor]->getValue().strval; } - else { return itp_lra_factor_0; } + return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg)->getValue().numval) + : ItpAlgorithm::itp_lra_alg_strong; } - inline const char* getInstanceName() const { - if (optionTable.has(o_inst_name)) { return optionTable[o_inst_name]->getValue().strval; } - else { return "unknown"; } + inline std::string getLRAStrengthFactor() const { + return optionTable.find(o_itp_lra_factor) != optionTable.end() ? optionTable.at( + o_itp_lra_factor)->getValue().strval : itp_lra_factor_0; } - inline void setRegularOutputChannel( const char * attr ) - { - if ( strcmp( attr, "stdout" ) != 0 && !rocset ) - { - out.open( attr ); - if( !out ) - throw std::ifstream::failure("can't open " + std::string(attr)); - rocset = true; - } - } - inline void setDiagnosticOutputChannel( const char * attr ) - { - if ( strcmp( attr, "stderr" ) != 0 && !rocset ) - { - err.open( attr ); - if( !err ) - throw std::ifstream::failure("can't open " + std::string(attr)); - rocset = true; - } + inline std::string getInstanceName() const { + return optionTable.find(o_inst_name) != optionTable.end() ? optionTable.at(o_inst_name)->getValue().strval : "unknown"; } lbool status; // Status of the benchmark // int incremental; // Incremental solving int isIncremental() const - { return optionTable.has(o_incremental) ? - optionTable[o_incremental]->getValue().numval == 1: true; } + { return optionTable.find(o_incremental) != optionTable.end() ? + optionTable.at(o_incremental)->getValue().numval == 1: true; } int produce_models() const { - return optionTable.has(o_produce_models) ? - optionTable[o_produce_models]->getValue().numval : + return optionTable.find(o_produce_models) != optionTable.end() ? + optionTable.at(o_produce_models)->getValue().numval : 1; } int produceStats() const - { return optionTable.has(o_produce_stats) ? - optionTable[o_produce_stats]->getValue().numval == 1: false; } - std::string getStatsOut() const - { return optionTable.has(o_stats_out) ? - optionTable[o_stats_out]->getValue().strval: "/dev/stdout"; } + { return optionTable.find(o_produce_stats) != optionTable.end() ? + optionTable.at(o_produce_stats)->getValue().numval == 1: false; } + std::string getStatsOut() const { + return optionTable.find(o_stats_out) != optionTable.end() ? optionTable.at(o_stats_out)->getValue().strval : "/dev/stdout"; + } int sat_grow() const - { return optionTable.has(o_grow) ? - optionTable[o_grow]->getValue().numval : 0; } + { return optionTable.find(o_grow) != optionTable.end() ? + optionTable.at(o_grow)->getValue().numval : 0; } int sat_clause_lim() const - { return optionTable.has(o_clause_lim) ? - optionTable[o_clause_lim]->getValue().numval : 20; } + { return optionTable.find(o_clause_lim) != optionTable.end() ? + optionTable.at(o_clause_lim)->getValue().numval : 20; } int sat_subsumption_lim() const - { return optionTable.has(o_subsumption_lim) ? - optionTable[o_subsumption_lim]->getValue().numval : 1000; } + { return optionTable.find(o_subsumption_lim) != optionTable.end() ? + optionTable.at(o_subsumption_lim)->getValue().numval : 1000; } double sat_simp_garbage_frac() const - { return optionTable.has(o_simp_garbage_frac) ? - optionTable[o_simp_garbage_frac]->getValue().decval : 0.5; } + { return optionTable.find(o_simp_garbage_frac) != optionTable.end() ? + optionTable.at(o_simp_garbage_frac)->getValue().decval : 0.5; } int sat_use_asymm() const - { return optionTable.has(o_use_asymm) ? - optionTable[o_use_asymm]->getValue().numval == 1: false; } + { return optionTable.find(o_use_asymm) != optionTable.end() ? + optionTable.at(o_use_asymm)->getValue().numval == 1: false; } int sat_use_rcheck() const - { return optionTable.has(o_use_rcheck) ? - optionTable[o_use_rcheck]->getValue().numval == 1: false; } + { return optionTable.find(o_use_rcheck) != optionTable.end() ? + optionTable.at(o_use_rcheck)->getValue().numval == 1: false; } int sat_use_elim() const - { return optionTable.has(o_use_elim) ? - optionTable[o_use_elim]->getValue().numval == 1: true; } + { return optionTable.find(o_use_elim) != optionTable.end() ? + optionTable.at(o_use_elim)->getValue().numval == 1: true; } double sat_var_decay() const - { return optionTable.has(o_var_decay) ? - optionTable[o_var_decay]->getValue().decval : 1 / 0.95; } + { return optionTable.find(o_var_decay) != optionTable.end() ? + optionTable.at(o_var_decay)->getValue().decval : 1 / 0.95; } double sat_clause_decay() const - { return optionTable.has(o_clause_decay) ? - optionTable[o_clause_decay]->getValue().decval : 1 / 0.999; } + { return optionTable.find(o_clause_decay) != optionTable.end() ? + optionTable.at(o_clause_decay)->getValue().decval : 1 / 0.999; } double sat_random_var_freq() const - { return optionTable.has(o_random_var_freq) ? - optionTable[o_random_var_freq]->getValue().decval : 0.02; } + { return optionTable.find(o_random_var_freq) != optionTable.end() ? + optionTable.at(o_random_var_freq)->getValue().decval : 0.02; } int sat_random_seed() const - { return optionTable.has(o_random_seed) ? - optionTable[o_random_seed]->getValue().decval : 91648253; } + { return optionTable.find(o_random_seed) != optionTable.end() ? + optionTable.at(o_random_seed)->getValue().decval : 91648253; } int sat_luby_restart() const - { return optionTable.has(o_luby_restart) ? - optionTable[o_luby_restart]->getValue().numval > 0 : 1; } + { return optionTable.find(o_luby_restart) != optionTable.end() ? + optionTable.at(o_luby_restart)->getValue().numval > 0 : 1; } int sat_ccmin_mode() const - { return optionTable.has(o_ccmin_mode) ? - optionTable[o_ccmin_mode]->getValue().numval : 2; } + { return optionTable.find(o_ccmin_mode) != optionTable.end() ? + optionTable.at(o_ccmin_mode)->getValue().numval : 2; } int sat_rnd_pol() const - { return optionTable.has(o_rnd_pol) ? - optionTable[o_rnd_pol]->getValue().numval > 0 : 0; } + { return optionTable.find(o_rnd_pol) != optionTable.end() ? + optionTable.at(o_rnd_pol)->getValue().numval > 0 : 0; } int sat_rnd_init_act() const - { return optionTable.has(o_rnd_init_act) ? - optionTable[o_rnd_init_act]->getValue().numval > 0 : 0; } + { return optionTable.find(o_rnd_init_act) != optionTable.end() ? + optionTable.at(o_rnd_init_act)->getValue().numval > 0 : 0; } double sat_garbage_frac() const - { return optionTable.has(o_garbage_frac) ? - optionTable[o_garbage_frac]->getValue().decval : 0.20; } + { return optionTable.find(o_garbage_frac) != optionTable.end() ? + optionTable.at(o_garbage_frac)->getValue().decval : 0.20; } int sat_restart_first() const - { return optionTable.has(o_restart_first) ? - optionTable[o_restart_first]->getValue().numval : 100; } + { return optionTable.find(o_restart_first) != optionTable.end() ? + optionTable.at(o_restart_first)->getValue().numval : 100; } double sat_restart_inc() const - { return optionTable.has(o_restart_inc) ? - optionTable[o_restart_inc]->getValue().numval : 1.1; } + { return optionTable.find(o_restart_inc) != optionTable.end() ? + optionTable.at(o_restart_inc)->getValue().numval : 1.1; } int proof_interpolant_cnf() const - { return optionTable.has(o_interpolant_cnf) ? - optionTable[o_interpolant_cnf]->getValue().numval : 0; } + { return optionTable.find(o_interpolant_cnf) != optionTable.end() ? + optionTable.at(o_interpolant_cnf)->getValue().numval : 0; } int certify_inter() const - { return optionTable.has(o_certify_inter) ? - optionTable[o_certify_inter]->getValue().numval : 0; } + { return optionTable.find(o_certify_inter) != optionTable.end() ? + optionTable.at(o_certify_inter)->getValue().numval : 0; } bool produce_inter() const - { return optionTable.has(o_produce_inter) ? - optionTable[o_produce_inter]->getValue().numval > 0 : false; } + { return optionTable.find(o_produce_inter) != optionTable.end() ? + optionTable.at(o_produce_inter)->getValue().numval > 0 : false; } int simplify_inter() const - { return optionTable.has(o_simplify_inter) ? - optionTable[o_simplify_inter]->getValue().numval : 0; } + { return optionTable.find(o_simplify_inter) != optionTable.end() ? + optionTable.at(o_simplify_inter)->getValue().numval : 0; } int proof_struct_hash() const - { return optionTable.has(o_proof_struct_hash) ? - optionTable[o_proof_struct_hash]->getValue().numval : 1; } + { return optionTable.find(o_proof_struct_hash) != optionTable.end() ? + optionTable.at(o_proof_struct_hash)->getValue().numval : 1; } int proof_num_graph_traversals() const - { return optionTable.has(o_proof_num_graph_traversals) ? - optionTable[o_proof_num_graph_traversals]->getValue().numval : 3; } + { return optionTable.find(o_proof_num_graph_traversals) != optionTable.end() ? + optionTable.at(o_proof_num_graph_traversals)->getValue().numval : 3; } int proof_red_trans() const - { return optionTable.has(o_proof_red_trans) ? - optionTable[o_proof_red_trans]->getValue().numval : 2; } + { return optionTable.find(o_proof_red_trans) != optionTable.end() ? + optionTable.at(o_proof_red_trans)->getValue().numval : 2; } int proof_rec_piv() const - { return optionTable.has(o_proof_rec_piv) ? - optionTable[o_proof_rec_piv]->getValue().numval : 1; } + { return optionTable.find(o_proof_rec_piv) != optionTable.end() ? + optionTable.at(o_proof_rec_piv)->getValue().numval : 1; } int proof_push_units() const - { return optionTable.has(o_proof_push_units) ? - optionTable[o_proof_push_units]->getValue().numval : 1; } + { return optionTable.find(o_proof_push_units) != optionTable.end() ? + optionTable.at(o_proof_push_units)->getValue().numval : 1; } int proof_transf_trav() const - { return optionTable.has(o_proof_transf_trav) ? - optionTable[o_proof_transf_trav]->getValue().numval : 1; } + { return optionTable.find(o_proof_transf_trav) != optionTable.end() ? + optionTable.at(o_proof_transf_trav)->getValue().numval : 1; } int proof_check() const - { return optionTable.has(o_proof_check) ? - optionTable[o_proof_check]->getValue().numval : 0; } + { return optionTable.find(o_proof_check) != optionTable.end() ? + optionTable.at(o_proof_check)->getValue().numval : 0; } int proof_multiple_inter() const - { return optionTable.has(o_proof_multiple_inter) ? - optionTable[o_proof_multiple_inter]->getValue().numval : 0; } + { return optionTable.find(o_proof_multiple_inter) != optionTable.end() ? + optionTable.at(o_proof_multiple_inter)->getValue().numval : 0; } int proof_alternative_inter() const - { return optionTable.has(o_proof_alternative_inter) ? - optionTable[o_proof_alternative_inter]->getValue().numval : 0; } + { return optionTable.find(o_proof_alternative_inter) != optionTable.end() ? + optionTable.at(o_proof_alternative_inter)->getValue().numval : 0; } int proof_reduce() const - { return optionTable.has(o_proof_reduce) ? - optionTable[o_proof_reduce]->getValue().numval : 0; } + { return optionTable.find(o_proof_reduce) != optionTable.end() ? + optionTable.at(o_proof_reduce)->getValue().numval : 0; } int itp_bool_alg() const - { return optionTable.has(o_itp_bool_alg) ? - optionTable[o_itp_bool_alg]->getValue().numval : 0; } + { return optionTable.find(o_itp_bool_alg) != optionTable.end() ? + optionTable.at(o_itp_bool_alg)->getValue().numval : 0; } int itp_euf_alg() const - { return optionTable.has(o_itp_euf_alg) ? - optionTable[o_itp_euf_alg]->getValue().numval : 0; } + { return optionTable.find(o_itp_euf_alg) != optionTable.end() ? + optionTable.at(o_itp_euf_alg)->getValue().numval : 0; } int itp_lra_alg() const - { return optionTable.has(o_itp_lra_alg) ? - optionTable[o_itp_lra_alg]->getValue().numval : 0; } + { return optionTable.find(o_itp_lra_alg) != optionTable.end() ? + optionTable.at(o_itp_lra_alg)->getValue().numval : 0; } int sat_dump_rnd_inter() const - { return optionTable.has(o_sat_dump_rnd_inter) ? - optionTable[o_sat_dump_rnd_inter]->getValue().numval : 2; } + { return optionTable.find(o_sat_dump_rnd_inter) != optionTable.end() ? + optionTable.at(o_sat_dump_rnd_inter)->getValue().numval : 2; } bool declarations_are_global() const { - return optionTable.has(o_global_declarations) ? optionTable[o_global_declarations]->getValue().numval > 0 : false; + return optionTable.find(o_global_declarations) != optionTable.end() ? optionTable.at(o_global_declarations)->getValue().numval > 0 : false; } SpUnit sat_resource_units() const { - if (optionTable.has(o_sat_resource_units)) { - const char* type = optionTable[o_sat_resource_units]->getValue().strval; - if (strcmp(type, spts_search_counter) == 0) + if (optionTable.find(o_sat_resource_units) != optionTable.end()) { + std::string type = optionTable.at(o_sat_resource_units)->getValue().strval; + if (type == spts_search_counter) { return SpUnit::search_counter; - else if (strcmp(type, spts_time) == 0) + } else if (type == spts_time) { return SpUnit::time; + } } return SpUnit::search_counter; } bool respect_logic_partitioning_hints() const - { return optionTable.has(o_respect_logic_partitioning_hints) ? - optionTable[o_respect_logic_partitioning_hints]->getValue().numval : 0; } + { return optionTable.find(o_respect_logic_partitioning_hints) != optionTable.end() ? + optionTable.at(o_respect_logic_partitioning_hints)->getValue().numval : 0; } double sat_resource_limit() const - { return optionTable.has(o_sat_resource_limit) ? - optionTable[o_sat_resource_limit]->getValue().getDoubleVal() : -1; } + { return optionTable.find(o_sat_resource_limit) != optionTable.end() ? + optionTable.at(o_sat_resource_limit)->getValue().getDoubleVal() : -1; } - char* dump_state() const - { - char* n; - if (optionTable.has(o_dump_state)) - n = strdup(optionTable[o_dump_state]->getValue().strval); - else { - const char* name = getInstanceName(); - int name_length = strlen(name)-strlen(".smt2"); - n = (char*)malloc(name_length+1); - for (int i = 0; i < name_length; i++) - n[i] = name[i]; - n[name_length] = '\0'; - } - char* name = append_output_dir(n); - free(n); - return name; - } - const char* output_dir() const - { - if (optionTable.has(o_output_dir)) - return optionTable[o_output_dir]->getValue().strval; - else - return ""; - } + std::string dump_state() const { + if (optionTable.find(o_dump_state) != optionTable.end()) { + return append_output_dir(optionTable.at(o_dump_state)->getValue().strval); + } else { + std::string name = getInstanceName(); + return name.substr(0, name.size() - strlen(".smt2")); + } + } + std::string output_dir() const { + return optionTable.find(o_output_dir) != optionTable.end() ? optionTable.at(o_output_dir)->getValue().strval : ""; + } int dump_only() const - { return optionTable.has(o_dump_only) ? - optionTable[o_dump_only]->getValue().numval : 0; } + { return optionTable.find(o_dump_only) != optionTable.end() ? optionTable.at(o_dump_only)->getValue().numval : 0; } bool dump_query() const - { return optionTable.has(o_dump_query) ? - optionTable[o_dump_query]->getValue().numval : 0; } + { return optionTable.find(o_dump_query) != optionTable.end() ? optionTable.at(o_dump_query)->getValue().numval : 0; } void set_dump_query_name(const char* dump_query_name) { - if (optionTable.has(o_dump_query_name)) { + if (optionTable.find(o_dump_query_name) != optionTable.end()) { delete optionTable[o_dump_query_name]; optionTable[o_dump_query_name] = new SMTOption(strdup(dump_query_name)); } @@ -686,26 +600,17 @@ struct SMTConfig } - char* dump_query_name() const - { - char* n; - if (optionTable.has(o_dump_query_name)) - n = strdup(optionTable[o_dump_query_name]->getValue().strval); - else { - return NULL; - } - char* name = append_output_dir(n); - free(n); - return name; - } + std::string dump_query_name() const { + return optionTable.find(o_dump_query_name) != optionTable.end() ? append_output_dir(optionTable.at(o_dump_query_name)->getValue().strval) : ""; + } int sat_dump_learnts() const - { return optionTable.has(o_sat_dump_learnts) ? - optionTable[o_sat_dump_learnts]->getValue().numval : 0; } + { return optionTable.find(o_sat_dump_learnts) != optionTable.end() ? + optionTable.at(o_sat_dump_learnts)->getValue().numval : 0; } bool sat_split_test_cube_and_conquer() const - { return optionTable.has(o_sat_split_test_cube_and_conquer) ? - optionTable[o_sat_split_test_cube_and_conquer]->getValue().numval : 0; } + { return optionTable.find(o_sat_split_test_cube_and_conquer) != optionTable.end() ? + optionTable.at(o_sat_split_test_cube_and_conquer)->getValue().numval : 0; } SpType sat_split_type() const { if (sat_lookahead_split()) { @@ -718,109 +623,110 @@ struct SMTConfig } SpUnit sat_split_units() const { - if (optionTable.has(o_sat_split_units)) { - const char* type = optionTable[o_sat_split_units]->getValue().strval; - if (strcmp(type, spts_search_counter) == 0) + if (optionTable.find(o_sat_split_units) != optionTable.end()) { + std::string type = optionTable.at(o_sat_split_units)->getValue().strval; + if (type == spts_search_counter) { return SpUnit::search_counter; - else if (strcmp(type, spts_time) == 0) + } else if (type == spts_time) { return SpUnit::time; + } } return SpUnit::search_counter; } double sat_split_inittune() const { - return optionTable.has(o_sat_split_inittune) ? - optionTable[o_sat_split_inittune]->getValue().getDoubleVal() : + return optionTable.find(o_sat_split_inittune) != optionTable.end() ? + optionTable.at(o_sat_split_inittune)->getValue().getDoubleVal() : -1; } double sat_split_midtune() const { - return optionTable.has(o_sat_split_midtune) ? - optionTable[o_sat_split_midtune]->getValue().getDoubleVal() : + return optionTable.find(o_sat_split_midtune) != optionTable.end() ? + optionTable.at(o_sat_split_midtune)->getValue().getDoubleVal() : -1; } int sat_split_num() const { - return optionTable.has(o_sat_split_num) ? - optionTable[o_sat_split_num]->getValue().numval : + return optionTable.find(o_sat_split_num) != optionTable.end() ? + optionTable.at(o_sat_split_num)->getValue().numval : 2; } int sat_split_fixvars() const { - return optionTable.has(o_sat_split_fix_vars) ? - optionTable[o_sat_split_fix_vars]->getValue().numval : + return optionTable.find(o_sat_split_fix_vars) != optionTable.end() ? + optionTable.at(o_sat_split_fix_vars)->getValue().numval : -1; } int sat_split_asap() const { - return optionTable.has(o_sat_split_asap) ? - optionTable[o_sat_split_asap]->getValue().numval : + return optionTable.find(o_sat_split_asap) != optionTable.end() ? + optionTable.at(o_sat_split_asap)->getValue().numval : 0; } int sat_lookahead_split() const { - return optionTable.has(o_sat_lookahead_split) ? - optionTable[o_sat_lookahead_split]->getValue().numval : + return optionTable.find(o_sat_lookahead_split) != optionTable.end() ? + optionTable.at(o_sat_lookahead_split)->getValue().numval : 0; } int sat_scatter_split() const { - return optionTable.has(o_sat_scatter_split) ? - optionTable[o_sat_scatter_split]->getValue().numval : + return optionTable.find(o_sat_scatter_split) != optionTable.end() ? + optionTable.at(o_sat_scatter_split)->getValue().numval : 0; } int sat_pure_lookahead() const { - return optionTable.has(o_sat_pure_lookahead) ? - optionTable[o_sat_pure_lookahead]->getValue().numval : + return optionTable.find(o_sat_pure_lookahead) != optionTable.end() ? + optionTable.at(o_sat_pure_lookahead)->getValue().numval : 0; } int lookahead_score_deep() const { - return optionTable.has(o_lookahead_score_deep) ? - optionTable[o_lookahead_score_deep]->getValue().numval : + return optionTable.find(o_lookahead_score_deep) != optionTable.end() ? + optionTable.at(o_lookahead_score_deep)->getValue().numval : 0; } int randomize_lookahead() const { - return optionTable.has(o_sat_split_randomize_lookahead) ? - optionTable[o_sat_split_randomize_lookahead]->getValue().numval : + return optionTable.find(o_sat_split_randomize_lookahead) != optionTable.end() ? + optionTable.at(o_sat_split_randomize_lookahead)->getValue().numval : 0; } int randomize_lookahead_bufsz() const { - return optionTable.has(o_sat_split_randomize_lookahead_buf) ? - optionTable[o_sat_split_randomize_lookahead_buf]->getValue().numval : + return optionTable.find(o_sat_split_randomize_lookahead_buf) != optionTable.end() ? + optionTable.at(o_sat_split_randomize_lookahead_buf)->getValue().numval : 1; } int remove_symmetries() const - { return optionTable.has(o_sat_remove_symmetries) ? - optionTable[o_sat_remove_symmetries]->getValue().numval : 0; } + { return optionTable.find(o_sat_remove_symmetries) != optionTable.end() ? + optionTable.at(o_sat_remove_symmetries)->getValue().numval : 0; } int dryrun() const - { return optionTable.has(o_dryrun) ? - optionTable[o_dryrun]->getValue().numval : 0; } + { return optionTable.find(o_dryrun) != optionTable.end() ? + optionTable.at(o_dryrun)->getValue().numval : 0; } void set_dryrun(bool b) { insertOption(o_dryrun, new SMTOption(b)); } SpPref sat_split_preference() const { - if (optionTable.has(o_sat_split_preference)) { - const char* type = optionTable[o_sat_split_preference]->getValue().strval; - if (strcmp(type, spprefs_tterm) == 0) return sppref_tterm; - if (strcmp(type, spprefs_blind) == 0) return sppref_blind; - if (strcmp(type, spprefs_bterm) == 0) return sppref_bterm; - if (strcmp(type, spprefs_rand) == 0) return sppref_rand; - if (strcmp(type, spprefs_noteq) == 0) return sppref_noteq; - if (strcmp(type, spprefs_eq) == 0) return sppref_eq; - if (strcmp(type, spprefs_tterm_neq) == 0) return sppref_tterm_neq; + if (optionTable.find(o_sat_split_preference) != optionTable.end()) { + std::string type = optionTable.at(o_sat_split_preference)->getValue().strval; + if (type == spprefs_tterm) return sppref_tterm; + if (type == spprefs_blind) return sppref_blind; + if (type == spprefs_bterm) return sppref_bterm; + if (type == spprefs_rand) return sppref_rand; + if (type == spprefs_noteq) return sppref_noteq; + if (type == spprefs_eq) return sppref_eq; + if (type == spprefs_tterm_neq) return sppref_tterm_neq; } - return sppref_blind; + return sppref_blind; } bool use_ghost_vars() const { - if (optionTable.has(o_ghost_vars)) { - return optionTable[o_ghost_vars]->getValue().numval != 0; + if (optionTable.find(o_ghost_vars) != optionTable.end()) { + return optionTable.at(o_ghost_vars)->getValue().numval != 0; } return false; } int do_substitutions() const - { return optionTable.has(o_do_substitutions) ? - optionTable[o_do_substitutions]->getValue().numval : 1; } + { return optionTable.find(o_do_substitutions) != optionTable.end()? + optionTable.at(o_do_substitutions)->getValue().numval : 1; } bool use_theory_polarity_suggestion() const { return sat_theory_polarity_suggestion != 0; } int sat_solver_limit() const - { return optionTable.has(o_sat_solver_limit) ? - optionTable[o_sat_solver_limit]->getValue().numval : 0; } + { return optionTable.find(o_sat_solver_limit) != optionTable.end() ? + optionTable.at(o_sat_solver_limit)->getValue().numval : 0; } bool sat_split_mode() const { - if (optionTable.has(o_sat_split_mode)) { - return optionTable[o_sat_split_mode]->getValue().numval != 0; + if (optionTable.find(o_sat_split_mode) != optionTable.end()) { + return optionTable.at(o_sat_split_mode)->getValue().numval != 0; } return false; } @@ -841,12 +747,12 @@ struct SMTConfig { return optionTable.has(o_verbosity) ? optionTable[o_verbosity]->getValue().numval : 2; } #else - { return optionTable.has(o_verbosity) ? - optionTable[o_verbosity]->getValue().numval : 0; } + { return optionTable.find(o_verbosity) != optionTable.end() ? + optionTable.at(o_verbosity)->getValue().numval : 0; } #endif int printSuccess() const - { return optionTable.has(":print-success") ? - optionTable[":print-success"]->getValue().numval == 1: false; } + { return optionTable.find(":print-success") != optionTable.end() ? + optionTable.at(":print-success")->getValue().numval == 1: false; } int certification_level; // Level of certification char certifying_solver[256]; // Executable used for certification diff --git a/src/parsers/smt2new/smt2newlexer.ll b/src/parsers/smt2new/smt2newlexer.ll index bcbc7851..46e0a626 100644 --- a/src/parsers/smt2new/smt2newlexer.ll +++ b/src/parsers/smt2new/smt2newlexer.ll @@ -100,43 +100,43 @@ using namespace osmttokens; "simplify" { yyget_lval(yyscanner)->tok = { t_simplify }; return TK_SIMPLIFY; } "echo" { yyget_lval(yyscanner)->tok = { t_echo }; return TK_ECHO; } -":sorts" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_SORTS; } -":funs" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_FUNS; } -":sorts-description" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_SORTSDESCRIPTION; } -":funs-description" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_FUNSDESCRIPTION; } -":definition" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_DEFINITION; } -":values" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_VALUES; } -":notes" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_NOTES; } -":theories" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_THEORIES; } -":extensions" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_EXTENSIONS; } -":print-success" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRINTSUCCESS; } -":expand-definitions" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_EXPANDDEFINITIONS; } -":interactive-mode" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_INTERACTIVEMODE; } -":produce-proofs" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRODUCEPROOFS; } -":produce-unsat-cores" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRODUCEUNSATCORES; } -":produce-models" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRODUCEMODELS; } -":produce-assignments" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRODUCEASSIGNMENTS; } -":regular-output-channel" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_REGULAROUTPUTCHANNEL; } -":diagnostic-output-channel" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_DIAGNOSTICOUTPUTCHANNEL; } -":random-seed" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_RANDOMSEED; } -":verbosity" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_VERBOSITY; } -":error-behavior" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_ERRORBEHAVIOR; } -":name" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_NAME; } -":named" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_NAMED; } -":authors" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_AUTHORS; } -":version" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_VERSION; } -":status" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_STATUS; } -":reason-unknown" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_REASONUNKNOWN; } -":all-statistics" { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_ALLSTATISTICS; } - - -0|-?[1-9][0-9]*(\/[1-9][0-9]*)? { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_NUM; } --?[0-9]+\.0*[0-9]+ { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_DEC; } -#x[0-9a-fA-F]+ { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_HEX; } -#b[01]+ { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_BIN; } - -[a-zA-Z~!@\$\%\^&\*\-\+=\<\>\.\?\/'_][a-zA-Z0-9~!@\$\%\^&\*_\-\+=\<\>\.\?\/']* { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_SYM; } -\:[a-zA-Z0-9~!@\$\%\^&\*_\-\+=\<\>\.\?\/]+ { yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_KEY; } +":sorts" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_SORTS; } +":funs" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_FUNS; } +":sorts-description" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_SORTSDESCRIPTION; } +":funs-description" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_FUNSDESCRIPTION; } +":definition" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_DEFINITION; } +":values" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_VALUES; } +":notes" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_NOTES; } +":theories" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_THEORIES; } +":extensions" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_EXTENSIONS; } +":print-success" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_PRINTSUCCESS; } +":expand-definitions" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_EXPANDDEFINITIONS; } +":interactive-mode" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_INTERACTIVEMODE; } +":produce-proofs" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_PRODUCEPROOFS; } +":produce-unsat-cores" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_PRODUCEUNSATCORES; } +":produce-models" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_PRODUCEMODELS; } +":produce-assignments" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_PRODUCEASSIGNMENTS; } +":regular-output-channel" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_REGULAROUTPUTCHANNEL; } +":diagnostic-output-channel" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_DIAGNOSTICOUTPUTCHANNEL; } +":random-seed" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_RANDOMSEED; } +":verbosity" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_VERBOSITY; } +":error-behavior" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_ERRORBEHAVIOR; } +":name" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_NAME; } +":named" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_NAMED; } +":authors" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_AUTHORS; } +":version" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_VERSION; } +":status" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_STATUS; } +":reason-unknown" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_REASONUNKNOWN; } +":all-statistics" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_ALLSTATISTICS; } + + +0|-?[1-9][0-9]*(\/[1-9][0-9]*)? { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_NUM; } +-?[0-9]+\.0*[0-9]+ { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_DEC; } +#x[0-9a-fA-F]+ { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_HEX; } +#b[01]+ { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_BIN; } + +[a-zA-Z~!@\$\%\^&\*\-\+=\<\>\.\?\/'_][a-zA-Z0-9~!@\$\%\^&\*_\-\+=\<\>\.\?\/']* { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_SYM; } +\:[a-zA-Z0-9~!@\$\%\^&\*_\-\+=\<\>\.\?\/]+ { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_KEY; } [()] { return *yyget_text(yyscanner); } @@ -149,7 +149,7 @@ using namespace osmttokens; \\\" { yyextra->insertBuf('"'); } \\\\ { yyextra->insertBuf('\\'); } [^\\\n\"] { yyextra->insertBuf(yyget_text(yyscanner)[0]); } - \" { yylval->str = strdup(yyextra->getBuf()); yyextra->clearBuf(); + \" { yylval->str = new std::string(yyextra->getBuf()); yyextra->clearBuf(); yy_pop_state(yyscanner); return TK_STR; } } @@ -160,7 +160,7 @@ using namespace osmttokens; [\t] { yyextra->insertBuf('\t'); } \n { yyextra->insertBuf('\n'); } [^ \t\n\\\|] { yyextra->insertBuf(yyget_text(yyscanner)[0]); } - \| { yylval->str = strdup(yyextra->getBuf()); yyextra->clearBuf(); + \| { yylval->str = new std::string(yyextra->getBuf()); yyextra->clearBuf(); yy_pop_state(yyscanner); return TK_QSYM; } \\ { printf("Syntax error at line %d near %s, \\ not allowed inside | ... |\n", yyget_lineno(yyscanner), yyget_text(yyscanner)); exit(1); } } diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index b9dd3bd6..77600336 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -64,16 +64,14 @@ void smt2newerror( YYLTYPE* locp, Smt2newContext* context, const char * s ) %union { - char * str; + std::string * str; ASTNode * snode; - std::vector< ASTNode * > * snode_list; + std::vector * snode_list; osmttokens::smt2token tok; } %destructor { free($$); } %destructor { delete $$; } -%destructor { if ($$) { for (auto node : *$$) { delete node; } delete $$; }} - %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %token TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO @@ -93,255 +91,215 @@ void smt2newerror( YYLTYPE* locp, Smt2newContext* context, const char * s ) %% -script: command_list { ASTNode *n = new ASTNode(CMDL_T, strdup("main-script")); n->children = $1; context->insertRoot(n); }; +script: command_list { ASTNode *n = new ASTNode(ASTType::CMDL_T, {osmttokens::t_none}, "main-script", std::move(*$1)); context->insertRoot(n); }; symbol: TK_SYM - { $$ = new ASTNode(SYM_T, $1); } + { $$ = new ASTNode(ASTType::SYM_T, {osmttokens::t_none}, std::move(*$1)); } | TK_QSYM - { $$ = new ASTNode(QSYM_T, $1); } + { $$ = new ASTNode(ASTType::QSYM_T, {osmttokens::t_none}, std::move(*$1)); } ; command_list: - { $$ = new std::vector(); } + { $$ = new std::vector(); } | command_list command - { (*$1).push_back($2); $$ = $1; } + { (*$1).push_back(std::move(*$2)); $$ = $1; } ; command: '(' TK_SETLOGIC symbol ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); } | '(' TK_SETOPTION option ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); } | '(' TK_SETINFO attribute ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); } | '(' TK_DECLARESORT symbol TK_NUM ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); - $$->children->push_back(new ASTNode(NUM_T, $4)); + $$ = new ASTNode(ASTType::CMD_T, + $2, + "", + std::vector{std::move(*$3), + ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$4))}); } | '(' TK_DEFINESORT symbol '(' symbol_list ')' sort ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); - - ASTNode* syml = new ASTNode(SYML_T, NULL); - syml->children = $5; - $$->children->push_back(syml); - - $$->children->push_back($7); + $$ = new ASTNode(ASTType::CMD_T, $2, "", + std::vector{ + std::move(*$3), + ASTNode(ASTType::SYML_T, {osmttokens::t_none}, "", std::move(*$5)), + std::move(*$7)}); } | '(' TK_DECLAREFUN symbol '(' sort_list ')' sort ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); - - ASTNode* sortl = new ASTNode(SORTL_T, NULL); - sortl->children = $5; - $$->children->push_back(sortl); - - $$->children->push_back($7); + $$ = new ASTNode(ASTType::CMD_T, $2, "", + std::vector{std::move(*$3), + ASTNode(ASTType::SORTL_T, {osmttokens::t_none}, "", std::move(*$5)), + std::move(*$7)}); } | '(' TK_DECLARECONST const_val sort ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); - - ASTNode* sortl = new ASTNode(SORTL_T, NULL); - sortl->children = new std::vector(); - $$->children->push_back(sortl); - - $$->children->push_back($4); + // todo: drop the second child? + $$ = new ASTNode(ASTType::CMD_T, $2, "", + std::vector{std::move(*$3), ASTNode(ASTType::SORTL_T), std::move(*$4)}); } | '(' TK_DEFINEFUN symbol '(' sorted_var_list ')' sort term ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); - - ASTNode* svl = new ASTNode(SVL_T, NULL); - svl->children = $5; - $$->children->push_back(svl); - - $$->children->push_back($7); - $$->children->push_back($8); + $$ = new ASTNode(ASTType::CMD_T, $2, "", + std::vector{std::move(*$3), + ASTNode(ASTType::SVL_T, {osmttokens::t_none}, "", std::move(*$5)), + std::move(*$7), + std::move(*$8)}); } | '(' TK_PUSH TK_NUM ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(NUM_T, $3)); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$3))}); } | '(' TK_POP TK_NUM ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(NUM_T, $3)); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$3))}); } | '(' TK_ASSERT term ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); } | '(' TK_CHECKSAT ')' { - $$ = new ASTNode(CMD_T, $2); + $$ = new ASTNode(ASTType::CMD_T, $2); } | '(' TK_GETASSERTIONS ')' { - $$ = new ASTNode(CMD_T, $2); + $$ = new ASTNode(ASTType::CMD_T, $2); } | '(' TK_GETPROOF ')' { - $$ = new ASTNode(CMD_T, $2); + $$ = new ASTNode(ASTType::CMD_T, $2); } | '(' TK_GETITPS term_list ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = $3; + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::move(*$3)); } | '(' TK_WRSTATE TK_STR ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(UATTR_T, $3)); + // todo: consider inserting the TK_STR to the string? + // todo: TK_{WR,RD}STATE and TK_WRFUNS is not implemented and is not part of the standard + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); } | '(' TK_RDSTATE TK_STR ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(UATTR_T, $3)); + // todo: consider inserting the TK_STR to the string? + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); } | '(' TK_WRFUNS TK_STR ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(UATTR_T, $3)); + // todo: consider inserting the TK_STR to the string? + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); } | '(' TK_GETUNSATCORE ')' { - $$ = new ASTNode(CMD_T, $2); + $$ = new ASTNode(ASTType::CMD_T, $2); } | '(' TK_GETVALUE '(' term term_list ')' ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = $5; - $$->children->insert($$->children->begin(), $4); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$5)}); + $$->children.insert($$->children.begin(), std::move(*$4)); } | '(' TK_GETMODEL ')' { - $$ = new ASTNode(CMD_T, $2); + $$ = new ASTNode(ASTType::CMD_T, $2); } | '(' TK_GETASSIGNMENT ')' { - $$ = new ASTNode(CMD_T, $2); + $$ = new ASTNode(ASTType::CMD_T, $2); } | '(' TK_GETOPTION TK_KEY ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(UATTR_T, $3)); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); } | '(' TK_GETOPTION predef_key ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(PATTR_T, $3)); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::PATTR_T, {osmttokens::t_none}, std::move(*$3))}); } | '(' TK_GETINFO info_flag ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back($3); + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); } | '(' TK_SIMPLIFY ')' { - $$ = new ASTNode(CMD_T, $2); + $$ = new ASTNode(ASTType::CMD_T, $2); } | '(' TK_EXIT ')' - { $$ = new ASTNode(CMD_T, $2); } + { $$ = new ASTNode(ASTType::CMD_T, $2); } | '(' TK_ECHO TK_STR ')' { - $$ = new ASTNode(CMD_T, $2); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(UATTR_T, $3)); + // todo: consider using ASTNode's string instead of vector + $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); } ; attribute_list: - { $$ = new std::vector(); } + { $$ = new std::vector(); } | attribute_list attribute - { $1->push_back($2); $$ = $1; } + { $1->push_back(std::move(*$2)); $$ = $1; } ; attribute: TK_KEY - { $$ = new ASTNode(UATTR_T, $1); } + { $$ = new ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$1)); } | TK_KEY attribute_value - { $$ = new ASTNode(UATTR_T, $1); $$->children = new std::vector(); $$->children->push_back($2); } + { $$ = new ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } | predef_key - { $$ = new ASTNode(PATTR_T, $1); } + { $$ = new ASTNode(ASTType::PATTR_T, {osmttokens::t_none}, std::move(*$1)); } | predef_key attribute_value - { $$ = new ASTNode(PATTR_T, $1); $$->children = new std::vector(); $$->children->push_back($2); } + { $$ = new ASTNode(ASTType::PATTR_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } ; attribute_value: spec_const - { $$ = new ASTNode(SPECC_T, NULL); $$->children = new std::vector(); $$->children->push_back($1); } + { $$ = new ASTNode(ASTType::SPECC_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); } | symbol { $$ = $1; } | '(' s_expr_list ')' { - $$ = new ASTNode(SEXPRL_T, NULL); - $$->children = $2; + $$ = new ASTNode(ASTType::SEXPRL_T, {osmttokens::t_none}, "", std::vector{std::move(*$2)}); } ; identifier: symbol { $$ = $1; } | '(' '_' symbol numeral_list ')' - { $$ = $3; $$->children = $4; } + { + $$ = $3; + for (auto & el : *$4) { + $$->children.emplace_back(std::move(el)); + } + } ; sort: identifier { $$ = $1; } | '(' identifier sort sort_list ')' { - $$ = new ASTNode(LID_T, NULL); - $$->children = $4; - $$->children->insert($$->children->begin(), $3); - $$->children->insert($$->children->begin(), $2); + $$ = new ASTNode(ASTType::LID_T, {osmttokens::t_none}, "", std::vector{std::move(*$2), std::move(*$3)}); + for (auto & c : *$4) { + $$->children.push_back(std::move(c)); + } } ; sort_list: sort_list sort - { $1->push_back($2); $$ = $1; } + { $1->push_back(std::move(*$2)); $$ = $1; } | - { $$ = new std::vector(); } + { $$ = new std::vector(); } ; s_expr: spec_const { - $$ = new ASTNode(SPECC_T, NULL); - $$->children = new std::vector(); - $$->children->push_back($1); + $$ = new ASTNode(ASTType::SPECC_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); } | symbol { @@ -349,37 +307,36 @@ s_expr: spec_const } | TK_KEY { - $$ = new ASTNode(UATTR_T, $1); + $$ = new ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$1)); } | '(' s_expr_list ')' { - $$ = new ASTNode(SEXPRL_T, NULL); - $$->children = $2; + $$ = new ASTNode(ASTType::SEXPRL_T, {osmttokens::t_none}, "", std::move(*$2)); } ; s_expr_list: { - $$ = new std::vector(); + $$ = new std::vector(); } | s_expr_list s_expr { - $1->push_back($2); + $1->push_back(std::move(*$2)); $$ = $1; } ; spec_const: TK_NUM - { $$ = new ASTNode(NUM_T, $1); } + { $$ = new ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$1)); } | TK_DEC - { $$ = new ASTNode(DEC_T, $1); } + { $$ = new ASTNode(ASTType::DEC_T, {osmttokens::t_none}, std::move(*$1)); } | TK_HEX - { $$ = new ASTNode(HEX_T, $1); } + { $$ = new ASTNode(ASTType::HEX_T, {osmttokens::t_none}, std::move(*$1)); } | TK_BIN - { $$ = new ASTNode(BIN_T, $1); } + { $$ = new ASTNode(ASTType::BIN_T, {osmttokens::t_none}, std::move(*$1)); } | TK_STR - { $$ = new ASTNode(STR_T, $1); } + { $$ = new ASTNode(ASTType::STR_T, {osmttokens::t_none}, std::move(*$1)); } ; const_val: symbol @@ -389,114 +346,90 @@ const_val: symbol ; numeral_list: numeral_list TK_NUM - { $1->push_back(new ASTNode(NUM_T, $2)); $$ = $1; } + { $1->push_back(ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$2))); $$ = $1; } | TK_NUM - { $$ = new std::vector(); $$->push_back(new ASTNode(NUM_T, $1)); } + { $$ = new std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$1))}; } ; qual_identifier: identifier { $$ = $1; } | '(' TK_AS identifier sort ')' { - $$ = new ASTNode(AS_T, NULL); - $$->children = new std::vector(); - $$->children->push_back($3); - $$->children->push_back($4); + $$ = new ASTNode(ASTType::AS_T, {osmttokens::t_none}, "", std::vector{std::move(*$3), std::move(*$4)}); } ; -var_binding_list: - { $$ = new std::vector(); } +var_binding_list: var_binding + { $$ = new std::vector{std::move(*$1)}; } | var_binding_list var_binding - { $1->push_back($2); $$ = $1; } + { $1->push_back(std::move(*$2)); $$ = $1; } ; var_binding: '(' symbol term ')' - { $$ = new ASTNode(VARB_T, strdup($2->getValue())); delete $2; $$->children = new std::vector(); $$->children->push_back($3); } + { $$ = new ASTNode(ASTType::VARB_T, {osmttokens::t_none}, std::string($2->getValue()), std::vector{std::move(*$3)}); } ; sorted_var_list: - { $$ = new std::vector(); } + { $$ = new std::vector(); } | sorted_var_list sorted_var - { $1->push_back($2); $$ = $1; } + { $1->push_back(std::move(*$2)); $$ = $1; } ; sorted_var: '(' symbol sort ')' - { $$ = new ASTNode(SV_T, strdup($2->getValue())); delete $2; $$->children = new std::vector(); $$->children->push_back($3); } + { $$ = new ASTNode(ASTType::SV_T, {osmttokens::t_none}, std::string($2->getValue()), std::vector{std::move(*$3)}); } term_list: - { $$ = new std::vector(); } + { $$ = new std::vector(); } | term_list term - { $1->push_back($2); $$ = $1; } + { $1->push_back(std::move(*$2)); $$ = $1; } ; term: spec_const - { $$ = new ASTNode(TERM_T, NULL); $$->children = new std::vector(); $$->children->push_back($1); } + { $$ = new ASTNode(ASTType::TERM_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); } | qual_identifier - { $$ = new ASTNode(QID_T, NULL); $$->children = new std::vector(); $$->children->push_back($1); } + { $$ = new ASTNode(ASTType::QID_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); } | '(' qual_identifier term term_list ')' { - $$ = new ASTNode(LQID_T, NULL); - $$->children = $4; - $$->children->insert($$->children->begin(), $3); - $$->children->insert($$->children->begin(), $2); - } - | '(' TK_LET '(' var_binding var_binding_list ')' term ')' - { - $$ = new ASTNode(LET_T, NULL); - $$->children = new std::vector(); - $5->insert($5->begin(), $4); - ASTNode* vbl = new ASTNode(VARBL_T, NULL); - vbl->children = $5; - $$->children->push_back(vbl); - $$->children->push_back($7); - } - | '(' TK_FORALL '(' sorted_var sorted_var_list ')' term ')' - { - $$ = new ASTNode(FORALL_T, NULL); - $$->children = new std::vector(); - $5->insert($5->begin(), $4); - ASTNode* svl = new ASTNode(SVL_T, NULL); - svl->children = $5; - $$->children->push_back(svl); - $$->children->push_back($7); - } - | '(' TK_EXISTS '(' sorted_var sorted_var_list ')' term ')' - { - $$ = new ASTNode(EXISTS_T, NULL); - $$->children = new std::vector(); - $5->insert($5->begin(), $4); - ASTNode* svl = new ASTNode(SVL_T, NULL); - svl->children = $5; - $$->children->push_back(svl); - $$->children->push_back($7); - } - | '(' '!' term attribute attribute_list ')' - { - $$ = new ASTNode(BANG_T, NULL); - $$->children = new std::vector(); - $$->children->push_back($3); - ASTNode *atrs = new ASTNode(GATTRL_T, NULL); - $5->insert($5->begin(), $4); - atrs->children = $5; - $$->children->push_back(atrs); + $$ = new ASTNode(ASTType::LQID_T, {osmttokens::t_none}, "", std::vector{std::move(*$2), std::move(*$3)}); + for (auto & c : (*$4)) { + $$->children.push_back(std::move(c)); + } + } + | '(' TK_LET '(' var_binding_list ')' term ')' + { + $$ = new ASTNode(ASTType::LET_T, {osmttokens::t_none}, "", {ASTNode(ASTType::VARBL_T, {osmttokens::t_none}, "", std::move(*$4)), std::move(*$6)}); + } + | '(' TK_FORALL '(' sorted_var_list ')' term ')' + { + // todo: AST traversal must ensure that sorted_var_list is non-empty + $$ = new ASTNode(ASTType::FORALL_T, {osmttokens::t_none}, "", {ASTNode(ASTType::SVL_T, {osmttokens::t_none}, "", std::move(*$4)), std::move(*$6)}); + } + | '(' TK_EXISTS '(' sorted_var_list ')' term ')' + { + // todo: AST traversal must ensure that sorted_var_list is non-empty + $$ = new ASTNode(ASTType::EXISTS_T, {osmttokens::t_none}, "", {ASTNode(ASTType::SVL_T, {osmttokens::t_none}, "", std::move(*$4)), std::move(*$6)}); + } + | '(' '!' term attribute_list ')' + { + // todo: AST traversal must ensure that attribute_list is non-empty + $$ = new ASTNode(ASTType::BANG_T, {osmttokens::t_none}, "", {std::move(*$3), ASTNode(ASTType::GATTRL_T, {osmttokens::t_none}, "", std::move(*$4))}); } ; symbol_list: - { $$ = new std::vector(); } + { $$ = new std::vector(); } | symbol_list symbol - { $1->push_back($2); $$ = $1; } + { $1->push_back(*$2); $$ = $1; } ; b_value: symbol { - const char * str = $1->getValue(); - if (strcmp(str, "true") == 0 or strcmp(str, "false") == 0) { - $$ = new ASTNode(BOOL_T, strdup($1->getValue())); delete $1; + std::string const & str = $1->getValue(); + if (str == "true" or str == "false") { + $$ = new ASTNode(ASTType::BOOL_T, {osmttokens::t_none}, std::string(str)); delete $1; } else { - printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", str); + printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", str.c_str()); delete $1; YYERROR; } @@ -505,75 +438,51 @@ b_value: symbol option: KW_PRINTSUCCESS b_value { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back($2); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } | KW_EXPANDDEFINITIONS b_value { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back($2); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } | KW_INTERACTIVEMODE b_value { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back($2); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } | KW_PRODUCEPROOFS b_value { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back($2); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } | KW_PRODUCEUNSATCORES b_value { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back($2); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } | KW_PRODUCEMODELS b_value { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back($2); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } | KW_PRODUCEASSIGNMENTS b_value { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back($2); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } | KW_REGULAROUTPUTCHANNEL TK_STR { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(STR_T, $2)); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{ASTNode(ASTType::STR_T, {osmttokens::t_none}, std::move(*$2))}); } | KW_DIAGNOSTICOUTPUTCHANNEL TK_STR { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(STR_T, $2)); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{ASTNode(ASTType::STR_T, {osmttokens::t_none}, std::move(*$2))}); } | KW_RANDOMSEED TK_NUM { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(NUM_T, $2)); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$2))}); } | KW_VERBOSITY TK_NUM { - $$ = new ASTNode(OPTION_T, $1); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(NUM_T, $2)); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$2))}); } | attribute { - $$ = new ASTNode(OPTION_T, NULL); - $$->children = new std::vector(); - $$->children->push_back($1); + $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); } ; @@ -636,25 +545,21 @@ predef_key: KW_SORTS ; info_flag: KW_ERRORBEHAVIOR - { $$ = new ASTNode(INFO_T, $1); } + { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } | KW_NAME - { $$ = new ASTNode(INFO_T, $1); } + { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } | KW_AUTHORS - { $$ = new ASTNode(INFO_T, $1); } + { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } | KW_VERSION - { $$ = new ASTNode(INFO_T, $1); } + { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } | KW_STATUS - { $$ = new ASTNode(INFO_T, $1); } + { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } | KW_REASONUNKNOWN - { $$ = new ASTNode(INFO_T, $1); } + { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } | KW_ALLSTATISTICS - { $$ = new ASTNode(INFO_T, $1); } + { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } | TK_KEY - { - $$ = new ASTNode(INFO_T, NULL); - $$->children = new std::vector(); - $$->children->push_back(new ASTNode(GATTR_T, $1)); - } + { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, "", std::vector{ASTNode(ASTType::GATTR_T, {osmttokens::t_none}, std::move(*$1))}); } ; %% diff --git a/src/proof/InterpolationContext.cc b/src/proof/InterpolationContext.cc index 37a257b0..48da52e5 100644 --- a/src/proof/InterpolationContext.cc +++ b/src/proof/InterpolationContext.cc @@ -189,17 +189,17 @@ class SingleInterpolationComputationContext { void checkInterAlgo() const; - bool usingMcMillanInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_mcmillan; } + bool usingMcMillanInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_mcmillan; } - bool usingPudlakInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_pudlak; } + bool usingPudlakInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_pudlak; } - bool usingMcMillanPrimeInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_mcmillanp; } + bool usingMcMillanPrimeInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_mcmillanp; } - bool usingPSInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_ps; } + bool usingPSInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_ps; } - bool usingPSWInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_psw; } + bool usingPSWInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_psw; } - bool usingPSSInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_pss; } + bool usingPSSInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_pss; } int verbose() const { return config.verbosity(); } @@ -211,7 +211,7 @@ class SingleInterpolationComputationContext { bool needProofStatistics() const { ItpAlgorithm ia = config.getBooleanInterpolationAlgorithm(); - return ((ia == itp_alg_ps) or (ia == itp_alg_psw) or (ia == itp_alg_pss)); + return ((ia == ItpAlgorithm::itp_alg_ps) or (ia == ItpAlgorithm::itp_alg_psw) or (ia == ItpAlgorithm::itp_alg_pss)); } bool verifyPartialInterpolant(ProofNode const &); diff --git a/src/proof/InterpolationContext.h b/src/proof/InterpolationContext.h index 5a93940c..6d7dec0d 100644 --- a/src/proof/InterpolationContext.h +++ b/src/proof/InterpolationContext.h @@ -55,19 +55,19 @@ class InterpolationContext { int verbose() const { return config.verbosity(); } - bool usingMcMillanInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_mcmillan; } + bool usingMcMillanInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_mcmillan; } - bool usingPudlakInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_pudlak; } + bool usingPudlakInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_pudlak; } bool usingMcMillanPrimeInterpolation() const { - return config.getBooleanInterpolationAlgorithm() == itp_alg_mcmillanp; + return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_mcmillanp; } - bool usingPSInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_ps; } + bool usingPSInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_ps; } - bool usingPSWInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_psw; } + bool usingPSWInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_psw; } - bool usingPSSInterpolation() const { return config.getBooleanInterpolationAlgorithm() == itp_alg_pss; } + bool usingPSSInterpolation() const { return config.getBooleanInterpolationAlgorithm() == ItpAlgorithm::itp_alg_pss; } bool enabledInterpVerif() const { return (config.certify_inter() >= 1); } }; diff --git a/src/tsolvers/egraph/UFInterpolator.h b/src/tsolvers/egraph/UFInterpolator.h index a0ac0074..63fe6ca6 100644 --- a/src/tsolvers/egraph/UFInterpolator.h +++ b/src/tsolvers/egraph/UFInterpolator.h @@ -151,9 +151,9 @@ class UFInterpolator : public TheoryInterpolator { icolor_t resolveABColor() const; - bool usingStrong() const { return config.getEUFInterpolationAlgorithm() == itp_euf_alg_strong; } - bool usingWeak() const { return config.getEUFInterpolationAlgorithm() == itp_euf_alg_weak; } - bool usingRandom() const { return config.getEUFInterpolationAlgorithm() == itp_euf_alg_random; } + bool usingStrong() const { return config.getEUFInterpolationAlgorithm() == ItpAlgorithm::itp_euf_alg_strong; } + bool usingWeak() const { return config.getEUFInterpolationAlgorithm() == ItpAlgorithm::itp_euf_alg_weak; } + bool usingRandom() const { return config.getEUFInterpolationAlgorithm() == ItpAlgorithm::itp_euf_alg_random; } bool getSubpaths(const path_t &, path_t &, path_t &, path_t &); diff --git a/src/tsolvers/lasolver/LASolver.cc b/src/tsolvers/lasolver/LASolver.cc index 185a70ce..1ee40f79 100644 --- a/src/tsolvers/lasolver/LASolver.cc +++ b/src/tsolvers/lasolver/LASolver.cc @@ -805,11 +805,11 @@ bool LASolver::isModelInteger(LVRef v) const PTRef LASolver::interpolateUsingEngine(FarkasInterpolator & interpolator) const { auto itpAlgorithm = config.getLRAInterpolationAlgorithm(); - if (itpAlgorithm == itp_lra_alg_strong) { return interpolator.getFarkasInterpolant(); } - else if (itpAlgorithm == itp_lra_alg_weak) { return interpolator.getDualFarkasInterpolant(); } - else if (itpAlgorithm == itp_lra_alg_factor) { return interpolator.getFlexibleInterpolant(opensmt::Real(config.getLRAStrengthFactor())); } - else if (itpAlgorithm == itp_lra_alg_decomposing_strong) { return interpolator.getDecomposedInterpolant(); } - else if (itpAlgorithm == itp_lra_alg_decomposing_weak) { return interpolator.getDualDecomposedInterpolant(); } + if (itpAlgorithm == ItpAlgorithm::itp_lra_alg_strong) { return interpolator.getFarkasInterpolant(); } + else if (itpAlgorithm == ItpAlgorithm::itp_lra_alg_weak) { return interpolator.getDualFarkasInterpolant(); } + else if (itpAlgorithm == ItpAlgorithm::itp_lra_alg_factor) { return interpolator.getFlexibleInterpolant(opensmt::Real(config.getLRAStrengthFactor().c_str())); } + else if (itpAlgorithm == ItpAlgorithm::itp_lra_alg_decomposing_strong) { return interpolator.getDecomposedInterpolant(); } + else if (itpAlgorithm == ItpAlgorithm::itp_lra_alg_decomposing_weak) { return interpolator.getDualDecomposedInterpolant(); } else { assert(false); // Incorrect value in config return interpolator.getFarkasInterpolant(); From 89e3b86a601af1eb81f86022937f5547b53d6733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 27 Jun 2022 08:41:39 +0200 Subject: [PATCH 20/94] parser: cleanup and changes [WiP] --- src/api/Interpret.cc | 196 +++++----- src/api/Interpret.h | 7 +- src/options/SMTConfig.cc | 179 ++++----- src/options/SMTConfig.h | 265 +++++++------- src/parsers/smt2new/smt2newcontext.h | 17 +- src/parsers/smt2new/smt2newparser.yy | 346 ++++++++++++------ test/unit/test_LIAInterpolation.cc | 4 +- .../unit/test_ResolutionProofInterpolation.cc | 10 +- test/unit/test_UFInterpolation.cc | 12 +- 9 files changed, 561 insertions(+), 475 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index da90f30f..0c7ab8fe 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -50,23 +50,21 @@ void Interpret::setInfo(ASTNode const & n) { assert(n.getType() == ASTType::UATTR_T || n.getType() == ASTType::PATTR_T); std::string name; - if (n.getValue().empty()) { - ASTNode const & an = n.children[0]; + if (n.hasValue()) { + ASTNode const & an = *(*n.children)[0]; assert(an.getType() == ASTType::UATTR_T || an.getType() == ASTType::PATTR_T); name = an.getValue(); } else // Normal option name = n.getValue(); - Info value(n); - - config.setInfo(std::move(name), value); + config.setInfo(std::move(name), Info(n)); } void Interpret::getInfo(ASTNode const & n) { assert(n.getType() == ASTType::INFO_T); - assert(n.getValue().empty() or not n.children.empty()); - std::string const & name = n.getValue().empty() ? "" : n.children[0].getValue(); + assert(n.hasValue() or n.children->size() == 1); + std::string const & name = n.hasValue() ? (*(*n.children)[0]).getValue() : n.getValue(); const Info& value = config.getInfo(name); @@ -80,8 +78,8 @@ void Interpret::getInfo(ASTNode const & n) { void Interpret::setOption(ASTNode const & n) { assert(n.getType() == ASTType::OPTION_T); - assert(not n.getValue().empty() or not n.children.empty()); - std::string const & name = n.getValue().empty() ? n.children[0].getValue() : n.getValue(); + assert(not n.hasValue() or not n.children->empty()); + std::string const & name = not n.hasValue() ? (*n.children)[0]->getValue() : n.getValue(); SMTOption value(n); const char* msg = "ok"; @@ -93,7 +91,7 @@ void Interpret::setOption(ASTNode const & n) { void Interpret::getOption(ASTNode const & n) { assert(n.getType() == ASTType::UATTR_T || n.getType() == ASTType::PATTR_T ); - assert(not n.getValue().empty()); + assert(n.hasValue()); std::string const & name = n.getValue(); const SMTOption& value = config.getOption(name); @@ -120,7 +118,7 @@ void Interpret::interp(ASTNode const & n) { try { switch (cmd.x) { case t_setlogic: { - ASTNode const & logic_n = *n.children.begin(); + ASTNode const & logic_n = *(*n.children)[0]; std::string const & logic_name = logic_n.getValue(); if (isInitialized()) { notify_formatted(true, "logic has already been set to %s", main_solver->getLogic().getName().data()); @@ -137,30 +135,26 @@ void Interpret::interp(ASTNode const & n) { } break; } - case t_setinfo: { - setInfo(n.children[0]); + case t_setinfo: + case t_setoption : { + setInfo(*(*n.children)[0]); notify_success(); break; } case t_getinfo: { - getInfo(n.children[0]); - break; - } - case t_setoption: { - setOption(n.children[0]); - notify_success(); + getInfo(*(*n.children)[0]); break; } case t_getoption: { - getOption(n.children[0]); + getOption(*(*n.children)[0]); break; } case t_declaresort: { if (isInitialized()) { - assert(n.children.size() == 2); - ASTNode const & symbolNode = n.children[0]; + assert(n.children->size() == 2); + ASTNode const & symbolNode = *(*n.children)[0]; assert(symbolNode.getType() == ASTType::SYM_T or symbolNode.getType() == ASTType::QSYM_T); - ASTNode const & numNode = n.children[1]; + ASTNode const & numNode = *(*n.children)[1]; assert(numNode.getType() == ASTType::NUM_T); int arity = std::stoi(numNode.getValue()); // MB: TODO: take care of out-of-range input SortSymbol symbol(symbolNode.getValue(), arity); @@ -193,7 +187,7 @@ void Interpret::interp(ASTNode const & n) { case t_assert: { if (isInitialized()) { sstat status; - ASTNode const &asrt = n.children[0]; + ASTNode const &asrt = *(*n.children)[0]; LetRecords letRecords; PTRef tr = parseTerm(asrt, letRecords); if (tr == PTRef_Undef) @@ -274,7 +268,7 @@ void Interpret::interp(ASTNode const & n) { } else if (main_solver->getStatus() != s_True) { notify_formatted(true, "Command get-value called, but solver is not in SAT state"); } else { - getValue(n.children); + getValue(*n.children); } break; } @@ -298,13 +292,13 @@ void Interpret::interp(ASTNode const & n) { if (status == s_Error) notify_formatted(true, "write-state"); } else { - writeState(n.children[0].getValue()); + writeState((*n.children)[0]->getValue()); } } break; } case t_echo: { - std::string const & str = n.children[0].getValue(); + std::string const & str = (*n.children)[0]->getValue(); notify_formatted(false, "%s", str.c_str()); break; } @@ -313,7 +307,7 @@ void Interpret::interp(ASTNode const & n) { notify_formatted(true, "Illegal command before set-logic: push"); } else { try { - int num = std::stoi(n.children[0].getValue()); + int num = std::stoi((*n.children)[0]->getValue()); push(num); } catch (std::out_of_range const & e) { notify_formatted(true, "Illegal push command: %s", e.what()); @@ -326,7 +320,7 @@ void Interpret::interp(ASTNode const & n) { notify_formatted(true, "Illegal command before set-logic: pop"); } else { try { - int num = std::stoi(n.children[0].getValue()); + int num = std::stoi((*n.children)[0]->getValue()); pop(num); } catch (std::out_of_range const &ex) { notify_formatted(true, "Illegal pop command: %s", ex.what()); @@ -388,7 +382,7 @@ PTRef Interpret::resolveTerm(const char* s, vec&& args, SRef sortRef, Sym PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { ASTType t = term.getType(); if (t == ASTType::TERM_T) { - std::string const & name = term.children[0].getValue(); + std::string const & name = (*term.children)[0]->getValue(); // comment_formatted("Processing term %s", name); PTRef tr = PTRef_Undef; try { @@ -400,17 +394,17 @@ PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { } else if (t == ASTType::QID_T) { - if (term.children[0].getType() == ASTType::AS_T) { - ASTNode const & as_node = term.children[0]; - ASTNode const & symbolNode = as_node.children[0]; + if ((*term.children)[0]->getType() == ASTType::AS_T) { + ASTNode const & as_node = *(*term.children)[0]; + ASTNode const & symbolNode = *(*as_node.children)[0]; bool isQuoted = symbolNode.getType() == ASTType::QSYM_T; - std::string const & name = as_node.children[0].getValue(); - ASTNode const & sortNode = as_node.children[1]; + std::string const & name = (*as_node.children)[0]->getValue(); + ASTNode const & sortNode = *(*as_node.children)[1]; assert(not name.empty()); PTRef tr = resolveQualifiedIdentifier(name.c_str(), sortNode, isQuoted); return tr; } else { - ASTNode const & symbolNode = term.children[0]; + ASTNode const & symbolNode = *(*term.children)[0]; std::string const & name = symbolNode.getValue(); bool isQuoted = symbolNode.getType() == ASTType::QSYM_T; PTRef tr = letNameResolve(name.c_str(), letRecords); @@ -427,12 +421,12 @@ PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { else if ( t == ASTType::LQID_T ) { // Multi-argument term - assert(term.children.size() > 1); - auto const & astArgs = opensmt::span(&term.children[1], term.children.size()-1); - std::string const & name = term.children[0].getValue(); + assert(term.children->size() > 1); + auto const & astArgs = opensmt::span(&(*term.children)[1], term.children->size()-1); + std::string const & name = (*term.children)[0]->getValue(); vec args; for (auto const & arg : astArgs) { - PTRef arg_tr = parseTerm(arg, letRecords); + PTRef arg_tr = parseTerm(*arg, letRecords); if (arg_tr == PTRef_Undef) { return PTRef_Undef; } else { @@ -452,9 +446,9 @@ PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { } return tr; } else if (t == ASTType::LET_T) { - assert(term.children.size() == 2); - std::vector const & varList = term.children[0].children; - ASTNode const & letBoundedTerm = term.children[1]; + assert(term.children->size() == 2); + std::vector> const & varList = *(*term.children)[0]->children; + ASTNode const & letBoundedTerm = *(*term.children)[1]; // use RAII idiom to guard the scope of new LetFrame (and ensure the cleaup of names) class Guard { @@ -465,12 +459,11 @@ PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { } scopeGuard(letRecords); std::vector> bindings; - // First read the term declarations in the let statement for (auto const & varListEl : varList) { - PTRef let_tr = parseTerm(varListEl.children[0], letRecords); + PTRef let_tr = parseTerm(*(*(*varListEl).children)[0], letRecords); if (let_tr == PTRef_Undef) return PTRef_Undef; - bindings.push_back({let_tr, varListEl.getValue()}); + bindings.push_back({let_tr, varListEl->getValue()}); } // Only then insert them to the table @@ -489,33 +482,28 @@ PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { } else if (t == ASTType::BANG_T) { - assert(term.children.size() == 2); + assert(term.children->size() == 2); - ASTNode const & named_term = term.children[0]; - ASTNode const & attr_l = term.children[1]; + ASTNode const & named_term = *(*term.children)[0]; + ASTNode const & attr_l = *(*term.children)[1]; assert(attr_l.getType() == ASTType::GATTRL_T); - assert(attr_l.children.size() == 1); - ASTNode const & name_attr = attr_l.children[0]; + assert(attr_l.children->size() == 1); + ASTNode const & name_attr = *(*attr_l.children)[0]; PTRef tr = parseTerm(named_term, letRecords); if (tr == PTRef_Undef) return tr; if (name_attr.getValue() == ":named") { - ASTNode const & sym = name_attr.children[0]; + ASTNode const & sym = *(*name_attr.children)[0]; assert(sym.getType() == ASTType::SYM_T or sym.getType() == ASTType::QSYM_T); - if (nameToTerm.has(sym.getValue().c_str())) { + if (nameToTerm.find(sym.getValue()) != nameToTerm.end()) { notify_formatted(true, "name %s already exists", sym.getValue().c_str()); return PTRef_Undef; } std::string name = sym.getValue(); // MB: term_names becomes the owner of the string and is responsible for deleting term_names.push_back(name); - nameToTerm.insert(name.c_str(), tr); - if (!termToNames.has(tr)) { - vec v; - termToNames.insert(tr, v); - } - termToNames[tr].push(name.c_str()); + nameToTerm.insert({name, tr}); } return tr; } @@ -607,7 +595,7 @@ bool Interpret::getAssignment() { } std::stringstream ss; ss << '('; - for (int i = 0; i < term_names.size(); i++) { + for (unsigned int i = 0; i < term_names.size(); i++) { std::string const & name = term_names[i]; PTRef tr = nameToTerm[name.c_str()]; lbool val = main_solver->getTermValue(tr); @@ -620,20 +608,20 @@ bool Interpret::getAssignment() { return true; } -void Interpret::getValue(std::vector const & terms) +void Interpret::getValue(std::vector> const & terms) { auto model = main_solver->getModel(); Logic& logic = main_solver->getLogic(); std::vector> values; for (auto const & term : terms) { LetRecords tmp; - PTRef tr = parseTerm(term, tmp); + PTRef tr = parseTerm(*term, tmp); if (tr != PTRef_Undef) { values.emplace_back(opensmt::pair{tr, model->evaluate(tr)}); auto pt_str = logic.printTerm(tr); comment_formatted("Found the term %s", pt_str.c_str()); } else - comment_formatted("Error parsing the term %s", term.children[0].getValue().c_str()); + comment_formatted("Error parsing the term %s", (*term->children)[0]->getValue().c_str()); } printf("("); for (auto const & valPair : values) { @@ -790,10 +778,10 @@ void Interpret::writeState(std::string const & filename) bool Interpret::declareFun(ASTNode const & n) // (const char* fname, const vec& args) { - assert(n.children.size() == 3); - ASTNode const & name_node = n.children[0]; - ASTNode const & args_node = n.children[1]; - ASTNode const & ret_node = n.children[2]; + assert(n.children->size() == 3); + ASTNode const & name_node = *(*n.children)[0]; + ASTNode const & args_node = *(*n.children)[1]; + ASTNode const & ret_node = *(*n.children)[2]; std::string const & fname = name_node.getValue(); @@ -807,12 +795,12 @@ bool Interpret::declareFun(ASTNode const & n) // (const char* fname, const vecsize() == 3); + ASTNode const & name_node = *(*n.children)[0]; // n.children[1] is the args node, which is empty - ASTNode const & ret_node = n.children[2]; + ASTNode const & ret_node = *(*n.children)[2]; std::string const & fname = name_node.getValue(); SRef ret_sort = sortFromASTNode(ret_node); @@ -860,22 +848,22 @@ bool Interpret::declareConst(ASTNode const & n) //(const char* fname, const SRef bool Interpret::defineFun(const ASTNode& n) { - assert(n.children.size() == 4); + assert(n.children->size() == 4); - ASTNode const & name_node = n.children[0]; - ASTNode const & args_node = n.children[1]; - ASTNode const & ret_node = n.children[2]; - ASTNode const & term_node = n.children[3]; + ASTNode const & name_node = *(*n.children)[0]; + ASTNode const & args_node = *(*n.children)[1]; + ASTNode const & ret_node = *(*n.children)[2]; + ASTNode const & term_node = *(*n.children)[3]; std::string const & fname = name_node.getValue(); // Get the argument sorts vec arg_sorts; vec arg_trs; - for (auto const & childNode : args_node.children) { - assert(childNode.children.size() == 1); - std::string varName = childNode.getValue(); - ASTNode const & sortNode = childNode.children[0]; + for (auto const & childNode : *(args_node.children)) { + assert(childNode->children->size() == 1); + std::string varName = childNode->getValue(); + ASTNode const & sortNode = *(*childNode->children)[0]; SRef sortRef = sortFromASTNode(sortNode); if (sortRef == SRef_Undef) { notify_formatted(true, "Undefined sort %s in function %s", sortSymbolFromASTNode(sortNode).name.c_str(), fname.c_str()); @@ -997,10 +985,10 @@ void Interpret::notify_success() { } } -void Interpret::execute(const ASTNode* r) { - for (auto const & command : r->children) { +void Interpret::execute(ASTNode const & r) { + for (auto const & command : *r.children) { if (f_exit) break; - interp(command); + interp(*command); } } @@ -1010,7 +998,7 @@ int Interpret::interpFile(FILE* in) { if (rval != 0) return rval; - const ASTNode* r = context.getRoot(); + const ASTNode & r = context.getRoot(); execute(r); return rval; } @@ -1020,7 +1008,7 @@ int Interpret::interpFile(char *content){ int rval = smt2newparse(&context); if (rval != 0) return rval; - const ASTNode* r = context.getRoot(); + ASTNode const & r = context.getRoot(); execute(r); return rval; } @@ -1123,7 +1111,7 @@ int Interpret::interpPipe() { if (rval != 0) notify_formatted(true, "scanner"); else { - const ASTNode* r = context.getRoot(); + ASTNode const & r = context.getRoot(); execute(r); done = f_exit; } @@ -1145,9 +1133,9 @@ SortSymbol Interpret::sortSymbolFromASTNode(ASTNode const & node) { if (type == ASTType::SYM_T or type == ASTType::QSYM_T) { return {node.getValue(), 0}; } else { - assert(type == ASTType::LID_T and not node.children.empty()); - ASTNode const & name = node.children[0]; - return {name.getValue(), static_cast(node.children.size() - 1)}; + assert(type == ASTType::LID_T and not node.children->empty()); + ASTNode const & name = *(*node.children)[0]; + return {name.getValue(), static_cast(node.children->size() - 1)}; } } @@ -1160,31 +1148,31 @@ SRef Interpret::sortFromASTNode(ASTNode const & node) const { if (not known) { return SRef_Undef; } return logic->getSort(symRef, {}); } else { - assert(type == ASTType::LID_T and not node.children.empty()); - ASTNode const & name = node.children[0]; - SortSymbol symbol(name.getValue(), node.children.size() - 1); + assert(type == ASTType::LID_T and not node.children->empty()); + ASTNode const & name = *(*node.children)[0]; + SortSymbol symbol(name.getValue(), node.children->size() - 1); SSymRef symRef; bool known = logic->peekSortSymbol(symbol, symRef); if (not known) { return SRef_Undef; } vec args; - auto astArgs = opensmt::span(&node.children[1], node.children.size()-1); + auto astArgs = opensmt::span(&(*node.children)[1], node.children->size()-1); for (auto const & astArg : astArgs) { - SRef argSortRef = sortFromASTNode(astArg); + SRef argSortRef = sortFromASTNode(*astArg); if (argSortRef == SRef_Undef) { return SRef_Undef; } args.push(argSortRef); } return logic->getSort(symRef, std::move(args)); } - assert(type == ASTType::LID_T and not node.children.empty()); - ASTNode const & name = node.children[0]; - SortSymbol symbol(name.getValue(), node.children.size() - 1); + assert(type == ASTType::LID_T and not node.children->empty()); + ASTNode const & name = *(*node.children)[0]; + SortSymbol symbol(name.getValue(), node.children->size() - 1); SSymRef symRef; bool known = logic->peekSortSymbol(symbol, symRef); if (not known) { return SRef_Undef; } vec args; - auto astSortArgs = opensmt::span(&node.children[1], node.children.size()-1); + auto astSortArgs = opensmt::span(&(*node.children)[1], node.children->size()-1); for (auto const & astSortArg : astSortArgs) { - SRef argSortRef = sortFromASTNode(astSortArg); + SRef argSortRef = sortFromASTNode(*astSortArg); if (argSortRef == SRef_Undef) { return SRef_Undef; } args.push(argSortRef); } @@ -1197,12 +1185,12 @@ void Interpret::getInterpolants(const ASTNode& n) vec grouping; // Consists of PTRefs that we want to group LetRecords letRecords; letRecords.pushFrame(); - for (auto key : nameToTerm.getKeys()) { + for (auto const & key : term_names) { letRecords.addBinding(key, nameToTerm[key]); } - for (auto const & c : exps) { - PTRef tr = parseTerm(c, letRecords); + for (auto const & c : *exps) { + PTRef tr = parseTerm(*c, letRecords); // printf("Itp'ing a term %s\n", logic->pp(tr)); grouping.push(tr); } diff --git a/src/api/Interpret.h b/src/api/Interpret.h index bb527b63..173be522 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -137,8 +137,7 @@ class Interpret { bool f_exit; // Named terms for getting variable values - MapWithKeys> nameToTerm; - VecMap > termToNames; + std::unordered_map nameToTerm; std::vector term_names; // For (! :named ) constructs. if Itp is enabled, this maps a // partition to it name. vec assertions; @@ -159,7 +158,7 @@ class Interpret { bool declareConst(ASTNode const & n); //(const char* fname, const SRef ret_sort); bool defineFun(ASTNode const & n); virtual sstat checkSat(); - void getValue(std::vector const & term); + void getValue(std::vector> const & term); void getModel(); std::string printDefinitionSmtlib(PTRef tr, PTRef val); std::string printDefinitionSmtlib(const TemplateFunction &templateFun) const; @@ -195,7 +194,7 @@ class Interpret { int interpFile(char *content); int interpPipe(); - void execute(const ASTNode* n); + void execute(ASTNode const & n); bool gotExit() const { return f_exit; } ValPair getValue (PTRef tr) const; diff --git a/src/options/SMTConfig.cc b/src/options/SMTConfig.cc index 30485ffc..5805653e 100644 --- a/src/options/SMTConfig.cc +++ b/src/options/SMTConfig.cc @@ -34,24 +34,18 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Generic configuration class, used for both set-info and set-option *********************************************************************/ -ConfValue::ConfValue(const char* s) { - type = O_STR; - strval = strdup(s); // TODO memory leak -} - ConfValue::ConfValue(const ASTNode& s_expr_n) { if (s_expr_n.getType() == ASTType::SEXPRL_T) { type = O_LIST; - configs = new std::list; - for (auto const & i : s_expr_n.children) { - configs->push_back(new ConfValue(i)); + for (auto const & i : (*s_expr_n.children)) { + configs.push_back(ConfValue(*i)); } } else if (s_expr_n.getType() == ASTType::SYM_T) { type = O_SYM; strval = s_expr_n.getValue(); } else if (s_expr_n.getType() == ASTType::SPECC_T) { - assert(s_expr_n.children.size() > 0); - ASTNode const & spn = s_expr_n.children[0]; + assert(s_expr_n.children->size() > 0); + ASTNode const & spn = *(*s_expr_n.children)[0]; if (spn.getType() == ASTType::NUM_T) { type = O_NUM; numval = std::stoi(spn.getValue()); @@ -90,66 +84,57 @@ ConfValue::ConfValue(const ASTNode& s_expr_n) { } } -ConfValue::ConfValue(const ConfValue& other) { - type = other.type; - if (type == O_NUM) numval = other.numval; - else if (type == O_STR) strval = other.strval; - else if (type == O_DEC) decval = other.decval; - else if (type == O_LIST) { - configs = new std::list; - for (ConfValue * value : *other.configs) - configs->push_back(new ConfValue(*value)); - } - else if (type == O_SYM) - strval = other.strval; - else if (type == O_HEX) - unumval = other.unumval; - else if (type == O_BIN) - unumval = other.unumval; - else if (type == O_ATTR) - strval = other.strval; - else if (type == O_BOOL) - numval = other.numval; - else if (type == O_EMPTY) - strval = strdup(""); - else assert(false); -} - -ConfValue& ConfValue::operator=(const ConfValue& other) -{ - type = other.type; - if (type == O_NUM) numval = other.numval; - else if (type == O_STR) strval = other.strval; - else if (type == O_DEC) decval = other.decval; - else if (type == O_LIST) { - configs = new std::list; - for (ConfValue * value : *other.configs) - configs->push_back(new ConfValue(*value)); - } - else if (type == O_SYM) - strval = other.strval; - else if (type == O_HEX) - unumval = other.unumval; - else if (type == O_BIN) - unumval = other.unumval; - else if (type == O_ATTR) - strval = other.strval; - else if (type == O_BOOL) - numval = other.numval; - else if (type == O_EMPTY) - strval = strdup(""); - else assert(false); - return *this; -} - -ConfValue::~ConfValue() { - if (type == O_LIST) { - for (auto * value : *configs) { - delete value; - } - delete configs; - } -} +//ConfValue::ConfValue(const ConfValue& other) { +// type = other.type; +// if (type == O_NUM) numval = other.numval; +// else if (type == O_STR) strval = other.strval; +// else if (type == O_DEC) decval = other.decval; +// else if (type == O_LIST) { +// configs = new std::list; +// for (ConfValue * value : *other.configs) +// configs->push_back(new ConfValue(*value)); +// } +// else if (type == O_SYM) +// strval = other.strval; +// else if (type == O_HEX) +// unumval = other.unumval; +// else if (type == O_BIN) +// unumval = other.unumval; +// else if (type == O_ATTR) +// strval = other.strval; +// else if (type == O_BOOL) +// numval = other.numval; +// else if (type == O_EMPTY) +// strval = strdup(""); +// else assert(false); +//} + +//ConfValue& ConfValue::operator=(const ConfValue& other) +//{ +// type = other.type; +// if (type == O_NUM) numval = other.numval; +// else if (type == O_STR) strval = other.strval; +// else if (type == O_DEC) decval = other.decval; +// else if (type == O_LIST) { +// configs = new std::list; +// for (ConfValue * value : *other.configs) +// configs->push_back(new ConfValue(*value)); +// } +// else if (type == O_SYM) +// strval = other.strval; +// else if (type == O_HEX) +// unumval = other.unumval; +// else if (type == O_BIN) +// unumval = other.unumval; +// else if (type == O_ATTR) +// strval = other.strval; +// else if (type == O_BOOL) +// numval = other.numval; +// else if (type == O_EMPTY) +// strval = strdup(""); +// else assert(false); +// return *this; +//} std::string ConfValue::toString() const { if (type == O_BOOL) @@ -177,11 +162,10 @@ std::string ConfValue::toString() const { return strval; } if (type == O_LIST) { - assert(configs); std::stringstream ss; ss << "( "; - for (ConfValue * val : *configs) { - ss << val->toString() << " "; + for (ConfValue const & val : configs) { + ss << val.toString() << " "; } ss << ")"; return ss.str(); @@ -196,12 +180,12 @@ std::string ConfValue::toString() const { Info::Info(ASTNode const & n) { assert(n.getType() == ASTType::UATTR_T or n.getType() == ASTType::PATTR_T); - if (n.children.empty()) { + if (n.children->empty()) { value.type = O_EMPTY; return; } else { // child is attribute_value - ASTNode const & child = n.children[0]; + ASTNode const & child = *(*n.children)[0]; if (child.getType() == ASTType::SPECC_T or child.getType() == ASTType::SEXPRL_T) { value = ConfValue(child); @@ -214,19 +198,19 @@ Info::Info(ASTNode const & n) { } } -Info::Info(const Info& other) -{ - value = other.value; -} +//Info::Info(const Info& other) +//{ +// value = other.value; +//} /*********************************************************** * Class defining the options, configured with set-config ***********************************************************/ SMTOption::SMTOption(ASTNode const & n) { - assert(not n.children.empty()); + assert(not n.children->empty()); - ASTNode const & child = n.children[0]; + ASTNode const & child = *(*n.children)[0]; if (child.getType() == ASTType::BOOL_T) { value.type = O_BOOL; @@ -251,12 +235,12 @@ SMTOption::SMTOption(ASTNode const & n) { assert(child.getType() == ASTType::UATTR_T or child.getType() == ASTType::PATTR_T); // The option is an attribute - if (child.children.empty()) { + if (child.children->empty()) { value.type = O_EMPTY; return; } else { // n is now attribute_value - ASTNode const & attributeValue = child.children[0]; + ASTNode const & attributeValue = *(*child.children)[0]; if (attributeValue.getType() == ASTType::SPECC_T or attributeValue.getType() == ASTType::SEXPRL_T) { value = ConfValue(attributeValue); @@ -293,7 +277,7 @@ bool SMTConfig::setOption(std::string const & name, const SMTOption& value, cons if (value.getValue().type != O_STR) { msg = s_err_not_str; return false; } if (optionTable.find(name) == optionTable.end()) stats_out.open(value.getValue().strval, std::ios_base::out); - else if (optionTable[name]->getValue().strval != value.getValue().strval) { + else if (optionTable[name].getValue().strval != value.getValue().strval) { if (stats_out.is_open()) { stats_out.close(); stats_out.open(value.getValue().strval, std::ios_base::out); @@ -308,21 +292,21 @@ bool SMTConfig::setOption(std::string const & name, const SMTOption& value, cons if (value.getValue().numval == 1) { // Gets set to true if (optionTable.find(o_stats_out) == optionTable.end()) { - if (optionTable.find(o_produce_stats) == optionTable.end() || optionTable[o_produce_stats]->getValue().numval == 0) { + if (optionTable.find(o_produce_stats) == optionTable.end() || optionTable[o_produce_stats].getValue().numval == 0) { // Insert the default value - insertOption(o_stats_out, new SMTOption("/dev/stdout")); - } else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats]->getValue().numval == 1) { + insertOption(o_stats_out, SMTOption("/dev/stdout")); + } else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats].getValue().numval == 1) { assert(false); } } else { } // No action required - if (!stats_out.is_open()) stats_out.open(optionTable[o_stats_out]->getValue().strval, std::ios_base::out); + if (!stats_out.is_open()) stats_out.open(optionTable[o_stats_out].getValue().strval, std::ios_base::out); } - else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats]->getValue().numval == 1) { + else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats].getValue().numval == 1) { // gets set to false and was previously true if (optionTable.find(o_stats_out) != optionTable.end()) { - if (optionTable.at(o_stats_out)->getValue().numval == 0) assert(false); + if (optionTable.at(o_stats_out).getValue().numval == 0) assert(false); else if (stats_out.is_open()) stats_out.close(); } } @@ -354,29 +338,28 @@ bool SMTConfig::setOption(std::string const & name, const SMTOption& value, cons if (itr != optionTable.end()) { optionTable.erase(itr); } - insertOption(name, new SMTOption(value)); + insertOption(name, SMTOption(value)); return true; } const SMTOption& SMTConfig::getOption(std::string const & name) const { auto itr = optionTable.find(name); if (itr != optionTable.end()) - return *itr->second; + return itr->second; else return option_Empty; } -bool SMTConfig::setInfo(std::string && name_, const Info& value) { +bool SMTConfig::setInfo(std::string && name_, Info && value) { if (infoTable.find(name_) != infoTable.end()) infoTable.erase(infoTable.find(name_)); - infos.emplace_back(Info(value)); - infoTable.insert({name_, &infos.back()}); + infoTable.insert({name_, value}); return true; } -const Info& SMTConfig::getInfo(std::string const & name) const { +Info SMTConfig::getInfo(std::string const & name) const { if (infoTable.find(name) != infoTable.end()) - return *infoTable.at(name); + return infoTable.at(name); else return info_Empty; } @@ -476,7 +459,7 @@ SMTConfig::initializeConfig( ) { // Set Global Default configuration status = l_Undef; - insertOption(o_produce_stats, new SMTOption(0)); + insertOption(o_produce_stats, SMTOption(0)); // produce_stats = 0; // produce_models = 0; print_stats = 1; diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index 87c1af25..42559ae6 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -81,24 +81,30 @@ enum class ASTType { }; class ASTNode { + using ASTNode_up = std::unique_ptr; + using ASTVec = std::vector; + using ASTVec_up = std::unique_ptr; + using string_up = std::unique_ptr; + private: - ASTType type; - osmttokens::smt2token tok; - std::string val; + ASTType type = ASTType::UNDEF_T; + osmttokens::smt2token tok = {osmttokens::t_none}; + std::unique_ptr val; public: - std::vector children; + ASTVec_up children = nullptr; - ASTNode(ASTType t, osmttokens::smt2token tok = {osmttokens::t_none}, std::string && v = "", std::vector && children = {}) + ASTNode(ASTType t, osmttokens::smt2token tok = {osmttokens::t_none}, string_up v = nullptr, ASTVec_up children = nullptr) : type(t), tok(tok), val(std::move(v)), children(std::move(children)) {} - ASTNode() : ASTNode(ASTType::UNDEF_T) {} - ASTNode(ASTNode const &) = delete; - ASTNode(ASTNode &&) = default; - ASTNode & operator=(ASTNode const &) = delete; +// ASTNode(ASTNode const &) = default; +// ASTNode(ASTNode &&) = default; +// ASTNode & operator=(ASTNode const &) = delete; +// ASTNode & operator=(ASTNode &&) = default; void print(std::ostream& o, int indent) const; ASTType getType() const { return type; } - std::string const & getValue() const { return val; } - const osmttokens::smt2token getToken() const { return tok; } + bool hasValue() const { return val != nullptr; } + std::string const & getValue() const { assert(hasValue()); return *val; } + osmttokens::smt2token getToken() const { return tok; } }; @@ -106,18 +112,21 @@ enum ConfType { O_EMPTY, O_STR, O_SYM, O_NUM, O_DEC, O_HEX, O_BIN, O_LIST, O_ATT class ConfValue { public: - ConfType type; - union { std::string strval; int numval; double decval; uint32_t unumval; std::list* configs; }; - ConfValue() : type(O_EMPTY), strval(NULL) {}; + ConfType type = O_EMPTY; + std::string strval = ""; + int numval = 0; + double decval = 0; + uint32_t unumval = 0; + std::list configs; + ConfValue() = default; ConfValue(const ASTNode& s_expr_n); ConfValue(int i) : type(O_NUM), numval(i) {}; ConfValue(double i) : type(O_DEC), decval(i) {}; - ConfValue(const char* s); - ConfValue(const ConfValue& other); - ConfValue& operator=(const ConfValue& other); + ConfValue(std::string && s) : strval(s) {} +// ConfValue(const ConfValue& other); +// ConfValue& operator=(const ConfValue& other); std::string toString() const; double getDoubleVal() const {if (type == O_NUM) return (double)numval; else if (type == O_DEC) return decval; else assert(false); return -1;} - ~ConfValue(); }; class Info { @@ -125,8 +134,9 @@ class Info { ConfValue value; public: Info(ASTNode const & n); - Info(Info const & other); - Info() {}; + Info() = default; +// Info(Info const & other); +// Info() {}; bool isEmpty() const { return value.type == O_EMPTY; } inline std::string toString() const { return value.toString(); } }; @@ -139,7 +149,7 @@ class SMTOption { SMTOption() {} SMTOption(int i) : value(i) {} SMTOption(double i): value(i) {} - SMTOption(const char* s) : value(s) {} + SMTOption(std::string && s) : value(std::move(s)) {} inline bool isEmpty() const { return value.type == O_EMPTY; } inline std::string toString() const { return value.toString(); } inline const ConfValue& getValue() const { return value; } @@ -309,11 +319,9 @@ struct SMTConfig Info info_Empty; SMTOption option_Empty; - std::vector options; std::vector option_names; - std::vector infos; - std::unordered_map infoTable; - std::unordered_map optionTable; + std::unordered_map infoTable; + std::unordered_map optionTable; bool usedForInitialization = false; // Some options can be changed only before this config is used for initialization of MainSolver bool isPreInitializationOption(std::string const & o_name) { @@ -322,12 +330,11 @@ struct SMTConfig or o_name == o_sat_scatter_split or o_name == o_ghost_vars; } - void insertOption(std::string const & o_name, SMTOption* o) { - options.push_back(o); - if (optionTable.find(o_name) != optionTable.end()) optionTable[o_name] = o; + void insertOption(std::string const & o_name, SMTOption && o) { + if (optionTable.find(o_name) != optionTable.end()) optionTable.insert({o_name, std::move(o)}); else { option_names.push_back(o_name); - optionTable.insert({o_name, o}); + optionTable.insert({o_name, std::move(o)}); } } std::string append_output_dir(std::string const & name) const @@ -351,16 +358,11 @@ struct SMTConfig initializeConfig( ); } - ~SMTConfig () { - for (auto i : options) - delete i; - } - bool setOption(std::string const & name, const SMTOption& value, const char*& msg); const SMTOption& getOption(std::string const & name) const; - bool setInfo (std::string && name, const Info& value); - const Info& getInfo (std::string const & name) const; + bool setInfo (std::string && name, Info && value); + Info getInfo (std::string const & name) const; void initializeConfig ( ); @@ -369,194 +371,194 @@ struct SMTConfig void printHelp ( ); void printConfig ( std::ostream & out ); - inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed)->getValue().numval : 91648253; } - inline void setProduceModels( ) { insertOption(o_produce_models, new SMTOption(1)); } - inline bool setRandomSeed(int seed) { insertOption(o_random_seed, new SMTOption(seed)); return true; } + inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed).getValue().numval : 91648253; } + inline void setProduceModels( ) { insertOption(o_produce_models, SMTOption(1)); } + inline bool setRandomSeed(int seed) { insertOption(o_random_seed, SMTOption(seed)); return true; } void setUsedForInitiliazation() { usedForInitialization = true; } inline bool produceProof( ) { - return optionTable.find(o_produce_proofs) != optionTable.end() ? optionTable[o_produce_proofs]->getValue().numval > 0 : false; + return optionTable.find(o_produce_proofs) != optionTable.end() ? optionTable[o_produce_proofs].getValue().numval > 0 : false; } - void setTimeQueries() { insertOption(o_time_queries, new SMTOption(1)); } - bool timeQueries() { return optionTable.find(o_time_queries) != optionTable.end() ? optionTable[o_time_queries]->getValue().numval : false; } + void setTimeQueries() { insertOption(o_time_queries, SMTOption(1)); } + bool timeQueries() { return optionTable.find(o_time_queries) != optionTable.end() ? optionTable[o_time_queries].getValue().numval : false; } // Set reduction params - inline void setReduction(int r) { insertOption(o_proof_reduce, new SMTOption(r)); } + inline void setReduction(int r) { insertOption(o_proof_reduce, SMTOption(r)); } - inline void setReductionGraph(int r) { insertOption(o_proof_num_graph_traversals, new SMTOption(r)); } + inline void setReductionGraph(int r) { insertOption(o_proof_num_graph_traversals, SMTOption(r)); } - inline void setReductionLoops(int r) { insertOption(o_proof_red_trans, new SMTOption(r)); } + inline void setReductionLoops(int r) { insertOption(o_proof_red_trans, SMTOption(r)); } // Set interpolation algorithms inline void setBooleanInterpolationAlgorithm( ItpAlgorithm i ) { - insertOption(o_itp_bool_alg, new SMTOption(static_cast(i))); } + insertOption(o_itp_bool_alg, SMTOption(static_cast(i))); } - inline void setEUFInterpolationAlgorithm( ItpAlgorithm i ) { insertOption(o_itp_euf_alg, new SMTOption(static_cast(i))); } + inline void setEUFInterpolationAlgorithm( ItpAlgorithm i ) { insertOption(o_itp_euf_alg, SMTOption(static_cast(i))); } - inline void setLRAInterpolationAlgorithm( ItpAlgorithm i ) { insertOption(o_itp_lra_alg, new SMTOption(static_cast(i))); } + inline void setLRAInterpolationAlgorithm( ItpAlgorithm i ) { insertOption(o_itp_lra_alg, SMTOption(static_cast(i))); } - inline void setLRAStrengthFactor(const char *factor) { insertOption(o_itp_lra_factor, new SMTOption(factor)); } + inline void setLRAStrengthFactor(const char *factor) { insertOption(o_itp_lra_factor, SMTOption(factor)); } - inline void setInstanceName(const char* name) { insertOption(o_inst_name, new SMTOption(name)); } + inline void setInstanceName(const char* name) { insertOption(o_inst_name, SMTOption(name)); } // Get interpolation algorithms inline ItpAlgorithm getBooleanInterpolationAlgorithm() const { - return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg)->getValue().numval) + return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg).getValue().numval) : ItpAlgorithm::itp_alg_mcmillan; } inline ItpAlgorithm getEUFInterpolationAlgorithm() const { - return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg)->getValue().numval) + return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg).getValue().numval) : ItpAlgorithm::itp_euf_alg_strong; } inline ItpAlgorithm getLRAInterpolationAlgorithm() const { - return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg)->getValue().numval) + return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg).getValue().numval) : ItpAlgorithm::itp_lra_alg_strong; } inline std::string getLRAStrengthFactor() const { return optionTable.find(o_itp_lra_factor) != optionTable.end() ? optionTable.at( - o_itp_lra_factor)->getValue().strval : itp_lra_factor_0; + o_itp_lra_factor).getValue().strval : itp_lra_factor_0; } inline std::string getInstanceName() const { - return optionTable.find(o_inst_name) != optionTable.end() ? optionTable.at(o_inst_name)->getValue().strval : "unknown"; + return optionTable.find(o_inst_name) != optionTable.end() ? optionTable.at(o_inst_name).getValue().strval : "unknown"; } lbool status; // Status of the benchmark // int incremental; // Incremental solving int isIncremental() const { return optionTable.find(o_incremental) != optionTable.end() ? - optionTable.at(o_incremental)->getValue().numval == 1: true; } + optionTable.at(o_incremental).getValue().numval == 1: true; } int produce_models() const { return optionTable.find(o_produce_models) != optionTable.end() ? - optionTable.at(o_produce_models)->getValue().numval : + optionTable.at(o_produce_models).getValue().numval : 1; } int produceStats() const { return optionTable.find(o_produce_stats) != optionTable.end() ? - optionTable.at(o_produce_stats)->getValue().numval == 1: false; } + optionTable.at(o_produce_stats).getValue().numval == 1: false; } std::string getStatsOut() const { - return optionTable.find(o_stats_out) != optionTable.end() ? optionTable.at(o_stats_out)->getValue().strval : "/dev/stdout"; + return optionTable.find(o_stats_out) != optionTable.end() ? optionTable.at(o_stats_out).getValue().strval : "/dev/stdout"; } int sat_grow() const { return optionTable.find(o_grow) != optionTable.end() ? - optionTable.at(o_grow)->getValue().numval : 0; } + optionTable.at(o_grow).getValue().numval : 0; } int sat_clause_lim() const { return optionTable.find(o_clause_lim) != optionTable.end() ? - optionTable.at(o_clause_lim)->getValue().numval : 20; } + optionTable.at(o_clause_lim).getValue().numval : 20; } int sat_subsumption_lim() const { return optionTable.find(o_subsumption_lim) != optionTable.end() ? - optionTable.at(o_subsumption_lim)->getValue().numval : 1000; } + optionTable.at(o_subsumption_lim).getValue().numval : 1000; } double sat_simp_garbage_frac() const { return optionTable.find(o_simp_garbage_frac) != optionTable.end() ? - optionTable.at(o_simp_garbage_frac)->getValue().decval : 0.5; } + optionTable.at(o_simp_garbage_frac).getValue().decval : 0.5; } int sat_use_asymm() const { return optionTable.find(o_use_asymm) != optionTable.end() ? - optionTable.at(o_use_asymm)->getValue().numval == 1: false; } + optionTable.at(o_use_asymm).getValue().numval == 1: false; } int sat_use_rcheck() const { return optionTable.find(o_use_rcheck) != optionTable.end() ? - optionTable.at(o_use_rcheck)->getValue().numval == 1: false; } + optionTable.at(o_use_rcheck).getValue().numval == 1: false; } int sat_use_elim() const { return optionTable.find(o_use_elim) != optionTable.end() ? - optionTable.at(o_use_elim)->getValue().numval == 1: true; } + optionTable.at(o_use_elim).getValue().numval == 1: true; } double sat_var_decay() const { return optionTable.find(o_var_decay) != optionTable.end() ? - optionTable.at(o_var_decay)->getValue().decval : 1 / 0.95; } + optionTable.at(o_var_decay).getValue().decval : 1 / 0.95; } double sat_clause_decay() const { return optionTable.find(o_clause_decay) != optionTable.end() ? - optionTable.at(o_clause_decay)->getValue().decval : 1 / 0.999; } + optionTable.at(o_clause_decay).getValue().decval : 1 / 0.999; } double sat_random_var_freq() const { return optionTable.find(o_random_var_freq) != optionTable.end() ? - optionTable.at(o_random_var_freq)->getValue().decval : 0.02; } + optionTable.at(o_random_var_freq).getValue().decval : 0.02; } int sat_random_seed() const { return optionTable.find(o_random_seed) != optionTable.end() ? - optionTable.at(o_random_seed)->getValue().decval : 91648253; } + optionTable.at(o_random_seed).getValue().decval : 91648253; } int sat_luby_restart() const { return optionTable.find(o_luby_restart) != optionTable.end() ? - optionTable.at(o_luby_restart)->getValue().numval > 0 : 1; } + optionTable.at(o_luby_restart).getValue().numval > 0 : 1; } int sat_ccmin_mode() const { return optionTable.find(o_ccmin_mode) != optionTable.end() ? - optionTable.at(o_ccmin_mode)->getValue().numval : 2; } + optionTable.at(o_ccmin_mode).getValue().numval : 2; } int sat_rnd_pol() const { return optionTable.find(o_rnd_pol) != optionTable.end() ? - optionTable.at(o_rnd_pol)->getValue().numval > 0 : 0; } + optionTable.at(o_rnd_pol).getValue().numval > 0 : 0; } int sat_rnd_init_act() const { return optionTable.find(o_rnd_init_act) != optionTable.end() ? - optionTable.at(o_rnd_init_act)->getValue().numval > 0 : 0; } + optionTable.at(o_rnd_init_act).getValue().numval > 0 : 0; } double sat_garbage_frac() const { return optionTable.find(o_garbage_frac) != optionTable.end() ? - optionTable.at(o_garbage_frac)->getValue().decval : 0.20; } + optionTable.at(o_garbage_frac).getValue().decval : 0.20; } int sat_restart_first() const { return optionTable.find(o_restart_first) != optionTable.end() ? - optionTable.at(o_restart_first)->getValue().numval : 100; } + optionTable.at(o_restart_first).getValue().numval : 100; } double sat_restart_inc() const { return optionTable.find(o_restart_inc) != optionTable.end() ? - optionTable.at(o_restart_inc)->getValue().numval : 1.1; } + optionTable.at(o_restart_inc).getValue().numval : 1.1; } int proof_interpolant_cnf() const { return optionTable.find(o_interpolant_cnf) != optionTable.end() ? - optionTable.at(o_interpolant_cnf)->getValue().numval : 0; } + optionTable.at(o_interpolant_cnf).getValue().numval : 0; } int certify_inter() const { return optionTable.find(o_certify_inter) != optionTable.end() ? - optionTable.at(o_certify_inter)->getValue().numval : 0; } + optionTable.at(o_certify_inter).getValue().numval : 0; } bool produce_inter() const { return optionTable.find(o_produce_inter) != optionTable.end() ? - optionTable.at(o_produce_inter)->getValue().numval > 0 : false; } + optionTable.at(o_produce_inter).getValue().numval > 0 : false; } int simplify_inter() const { return optionTable.find(o_simplify_inter) != optionTable.end() ? - optionTable.at(o_simplify_inter)->getValue().numval : 0; } + optionTable.at(o_simplify_inter).getValue().numval : 0; } int proof_struct_hash() const { return optionTable.find(o_proof_struct_hash) != optionTable.end() ? - optionTable.at(o_proof_struct_hash)->getValue().numval : 1; } + optionTable.at(o_proof_struct_hash).getValue().numval : 1; } int proof_num_graph_traversals() const { return optionTable.find(o_proof_num_graph_traversals) != optionTable.end() ? - optionTable.at(o_proof_num_graph_traversals)->getValue().numval : 3; } + optionTable.at(o_proof_num_graph_traversals).getValue().numval : 3; } int proof_red_trans() const { return optionTable.find(o_proof_red_trans) != optionTable.end() ? - optionTable.at(o_proof_red_trans)->getValue().numval : 2; } + optionTable.at(o_proof_red_trans).getValue().numval : 2; } int proof_rec_piv() const { return optionTable.find(o_proof_rec_piv) != optionTable.end() ? - optionTable.at(o_proof_rec_piv)->getValue().numval : 1; } + optionTable.at(o_proof_rec_piv).getValue().numval : 1; } int proof_push_units() const { return optionTable.find(o_proof_push_units) != optionTable.end() ? - optionTable.at(o_proof_push_units)->getValue().numval : 1; } + optionTable.at(o_proof_push_units).getValue().numval : 1; } int proof_transf_trav() const { return optionTable.find(o_proof_transf_trav) != optionTable.end() ? - optionTable.at(o_proof_transf_trav)->getValue().numval : 1; } + optionTable.at(o_proof_transf_trav).getValue().numval : 1; } int proof_check() const { return optionTable.find(o_proof_check) != optionTable.end() ? - optionTable.at(o_proof_check)->getValue().numval : 0; } + optionTable.at(o_proof_check).getValue().numval : 0; } int proof_multiple_inter() const { return optionTable.find(o_proof_multiple_inter) != optionTable.end() ? - optionTable.at(o_proof_multiple_inter)->getValue().numval : 0; } + optionTable.at(o_proof_multiple_inter).getValue().numval : 0; } int proof_alternative_inter() const { return optionTable.find(o_proof_alternative_inter) != optionTable.end() ? - optionTable.at(o_proof_alternative_inter)->getValue().numval : 0; } + optionTable.at(o_proof_alternative_inter).getValue().numval : 0; } int proof_reduce() const { return optionTable.find(o_proof_reduce) != optionTable.end() ? - optionTable.at(o_proof_reduce)->getValue().numval : 0; } + optionTable.at(o_proof_reduce).getValue().numval : 0; } int itp_bool_alg() const { return optionTable.find(o_itp_bool_alg) != optionTable.end() ? - optionTable.at(o_itp_bool_alg)->getValue().numval : 0; } + optionTable.at(o_itp_bool_alg).getValue().numval : 0; } int itp_euf_alg() const { return optionTable.find(o_itp_euf_alg) != optionTable.end() ? - optionTable.at(o_itp_euf_alg)->getValue().numval : 0; } + optionTable.at(o_itp_euf_alg).getValue().numval : 0; } int itp_lra_alg() const { return optionTable.find(o_itp_lra_alg) != optionTable.end() ? - optionTable.at(o_itp_lra_alg)->getValue().numval : 0; } + optionTable.at(o_itp_lra_alg).getValue().numval : 0; } int sat_dump_rnd_inter() const { return optionTable.find(o_sat_dump_rnd_inter) != optionTable.end() ? - optionTable.at(o_sat_dump_rnd_inter)->getValue().numval : 2; } + optionTable.at(o_sat_dump_rnd_inter).getValue().numval : 2; } bool declarations_are_global() const { - return optionTable.find(o_global_declarations) != optionTable.end() ? optionTable.at(o_global_declarations)->getValue().numval > 0 : false; + return optionTable.find(o_global_declarations) != optionTable.end() ? optionTable.at(o_global_declarations).getValue().numval > 0 : false; } SpUnit sat_resource_units() const { if (optionTable.find(o_sat_resource_units) != optionTable.end()) { - std::string type = optionTable.at(o_sat_resource_units)->getValue().strval; + std::string type = optionTable.at(o_sat_resource_units).getValue().strval; if (type == spts_search_counter) { return SpUnit::search_counter; } else if (type == spts_time) { @@ -568,49 +570,48 @@ struct SMTConfig bool respect_logic_partitioning_hints() const { return optionTable.find(o_respect_logic_partitioning_hints) != optionTable.end() ? - optionTable.at(o_respect_logic_partitioning_hints)->getValue().numval : 0; } + optionTable.at(o_respect_logic_partitioning_hints).getValue().numval : 0; } double sat_resource_limit() const { return optionTable.find(o_sat_resource_limit) != optionTable.end() ? - optionTable.at(o_sat_resource_limit)->getValue().getDoubleVal() : -1; } + optionTable.at(o_sat_resource_limit).getValue().getDoubleVal() : -1; } std::string dump_state() const { if (optionTable.find(o_dump_state) != optionTable.end()) { - return append_output_dir(optionTable.at(o_dump_state)->getValue().strval); + return append_output_dir(optionTable.at(o_dump_state).getValue().strval); } else { std::string name = getInstanceName(); return name.substr(0, name.size() - strlen(".smt2")); } } std::string output_dir() const { - return optionTable.find(o_output_dir) != optionTable.end() ? optionTable.at(o_output_dir)->getValue().strval : ""; + return optionTable.find(o_output_dir) != optionTable.end() ? optionTable.at(o_output_dir).getValue().strval : ""; } int dump_only() const - { return optionTable.find(o_dump_only) != optionTable.end() ? optionTable.at(o_dump_only)->getValue().numval : 0; } + { return optionTable.find(o_dump_only) != optionTable.end() ? optionTable.at(o_dump_only).getValue().numval : 0; } bool dump_query() const - { return optionTable.find(o_dump_query) != optionTable.end() ? optionTable.at(o_dump_query)->getValue().numval : 0; } + { return optionTable.find(o_dump_query) != optionTable.end() ? optionTable.at(o_dump_query).getValue().numval : 0; } - void set_dump_query_name(const char* dump_query_name) + void set_dump_query_name(std::string && dump_query_name) { if (optionTable.find(o_dump_query_name) != optionTable.end()) { - delete optionTable[o_dump_query_name]; - optionTable[o_dump_query_name] = new SMTOption(strdup(dump_query_name)); + optionTable.insert({o_dump_query_name, SMTOption(std::move(dump_query_name))}); } else - insertOption(o_dump_query_name, new SMTOption(strdup(dump_query_name))); + insertOption(o_dump_query_name, SMTOption(std::move(dump_query_name))); } std::string dump_query_name() const { - return optionTable.find(o_dump_query_name) != optionTable.end() ? append_output_dir(optionTable.at(o_dump_query_name)->getValue().strval) : ""; + return optionTable.find(o_dump_query_name) != optionTable.end() ? append_output_dir(optionTable.at(o_dump_query_name).getValue().strval) : ""; } int sat_dump_learnts() const { return optionTable.find(o_sat_dump_learnts) != optionTable.end() ? - optionTable.at(o_sat_dump_learnts)->getValue().numval : 0; } + optionTable.at(o_sat_dump_learnts).getValue().numval : 0; } bool sat_split_test_cube_and_conquer() const { return optionTable.find(o_sat_split_test_cube_and_conquer) != optionTable.end() ? - optionTable.at(o_sat_split_test_cube_and_conquer)->getValue().numval : 0; } + optionTable.at(o_sat_split_test_cube_and_conquer).getValue().numval : 0; } SpType sat_split_type() const { if (sat_lookahead_split()) { @@ -624,7 +625,7 @@ struct SMTConfig SpUnit sat_split_units() const { if (optionTable.find(o_sat_split_units) != optionTable.end()) { - std::string type = optionTable.at(o_sat_split_units)->getValue().strval; + std::string type = optionTable.at(o_sat_split_units).getValue().strval; if (type == spts_search_counter) { return SpUnit::search_counter; } else if (type == spts_time) { @@ -636,64 +637,64 @@ struct SMTConfig double sat_split_inittune() const { return optionTable.find(o_sat_split_inittune) != optionTable.end() ? - optionTable.at(o_sat_split_inittune)->getValue().getDoubleVal() : + optionTable.at(o_sat_split_inittune).getValue().getDoubleVal() : -1; } double sat_split_midtune() const { return optionTable.find(o_sat_split_midtune) != optionTable.end() ? - optionTable.at(o_sat_split_midtune)->getValue().getDoubleVal() : + optionTable.at(o_sat_split_midtune).getValue().getDoubleVal() : -1; } int sat_split_num() const { return optionTable.find(o_sat_split_num) != optionTable.end() ? - optionTable.at(o_sat_split_num)->getValue().numval : + optionTable.at(o_sat_split_num).getValue().numval : 2; } int sat_split_fixvars() const { return optionTable.find(o_sat_split_fix_vars) != optionTable.end() ? - optionTable.at(o_sat_split_fix_vars)->getValue().numval : + optionTable.at(o_sat_split_fix_vars).getValue().numval : -1; } int sat_split_asap() const { return optionTable.find(o_sat_split_asap) != optionTable.end() ? - optionTable.at(o_sat_split_asap)->getValue().numval : + optionTable.at(o_sat_split_asap).getValue().numval : 0; } int sat_lookahead_split() const { return optionTable.find(o_sat_lookahead_split) != optionTable.end() ? - optionTable.at(o_sat_lookahead_split)->getValue().numval : + optionTable.at(o_sat_lookahead_split).getValue().numval : 0; } int sat_scatter_split() const { return optionTable.find(o_sat_scatter_split) != optionTable.end() ? - optionTable.at(o_sat_scatter_split)->getValue().numval : + optionTable.at(o_sat_scatter_split).getValue().numval : 0; } int sat_pure_lookahead() const { return optionTable.find(o_sat_pure_lookahead) != optionTable.end() ? - optionTable.at(o_sat_pure_lookahead)->getValue().numval : + optionTable.at(o_sat_pure_lookahead).getValue().numval : 0; } int lookahead_score_deep() const { return optionTable.find(o_lookahead_score_deep) != optionTable.end() ? - optionTable.at(o_lookahead_score_deep)->getValue().numval : + optionTable.at(o_lookahead_score_deep).getValue().numval : 0; } int randomize_lookahead() const { return optionTable.find(o_sat_split_randomize_lookahead) != optionTable.end() ? - optionTable.at(o_sat_split_randomize_lookahead)->getValue().numval : + optionTable.at(o_sat_split_randomize_lookahead).getValue().numval : 0; } int randomize_lookahead_bufsz() const { return optionTable.find(o_sat_split_randomize_lookahead_buf) != optionTable.end() ? - optionTable.at(o_sat_split_randomize_lookahead_buf)->getValue().numval : + optionTable.at(o_sat_split_randomize_lookahead_buf).getValue().numval : 1; } int remove_symmetries() const { return optionTable.find(o_sat_remove_symmetries) != optionTable.end() ? - optionTable.at(o_sat_remove_symmetries)->getValue().numval : 0; } + optionTable.at(o_sat_remove_symmetries).getValue().numval : 0; } int dryrun() const { return optionTable.find(o_dryrun) != optionTable.end() ? - optionTable.at(o_dryrun)->getValue().numval : 0; } + optionTable.at(o_dryrun).getValue().numval : 0; } void set_dryrun(bool b) - { insertOption(o_dryrun, new SMTOption(b)); } + { insertOption(o_dryrun, SMTOption(b)); } SpPref sat_split_preference() const { if (optionTable.find(o_sat_split_preference) != optionTable.end()) { - std::string type = optionTable.at(o_sat_split_preference)->getValue().strval; + std::string type = optionTable.at(o_sat_split_preference).getValue().strval; if (type == spprefs_tterm) return sppref_tterm; if (type == spprefs_blind) return sppref_blind; if (type == spprefs_bterm) return sppref_bterm; @@ -707,14 +708,14 @@ struct SMTConfig bool use_ghost_vars() const { if (optionTable.find(o_ghost_vars) != optionTable.end()) { - return optionTable.at(o_ghost_vars)->getValue().numval != 0; + return optionTable.at(o_ghost_vars).getValue().numval != 0; } return false; } int do_substitutions() const { return optionTable.find(o_do_substitutions) != optionTable.end()? - optionTable.at(o_do_substitutions)->getValue().numval : 1; } + optionTable.at(o_do_substitutions).getValue().numval : 1; } bool use_theory_polarity_suggestion() const @@ -722,11 +723,11 @@ struct SMTConfig int sat_solver_limit() const { return optionTable.find(o_sat_solver_limit) != optionTable.end() ? - optionTable.at(o_sat_solver_limit)->getValue().numval : 0; } + optionTable.at(o_sat_solver_limit).getValue().numval : 0; } bool sat_split_mode() const { if (optionTable.find(o_sat_split_mode) != optionTable.end()) { - return optionTable.at(o_sat_split_mode)->getValue().numval != 0; + return optionTable.at(o_sat_split_mode).getValue().numval != 0; } return false; } @@ -748,11 +749,11 @@ struct SMTConfig optionTable[o_verbosity]->getValue().numval : 2; } #else { return optionTable.find(o_verbosity) != optionTable.end() ? - optionTable.at(o_verbosity)->getValue().numval : 0; } + optionTable.at(o_verbosity).getValue().numval : 0; } #endif int printSuccess() const { return optionTable.find(":print-success") != optionTable.end() ? - optionTable.at(":print-success")->getValue().numval == 1: false; } + optionTable.at(":print-success").getValue().numval == 1: false; } int certification_level; // Level of certification char certifying_solver[256]; // Executable used for certification diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 0bd108f4..7aae3726 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -37,22 +37,22 @@ class Smt2newContext { char* buffer; int buffer_sz; int buffer_cap; - ASTNode* root; + std::unique_ptr root; public: void* scanner; int result; FILE* is; char* ib; bool interactive; - inline const ASTNode* getRoot() { return root; }; + inline ASTNode const & getRoot() { return *root; }; Smt2newContext(FILE* in) : buffer_sz(0) , buffer_cap(1) - , root(NULL) + , root(nullptr) , result(0) , is(in) - , ib(NULL) + , ib(nullptr) , interactive(false) { init_scanner(); @@ -62,9 +62,9 @@ class Smt2newContext { Smt2newContext(char* in_s) : buffer_sz(0) , buffer_cap(1) - , root(NULL) + , root(nullptr) , result(0) - , is(NULL) + , is(nullptr) , ib(in_s) , interactive(true) { @@ -74,7 +74,6 @@ class Smt2newContext { ~Smt2newContext() { destroy_scanner(); - delete root; free(buffer); } @@ -95,8 +94,8 @@ class Smt2newContext { buffer_sz = 0; } - void insertRoot(ASTNode* n) { - root = n; + void insertRoot(std::unique_ptr n) { + root = std::move(n); } void prettyPrint(std::ostream& o) { diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 77600336..25205ed3 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. %define api.pure %define parse.error verbose -%name-prefix "smt2new" +%define api.prefix {smt2new} %locations %defines %parse-param { Smt2newContext* context } @@ -37,14 +37,19 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#include #include -#include #include "smt2newcontext.h" #include "smt2newparser.hh" #include "smt2tokens.h" +using ASTNode_up = std::unique_ptr; +using ASTVec = std::vector; +using ASTVec_up = std::unique_ptr; +using string_up = std::unique_ptr; + +std::unique_ptr mkUniqueStr(std::string const & s) { return std::make_unique(s); } + int smt2newlex(YYSTYPE* lvalp, YYLTYPE* llocp, void* scanner); void smt2newerror( YYLTYPE* locp, Smt2newContext* context, const char * s ) @@ -66,11 +71,11 @@ void smt2newerror( YYLTYPE* locp, Smt2newContext* context, const char * s ) { std::string * str; ASTNode * snode; - std::vector * snode_list; + std::vector> * snode_list; osmttokens::smt2token tok; } -%destructor { free($$); } +%destructor { delete $$; } %destructor { delete $$; } %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING @@ -91,81 +96,100 @@ void smt2newerror( YYLTYPE* locp, Smt2newContext* context, const char * s ) %% -script: command_list { ASTNode *n = new ASTNode(ASTType::CMDL_T, {osmttokens::t_none}, "main-script", std::move(*$1)); context->insertRoot(n); }; +script: command_list { context->insertRoot(std::make_unique(ASTType::CMDL_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr("main-script"), ASTVec_up($1))); }; symbol: TK_SYM - { $$ = new ASTNode(ASTType::SYM_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::SYM_T, {osmttokens::t_none}, string_up($1)); } | TK_QSYM - { $$ = new ASTNode(ASTType::QSYM_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::QSYM_T, {osmttokens::t_none}, string_up($1)); } ; command_list: - { $$ = new std::vector(); } + { $$ = new ASTVec(); } | command_list command - { (*$1).push_back(std::move(*$2)); $$ = $1; } + { (*$1).emplace_back(ASTNode_up($2)); $$ = $1; } ; command: '(' TK_SETLOGIC symbol ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + $$ = new ASTNode(ASTType::CMD_T, $2, mkUniqueStr(""), std::move(tmp)); } | '(' TK_SETOPTION option ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + $$ = new ASTNode(ASTType::CMD_T, $2, mkUniqueStr(""), std::move(tmp)); } | '(' TK_SETINFO attribute ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + $$ = new ASTNode(ASTType::CMD_T, $2, mkUniqueStr(""), std::move(tmp)); } | '(' TK_DECLARESORT symbol TK_NUM ')' { + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($4))); $$ = new ASTNode(ASTType::CMD_T, $2, - "", - std::vector{std::move(*$3), - ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$4))}); + mkUniqueStr(""), + std::move(tmp)); } | '(' TK_DEFINESORT symbol '(' symbol_list ')' sort ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", - std::vector{ - std::move(*$3), - ASTNode(ASTType::SYML_T, {osmttokens::t_none}, "", std::move(*$5)), - std::move(*$7)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + tmp->push_back(std::make_unique(ASTType::SYML_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr(""), ASTVec_up($5))); + tmp->push_back(ASTNode_up($7)); + $$ = new ASTNode(ASTType::CMD_T, $2, mkUniqueStr(""), std::move(tmp)); } | '(' TK_DECLAREFUN symbol '(' sort_list ')' sort ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", - std::vector{std::move(*$3), - ASTNode(ASTType::SORTL_T, {osmttokens::t_none}, "", std::move(*$5)), - std::move(*$7)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + tmp->push_back(std::make_unique(ASTType::SORTL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($5))); + tmp->push_back(ASTNode_up($7)); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_DECLARECONST const_val sort ')' { // todo: drop the second child? - $$ = new ASTNode(ASTType::CMD_T, $2, "", - std::vector{std::move(*$3), ASTNode(ASTType::SORTL_T), std::move(*$4)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + tmp->push_back(std::make_unique(ASTType::SORTL_T)); + tmp->push_back(ASTNode_up($4)); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_DEFINEFUN symbol '(' sorted_var_list ')' sort term ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", - std::vector{std::move(*$3), - ASTNode(ASTType::SVL_T, {osmttokens::t_none}, "", std::move(*$5)), - std::move(*$7), - std::move(*$8)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + tmp->push_back(std::make_unique(ASTType::SVL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($5))); + tmp->push_back(ASTNode_up($7)); + tmp->push_back(ASTNode_up($8)); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_PUSH TK_NUM ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$3))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_POP TK_NUM ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$3))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_ASSERT term ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_CHECKSAT ')' { @@ -181,23 +205,26 @@ command: '(' TK_SETLOGIC symbol ')' } | '(' TK_GETITPS term_list ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::move(*$3)); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, ASTVec_up($3)); } | '(' TK_WRSTATE TK_STR ')' { - // todo: consider inserting the TK_STR to the string? // todo: TK_{WR,RD}STATE and TK_WRFUNS is not implemented and is not part of the standard - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_RDSTATE TK_STR ')' { - // todo: consider inserting the TK_STR to the string? - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_WRFUNS TK_STR ')' { - // todo: consider inserting the TK_STR to the string? - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_GETUNSATCORE ')' { @@ -205,8 +232,9 @@ command: '(' TK_SETLOGIC symbol ')' } | '(' TK_GETVALUE '(' term term_list ')' ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$5)}); - $$->children.insert($$->children.begin(), std::move(*$4)); + // todo: insert first $4 and then extend with $5? + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, ASTVec_up($5)); + $$->children->insert($$->children->begin(), ASTNode_up($4)); } | '(' TK_GETMODEL ')' { @@ -218,15 +246,21 @@ command: '(' TK_SETLOGIC symbol ')' } | '(' TK_GETOPTION TK_KEY ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_GETOPTION predef_key ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::PATTR_T, {osmttokens::t_none}, std::move(*$3))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::PATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_GETINFO info_flag ')' { - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{std::move(*$3)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } | '(' TK_SIMPLIFY ')' { @@ -237,35 +271,48 @@ command: '(' TK_SETLOGIC symbol ')' | '(' TK_ECHO TK_STR ')' { // todo: consider using ASTNode's string instead of vector - $$ = new ASTNode(ASTType::CMD_T, $2, "", std::vector{ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$3))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); + $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); } ; attribute_list: - { $$ = new std::vector(); } + { $$ = new ASTVec{}; } | attribute_list attribute - { $1->push_back(std::move(*$2)); $$ = $1; } + { $1->emplace_back(ASTNode_up($2)); $$ = $1; } ; attribute: TK_KEY - { $$ = new ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | TK_KEY attribute_value - { $$ = new ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } + { + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + $$ = new ASTNode(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); + } | predef_key - { $$ = new ASTNode(ASTType::PATTR_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::PATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | predef_key attribute_value - { $$ = new ASTNode(ASTType::PATTR_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); } + { + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + $$ = new ASTNode(ASTType::PATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); + } ; attribute_value: spec_const - { $$ = new ASTNode(ASTType::SPECC_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); } + { + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($1)); + $$ = new ASTNode(ASTType::SPECC_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); } | symbol { $$ = $1; } | '(' s_expr_list ')' { - $$ = new ASTNode(ASTType::SEXPRL_T, {osmttokens::t_none}, "", std::vector{std::move(*$2)}); + $$ = new ASTNode(ASTType::SEXPRL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($2)); } ; @@ -274,9 +321,7 @@ identifier: symbol | '(' '_' symbol numeral_list ')' { $$ = $3; - for (auto & el : *$4) { - $$->children.emplace_back(std::move(el)); - } + $$->children = ASTVec_up($4); } ; @@ -284,22 +329,28 @@ sort: identifier { $$ = $1; } | '(' identifier sort sort_list ')' { - $$ = new ASTNode(ASTType::LID_T, {osmttokens::t_none}, "", std::vector{std::move(*$2), std::move(*$3)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + tmp->push_back(ASTNode_up($3)); + $$ = new ASTNode(ASTType::LID_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); for (auto & c : *$4) { - $$->children.push_back(std::move(c)); + $$->children->push_back(std::move(c)); } + delete $4; } ; sort_list: sort_list sort - { $1->push_back(std::move(*$2)); $$ = $1; } + { $1->emplace_back(ASTNode_up($2)); $$ = $1; } | - { $$ = new std::vector(); } + { $$ = new ASTVec(); } ; s_expr: spec_const { - $$ = new ASTNode(ASTType::SPECC_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($1)); + $$ = new ASTNode(ASTType::SPECC_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); } | symbol { @@ -307,36 +358,36 @@ s_expr: spec_const } | TK_KEY { - $$ = new ASTNode(ASTType::UATTR_T, {osmttokens::t_none}, std::move(*$1)); + $$ = new ASTNode(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | '(' s_expr_list ')' { - $$ = new ASTNode(ASTType::SEXPRL_T, {osmttokens::t_none}, "", std::move(*$2)); + $$ = new ASTNode(ASTType::SEXPRL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($2)); } ; s_expr_list: { - $$ = new std::vector(); + $$ = new ASTVec(); } | s_expr_list s_expr { - $1->push_back(std::move(*$2)); + $1->emplace_back(ASTNode_up($2)); $$ = $1; } ; spec_const: TK_NUM - { $$ = new ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | TK_DEC - { $$ = new ASTNode(ASTType::DEC_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::DEC_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | TK_HEX - { $$ = new ASTNode(ASTType::HEX_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::HEX_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | TK_BIN - { $$ = new ASTNode(ASTType::BIN_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::BIN_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | TK_STR - { $$ = new ASTNode(ASTType::STR_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::STR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } ; const_val: symbol @@ -346,87 +397,124 @@ const_val: symbol ; numeral_list: numeral_list TK_NUM - { $1->push_back(ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$2))); $$ = $1; } + { $1->emplace_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); $$ = $1; } | TK_NUM - { $$ = new std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$1))}; } + { $$ = new ASTVec(); $$->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1))); } ; qual_identifier: identifier { $$ = $1; } | '(' TK_AS identifier sort ')' { - $$ = new ASTNode(ASTType::AS_T, {osmttokens::t_none}, "", std::vector{std::move(*$3), std::move(*$4)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + tmp->push_back(ASTNode_up($4)); + $$ = new ASTNode(ASTType::AS_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); } ; var_binding_list: var_binding - { $$ = new std::vector{std::move(*$1)}; } + { $$ = new ASTVec(); $$->push_back(ASTNode_up($1)); } | var_binding_list var_binding - { $1->push_back(std::move(*$2)); $$ = $1; } + { $1->emplace_back(ASTNode_up($2)); $$ = $1; } ; var_binding: '(' symbol term ')' - { $$ = new ASTNode(ASTType::VARB_T, {osmttokens::t_none}, std::string($2->getValue()), std::vector{std::move(*$3)}); } + { + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + $$ = new ASTNode(ASTType::VARB_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr($2->getValue()), std::move(tmp)); + delete $2; + } ; sorted_var_list: - { $$ = new std::vector(); } + { $$ = new ASTVec(); } | sorted_var_list sorted_var - { $1->push_back(std::move(*$2)); $$ = $1; } + { $1->emplace_back(ASTNode_up($2)); $$ = $1; } ; sorted_var: '(' symbol sort ')' - { $$ = new ASTNode(ASTType::SV_T, {osmttokens::t_none}, std::string($2->getValue()), std::vector{std::move(*$3)}); } + { + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + $$ = new ASTNode(ASTType::SV_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr($2->getValue()), std::move(tmp)); + delete $2; + } term_list: - { $$ = new std::vector(); } + { $$ = new ASTVec(); } | term_list term - { $1->push_back(std::move(*$2)); $$ = $1; } + { $1->emplace_back(ASTNode_up($2)); $$ = $1; } ; term: spec_const - { $$ = new ASTNode(ASTType::TERM_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); } + { + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($1)); + $$ = new ASTNode(ASTType::TERM_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); + } | qual_identifier - { $$ = new ASTNode(ASTType::QID_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); } + { + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($1)); + $$ = new ASTNode(ASTType::QID_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); + } | '(' qual_identifier term term_list ')' { - $$ = new ASTNode(ASTType::LQID_T, {osmttokens::t_none}, "", std::vector{std::move(*$2), std::move(*$3)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + tmp->push_back(ASTNode_up($3)); + $$ = new ASTNode(ASTType::LQID_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); for (auto & c : (*$4)) { - $$->children.push_back(std::move(c)); + $$->children->emplace_back(std::move(c)); } + delete $4; } | '(' TK_LET '(' var_binding_list ')' term ')' { - $$ = new ASTNode(ASTType::LET_T, {osmttokens::t_none}, "", {ASTNode(ASTType::VARBL_T, {osmttokens::t_none}, "", std::move(*$4)), std::move(*$6)}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::VARBL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($4))); + tmp->push_back(ASTNode_up($6)); + $$ = new ASTNode(ASTType::LET_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); } | '(' TK_FORALL '(' sorted_var_list ')' term ')' { // todo: AST traversal must ensure that sorted_var_list is non-empty - $$ = new ASTNode(ASTType::FORALL_T, {osmttokens::t_none}, "", {ASTNode(ASTType::SVL_T, {osmttokens::t_none}, "", std::move(*$4)), std::move(*$6)}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::SVL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($4))); + tmp->push_back(ASTNode_up($6)); + $$ = new ASTNode(ASTType::FORALL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); } | '(' TK_EXISTS '(' sorted_var_list ')' term ')' { // todo: AST traversal must ensure that sorted_var_list is non-empty - $$ = new ASTNode(ASTType::EXISTS_T, {osmttokens::t_none}, "", {ASTNode(ASTType::SVL_T, {osmttokens::t_none}, "", std::move(*$4)), std::move(*$6)}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::SVL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($4))); + tmp->push_back(ASTNode_up($6)); + $$ = new ASTNode(ASTType::EXISTS_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); } | '(' '!' term attribute_list ')' { // todo: AST traversal must ensure that attribute_list is non-empty - $$ = new ASTNode(ASTType::BANG_T, {osmttokens::t_none}, "", {std::move(*$3), ASTNode(ASTType::GATTRL_T, {osmttokens::t_none}, "", std::move(*$4))}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($3)); + tmp->push_back(std::make_unique(ASTType::GATTRL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($4))); + $$ = new ASTNode(ASTType::BANG_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); } ; symbol_list: - { $$ = new std::vector(); } + { $$ = new ASTVec(); } | symbol_list symbol - { $1->push_back(*$2); $$ = $1; } + { $1->emplace_back(ASTNode_up($2)); $$ = $1; } ; b_value: symbol { std::string const & str = $1->getValue(); if (str == "true" or str == "false") { - $$ = new ASTNode(ASTType::BOOL_T, {osmttokens::t_none}, std::string(str)); delete $1; + $$ = new ASTNode(ASTType::BOOL_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr(str)); delete $1; } else { printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", str.c_str()); @@ -438,51 +526,75 @@ b_value: symbol option: KW_PRINTSUCCESS b_value { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_EXPANDDEFINITIONS b_value { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_INTERACTIVEMODE b_value { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_PRODUCEPROOFS b_value { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_PRODUCEUNSATCORES b_value { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_PRODUCEMODELS b_value { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_PRODUCEASSIGNMENTS b_value { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{std::move(*$2)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($2)); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_REGULAROUTPUTCHANNEL TK_STR { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{ASTNode(ASTType::STR_T, {osmttokens::t_none}, std::move(*$2))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::STR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_DIAGNOSTICOUTPUTCHANNEL TK_STR { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{ASTNode(ASTType::STR_T, {osmttokens::t_none}, std::move(*$2))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::STR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_RANDOMSEED TK_NUM { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$2))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | KW_VERBOSITY TK_NUM { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, std::move(*$1), std::vector{ASTNode(ASTType::NUM_T, {osmttokens::t_none}, std::move(*$2))}); + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); } | attribute { - $$ = new ASTNode(ASTType::OPTION_T, {osmttokens::t_none}, "", std::vector{std::move(*$1)}); + auto tmp = std::make_unique(); + tmp->push_back(ASTNode_up($1)); + $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); } ; @@ -545,21 +657,25 @@ predef_key: KW_SORTS ; info_flag: KW_ERRORBEHAVIOR - { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | KW_NAME - { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | KW_AUTHORS - { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | KW_VERSION - { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | KW_STATUS - { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | KW_REASONUNKNOWN - { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | KW_ALLSTATISTICS - { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, std::move(*$1)); } + { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } | TK_KEY - { $$ = new ASTNode(ASTType::INFO_T, {osmttokens::t_none}, "", std::vector{ASTNode(ASTType::GATTR_T, {osmttokens::t_none}, std::move(*$1))}); } + { + auto tmp = std::make_unique(); + tmp->push_back(std::make_unique(ASTType::GATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1))); + $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); + } ; %% diff --git a/test/unit/test_LIAInterpolation.cc b/test/unit/test_LIAInterpolation.cc index f78b5708..460da76c 100644 --- a/test/unit/test_LIAInterpolation.cc +++ b/test/unit/test_LIAInterpolation.cc @@ -189,12 +189,12 @@ TEST_F(LIAInterpolationTest, test_Split_ABShared) { std::cout << logic.pp(interpolants[0]) << std::endl; EXPECT_TRUE(verifyInterpolant(partA, partB, interpolants[0])); interpolants.clear(); - config.setBooleanInterpolationAlgorithm(itp_alg_pudlak); + config.setBooleanInterpolationAlgorithm(ItpAlgorithm::itp_alg_pudlak); itpCtx->getSingleInterpolant(interpolants, mask); std::cout << logic.pp(interpolants[0]) << std::endl; EXPECT_TRUE(verifyInterpolant(partA, partB, interpolants[0])); interpolants.clear(); - config.setBooleanInterpolationAlgorithm(itp_alg_mcmillanp); + config.setBooleanInterpolationAlgorithm(ItpAlgorithm::itp_alg_mcmillanp); itpCtx->getSingleInterpolant(interpolants, mask); std::cout << logic.pp(interpolants[0]) << std::endl; EXPECT_TRUE(verifyInterpolant(partA, partB, interpolants[0])); diff --git a/test/unit/test_ResolutionProofInterpolation.cc b/test/unit/test_ResolutionProofInterpolation.cc index 5f8bf2c4..dffa3cb5 100644 --- a/test/unit/test_ResolutionProofInterpolation.cc +++ b/test/unit/test_ResolutionProofInterpolation.cc @@ -46,7 +46,7 @@ class ResolutionProofInterpolationTest : public ::testing::Test { }; TEST_F(ResolutionProofInterpolationTest, test_McMillanInterpolant) { - config.setBooleanInterpolationAlgorithm(itp_alg_mcmillan); + config.setBooleanInterpolationAlgorithm(ItpAlgorithm::itp_alg_mcmillan); auto itpContext = solver->getInterpolationContext(); vec itps; ipartitions_t A_mask = 1; @@ -57,7 +57,7 @@ TEST_F(ResolutionProofInterpolationTest, test_McMillanInterpolant) { } TEST_F(ResolutionProofInterpolationTest, test_PudlakInterpolant) { - config.setBooleanInterpolationAlgorithm(itp_alg_pudlak); + config.setBooleanInterpolationAlgorithm(ItpAlgorithm::itp_alg_pudlak); auto itpContext = solver->getInterpolationContext(); vec itps; ipartitions_t A_mask = 1; @@ -68,7 +68,7 @@ TEST_F(ResolutionProofInterpolationTest, test_PudlakInterpolant) { } TEST_F(ResolutionProofInterpolationTest, test_McMillanPrimeInterpolant) { - config.setBooleanInterpolationAlgorithm(itp_alg_mcmillanp); + config.setBooleanInterpolationAlgorithm(ItpAlgorithm::itp_alg_mcmillanp); auto itpContext = solver->getInterpolationContext(); vec itps; ipartitions_t A_mask = 1; @@ -118,7 +118,7 @@ class ResolutionProofInterpolationTestWithReduction : public ::testing::Test { }; TEST_F(ResolutionProofInterpolationTestWithReduction, test_InterpolationAfterReduction) { - config.setBooleanInterpolationAlgorithm(itp_alg_mcmillan); + config.setBooleanInterpolationAlgorithm(ItpAlgorithm::itp_alg_mcmillan); config.setReduction(1); auto itpContext = solver->getInterpolationContext(); vec itps; @@ -166,7 +166,7 @@ class ResolutionProofIncrementalInterpolationTest : public ::testing::Test { }; TEST_F(ResolutionProofIncrementalInterpolationTest, test_McMillanInterpolant) { - config.setBooleanInterpolationAlgorithm(itp_alg_mcmillan); + config.setBooleanInterpolationAlgorithm(ItpAlgorithm::itp_alg_mcmillan); auto itpContext = solver->getInterpolationContext(); vec itps; ipartitions_t A_mask = 1; diff --git a/test/unit/test_UFInterpolation.cc b/test/unit/test_UFInterpolation.cc index 0e7be4c0..6c6e186d 100644 --- a/test/unit/test_UFInterpolation.cc +++ b/test/unit/test_UFInterpolation.cc @@ -165,7 +165,7 @@ TEST_F(UFInterpolationTest, test_NotImmediatelyColorableCGraph){ itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); // change the interpolation algorithm - config.setEUFInterpolationAlgorithm(itp_euf_alg_weak); + config.setEUFInterpolationAlgorithm(ItpAlgorithm::itp_euf_alg_weak); interpolants.clear(); itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); @@ -194,7 +194,7 @@ TEST_F(UFInterpolationTest, test_NotImmediatelyColorableCGraphReversed){ itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); // change the interpolation algorithm - config.setEUFInterpolationAlgorithm(itp_euf_alg_weak); + config.setEUFInterpolationAlgorithm(ItpAlgorithm::itp_euf_alg_weak); interpolants.clear(); itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); @@ -233,7 +233,7 @@ TEST_F(UFInterpolationTest, test_JustificationRequired){ itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); // change the interpolation algorithm - config.setEUFInterpolationAlgorithm(itp_euf_alg_weak); + config.setEUFInterpolationAlgorithm(ItpAlgorithm::itp_euf_alg_weak); interpolants.clear(); itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); @@ -273,7 +273,7 @@ TEST_F(UFInterpolationTest, test_JustificationRequiredReversed){ itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); // change the interpolation algorithm - config.setEUFInterpolationAlgorithm(itp_euf_alg_weak); + config.setEUFInterpolationAlgorithm(ItpAlgorithm::itp_euf_alg_weak); interpolants.clear(); itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); @@ -351,7 +351,7 @@ TEST_F(UFInterpolationTest, test_TwoLevelJustification){ itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); // change the interpolation algorithm - config.setEUFInterpolationAlgorithm(itp_euf_alg_weak); + config.setEUFInterpolationAlgorithm(ItpAlgorithm::itp_euf_alg_weak); interpolants.clear(); itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); @@ -383,7 +383,7 @@ TEST_F(UFInterpolationTest, test_TwoLevelJustificationDiseqInB){ itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); // change the interpolation algorithm - config.setEUFInterpolationAlgorithm(itp_euf_alg_weak); + config.setEUFInterpolationAlgorithm(ItpAlgorithm::itp_euf_alg_weak); interpolants.clear(); itpCtx->getSingleInterpolant(interpolants, mask); EXPECT_TRUE(verifyInterpolant(interpolants[0], solver.getPartitionManager(), mask)); From 29dd569fef94ac4091e404cd33485162b918da97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 28 Jul 2022 15:16:14 +0200 Subject: [PATCH 21/94] parser: Remove unused generated files --- src/parsers/smt2new/parsetest | Bin 281772 -> 0 bytes src/parsers/smt2new/parsetest.cc | 57 - src/parsers/smt2new/smt2newlexer.cc | 3166 -------------------------- src/parsers/smt2new/smt2newparser.cc | 2887 ----------------------- src/parsers/smt2new/smt2newparser.hh | 160 -- 5 files changed, 6270 deletions(-) delete mode 100755 src/parsers/smt2new/parsetest delete mode 100644 src/parsers/smt2new/parsetest.cc delete mode 100644 src/parsers/smt2new/smt2newlexer.cc delete mode 100644 src/parsers/smt2new/smt2newparser.cc delete mode 100644 src/parsers/smt2new/smt2newparser.hh diff --git a/src/parsers/smt2new/parsetest b/src/parsers/smt2new/parsetest deleted file mode 100755 index e5c150596c59c500a8316e43a6a58f5144f881b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 281772 zcmeFa34D`9*Ec*@TA&nY3Zj-pi5Q^B*0N~JX3{or1=3P!SwysyE>JBkwkeAui*11r zqTI@@=#7H7-0s`0h^WxA6%ZA0LvcYxOxQ$G1QhfA&&*u8k~S?o&-;Dv^ZtI{n|5+$ z&YUxI=FH5Q^}4da<``j66sCO)Y&fIP%*!ntCB7Mpzc!MG>C3{BSWA4zvu><8!p%62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9wCmriE=bP$*(LU~JOj!k3s zc6T`I(|18Sb7|kFFF&{w*3Ccyc+v!TS+FR`LY{o69fp0 z=V=S-ToPJ!YH{{;*xg(0Tf2L@D5QB6+-RpmUePT?DXcK1PuVDIHb+OQz7>MbdFiO7 zJ(kYtmBSlB=i?DC)u3f4AU431$(4z`6rzcxO zvyd%B#!vap4DiNU0cI0&7-T}4O$9l>oAysqPMb{&KO6Y8Vkkid$yS=KtYdrheHk~M z?{@m_u2j2CQ-ZKowpOpXHIwZb%GV{YthPzPEp<^}G+%y@$rkKU-_6k3=(@)A>~3KP zi(b(TADN?^VQN%1wVD~XFswFMG+*)L$>pmORw%Btd+9W*vdTF@I@vcy=}kFaB^J(j zj+YzF>zGy+vP>xm1cKe>c%!^mIehxc!N-3k397R%wEN@;)tXeMD%nFH$8=92Ap4`m9wKnI`Nduu5VjCkJOuD(>Wjp1lF5=qLyGucWX@|8fD^Q%wB>S=FL zhl)&%m~&cRGBslf(W3L+Qqb*O*n*>ztC^PE8d`FxRy!B5MTa@`NsUHk~r* zfWG7wZKWlY87)RR+orFTRSuHgl-E9#qial!?8M7R&V#&XsFg;!#MvtoIbDvj>>(X! z>cHXrAg73?-Pp2`8Pw;cp25nAM6)QbmVC<8Oe%8cuhaXK5^T-LwmUgDUFxEkx7gj3 zgy~1#6eHmj>JBjEm1#FT ztbK{IchAJjp%pO`ugVD_!#Xrx%2vjVq2U4(9R%6qWNfRY@cY7FRQtp*;Hs}H(q`fn zqY{riH7c21o(97c6E^AlULl>!24#D!*|Iu!?xZhv+Q~$#+>Ft?2Cd#Kh+aJ%$`*+~|z5&@g3gg*AhOQX?XkM;_&Q7{M$tyl>jaE9{ pyQ-3Zt!bMA^z&}u5KiPblET({|At729f{( diff --git a/src/parsers/smt2new/parsetest.cc b/src/parsers/smt2new/parsetest.cc deleted file mode 100644 index c7142f82..00000000 --- a/src/parsers/smt2new/parsetest.cc +++ /dev/null @@ -1,57 +0,0 @@ -/********************************************************************* -Author: Antti Hyvarinen - -OpenSMT2 -- Copyright (C) 2012 - 2014 Antti Hyvarinen - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*********************************************************************/ - - -#include -#include -#include -#include - -#include "smt2newcontext.h" - -extern void smt2newset_in ( FILE * ); -extern void smt2newparse ( ); - -int main(int argc, char ** argv) -{ - if (argc > 1 && strcmp(argv[1], "--help") == 0) { - printf("Usage: %s [file]\n", argv[0]); return 1; } - - FILE* in; - if (argc == 2) { - if ((in = fopen(argv[1], "r")) == 0) { - perror("Error opening file"); return 1; } - } - else - in = fopen("/dev/stdin", "r"); - - Smt2newContext context(in); - int rval = smt2newparse(&context); - printf("Parser returned with result %d and ret val %d\n", context.result, rval); - if (rval == 0) - context.prettyPrint(std::cout); - fclose(in); - return rval; -} diff --git a/src/parsers/smt2new/smt2newlexer.cc b/src/parsers/smt2new/smt2newlexer.cc deleted file mode 100644 index c3dc1138..00000000 --- a/src/parsers/smt2new/smt2newlexer.cc +++ /dev/null @@ -1,3166 +0,0 @@ -#line 1 "smt2new/smt2newlexer.cc" - -#line 3 "smt2new/smt2newlexer.cc" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -#ifdef yy_create_buffer -#define smt2new_create_buffer_ALREADY_DEFINED -#else -#define yy_create_buffer smt2new_create_buffer -#endif - -#ifdef yy_delete_buffer -#define smt2new_delete_buffer_ALREADY_DEFINED -#else -#define yy_delete_buffer smt2new_delete_buffer -#endif - -#ifdef yy_scan_buffer -#define smt2new_scan_buffer_ALREADY_DEFINED -#else -#define yy_scan_buffer smt2new_scan_buffer -#endif - -#ifdef yy_scan_string -#define smt2new_scan_string_ALREADY_DEFINED -#else -#define yy_scan_string smt2new_scan_string -#endif - -#ifdef yy_scan_bytes -#define smt2new_scan_bytes_ALREADY_DEFINED -#else -#define yy_scan_bytes smt2new_scan_bytes -#endif - -#ifdef yy_init_buffer -#define smt2new_init_buffer_ALREADY_DEFINED -#else -#define yy_init_buffer smt2new_init_buffer -#endif - -#ifdef yy_flush_buffer -#define smt2new_flush_buffer_ALREADY_DEFINED -#else -#define yy_flush_buffer smt2new_flush_buffer -#endif - -#ifdef yy_load_buffer_state -#define smt2new_load_buffer_state_ALREADY_DEFINED -#else -#define yy_load_buffer_state smt2new_load_buffer_state -#endif - -#ifdef yy_switch_to_buffer -#define smt2new_switch_to_buffer_ALREADY_DEFINED -#else -#define yy_switch_to_buffer smt2new_switch_to_buffer -#endif - -#ifdef yypush_buffer_state -#define smt2newpush_buffer_state_ALREADY_DEFINED -#else -#define yypush_buffer_state smt2newpush_buffer_state -#endif - -#ifdef yypop_buffer_state -#define smt2newpop_buffer_state_ALREADY_DEFINED -#else -#define yypop_buffer_state smt2newpop_buffer_state -#endif - -#ifdef yyensure_buffer_stack -#define smt2newensure_buffer_stack_ALREADY_DEFINED -#else -#define yyensure_buffer_stack smt2newensure_buffer_stack -#endif - -#ifdef yylex -#define smt2newlex_ALREADY_DEFINED -#else -#define yylex smt2newlex -#endif - -#ifdef yyrestart -#define smt2newrestart_ALREADY_DEFINED -#else -#define yyrestart smt2newrestart -#endif - -#ifdef yylex_init -#define smt2newlex_init_ALREADY_DEFINED -#else -#define yylex_init smt2newlex_init -#endif - -#ifdef yylex_init_extra -#define smt2newlex_init_extra_ALREADY_DEFINED -#else -#define yylex_init_extra smt2newlex_init_extra -#endif - -#ifdef yylex_destroy -#define smt2newlex_destroy_ALREADY_DEFINED -#else -#define yylex_destroy smt2newlex_destroy -#endif - -#ifdef yyget_debug -#define smt2newget_debug_ALREADY_DEFINED -#else -#define yyget_debug smt2newget_debug -#endif - -#ifdef yyset_debug -#define smt2newset_debug_ALREADY_DEFINED -#else -#define yyset_debug smt2newset_debug -#endif - -#ifdef yyget_extra -#define smt2newget_extra_ALREADY_DEFINED -#else -#define yyget_extra smt2newget_extra -#endif - -#ifdef yyset_extra -#define smt2newset_extra_ALREADY_DEFINED -#else -#define yyset_extra smt2newset_extra -#endif - -#ifdef yyget_in -#define smt2newget_in_ALREADY_DEFINED -#else -#define yyget_in smt2newget_in -#endif - -#ifdef yyset_in -#define smt2newset_in_ALREADY_DEFINED -#else -#define yyset_in smt2newset_in -#endif - -#ifdef yyget_out -#define smt2newget_out_ALREADY_DEFINED -#else -#define yyget_out smt2newget_out -#endif - -#ifdef yyset_out -#define smt2newset_out_ALREADY_DEFINED -#else -#define yyset_out smt2newset_out -#endif - -#ifdef yyget_leng -#define smt2newget_leng_ALREADY_DEFINED -#else -#define yyget_leng smt2newget_leng -#endif - -#ifdef yyget_text -#define smt2newget_text_ALREADY_DEFINED -#else -#define yyget_text smt2newget_text -#endif - -#ifdef yyget_lineno -#define smt2newget_lineno_ALREADY_DEFINED -#else -#define yyget_lineno smt2newget_lineno -#endif - -#ifdef yyset_lineno -#define smt2newset_lineno_ALREADY_DEFINED -#else -#define yyset_lineno smt2newset_lineno -#endif - -#ifdef yyget_column -#define smt2newget_column_ALREADY_DEFINED -#else -#define yyget_column smt2newget_column -#endif - -#ifdef yyset_column -#define smt2newset_column_ALREADY_DEFINED -#else -#define yyset_column smt2newset_column -#endif - -#ifdef yywrap -#define smt2newwrap_ALREADY_DEFINED -#else -#define yywrap smt2newwrap -#endif - -#ifdef yyget_lval -#define smt2newget_lval_ALREADY_DEFINED -#else -#define yyget_lval smt2newget_lval -#endif - -#ifdef yyset_lval -#define smt2newset_lval_ALREADY_DEFINED -#else -#define yyset_lval smt2newset_lval -#endif - -#ifdef yyget_lloc -#define smt2newget_lloc_ALREADY_DEFINED -#else -#define yyget_lloc smt2newget_lloc -#endif - -#ifdef yyset_lloc -#define smt2newset_lloc_ALREADY_DEFINED -#else -#define yyset_lloc smt2newset_lloc -#endif - -#ifdef yyalloc -#define smt2newalloc_ALREADY_DEFINED -#else -#define yyalloc smt2newalloc -#endif - -#ifdef yyrealloc -#define smt2newrealloc_ALREADY_DEFINED -#else -#define yyrealloc smt2newrealloc -#endif - -#ifdef yyfree -#define smt2newfree_ALREADY_DEFINED -#else -#define yyfree smt2newfree -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -/* begin standard C++ headers. */ - -/* TODO: this is always defined, so inline it */ -#define yyconst const - -#if defined(__GNUC__) && __GNUC__ >= 3 -#define yynoreturn __attribute__((__noreturn__)) -#else -#define yynoreturn -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. - */ -#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) - -/* An opaque pointer. */ -#ifndef YY_TYPEDEF_YY_SCANNER_T -#define YY_TYPEDEF_YY_SCANNER_T -typedef void* yyscan_t; -#endif - -/* For convenience, these vars (plus the bison vars far below) - are macros in the reentrant scanner. */ -#define yyin yyg->yyin_r -#define yyout yyg->yyout_r -#define yyextra yyg->yyextra_r -#define yyleng yyg->yyleng_r -#define yytext yyg->yytext_r -#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) -#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) -#define yy_flex_debug yyg->yy_flex_debug_r - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yyg->yy_start = 1 + 2 * -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yyg->yy_start - 1) / 2) -#define YYSTATE YY_START -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin , yyscanner ) -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytext[yyl] == '\n' )\ - --yylineno;\ - }while(0) - #define YY_LINENO_REWIND_TO(dst) \ - do {\ - const char *p;\ - for ( p = yy_cp-1; p >= (dst); --p)\ - if ( *p == '\n' )\ - --yylineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = yyg->yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) -#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - int yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ - ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ - : NULL) -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] - -void yyrestart ( FILE *input_file , yyscan_t yyscanner ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); -void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -void yypop_buffer_state ( yyscan_t yyscanner ); - -static void yyensure_buffer_stack ( yyscan_t yyscanner ); -static void yy_load_buffer_state ( yyscan_t yyscanner ); -static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) - -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); - -void *yyalloc ( yy_size_t , yyscan_t yyscanner ); -void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); -void yyfree ( void * , yyscan_t yyscanner ); - -#define yy_new_buffer yy_create_buffer -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (yyscanner); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (yyscanner); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -#define smt2newwrap(yyscanner) (/*CONSTCOND*/1) -#define YY_SKIP_YYWRAP -typedef flex_uint8_t YY_CHAR; - -typedef int yy_state_type; - -#define yytext_ptr yytext_r - -static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); -static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); -static int yy_get_next_buffer ( yyscan_t yyscanner ); -static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yyg->yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yyg->yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 91 -#define YY_END_OF_BUFFER 92 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static const flex_int16_t yy_accept[559] = - { 0, - 0, 0, 0, 0, 0, 0, 92, 90, 2, 2, - 3, 75, 90, 72, 74, 72, 68, 68, 90, 1, - 72, 72, 72, 4, 72, 72, 72, 72, 72, 72, - 72, 72, 72, 72, 72, 72, 83, 81, 77, 78, - 76, 82, 91, 87, 85, 86, 84, 89, 88, 2, - 72, 0, 0, 72, 68, 0, 0, 0, 68, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 1, 72, 72, 72, 5, 72, 72, 72, - 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, - 72, 79, 80, 71, 70, 72, 72, 68, 69, 69, - - 68, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, - 9, 11, 28, 72, 72, 72, 72, 72, 72, 69, - 69, 68, 68, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, - 72, 72, 72, 20, 72, 72, 29, 72, 72, 72, - 72, 72, 68, 73, 73, 73, 73, 73, 73, 73, - 40, 73, 73, 61, 73, 73, 73, 73, 73, 73, - - 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, - 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, - 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 62, 45, - 73, 73, 73, 73, 73, 39, 73, 73, 73, 73, - 73, 72, 72, 12, 13, 72, 72, 72, 7, 8, - 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, - 72, 34, 72, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 65, - 73, 44, 73, 73, 6, 10, 72, 72, 72, 72, - - 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, - 72, 72, 72, 73, 63, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 64, 72, 72, 72, 72, 72, 72, 23, 72, - 72, 72, 72, 72, 72, 31, 72, 72, 37, 72, - 72, 73, 73, 73, 73, 73, 73, 73, 73, 47, - 73, 73, 73, 73, 73, 73, 46, 73, 14, 72, - 72, 72, 72, 72, 72, 72, 72, 72, 25, 72, - 27, 72, 30, 72, 72, 72, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - - 73, 73, 73, 59, 72, 72, 72, 19, 72, 72, - 72, 72, 24, 72, 36, 32, 38, 72, 73, 43, - 73, 73, 73, 48, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 72, 16, 72, 18, 72, - 72, 72, 72, 35, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 58, 73, 73, 73, 72, - 15, 72, 72, 72, 72, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 17, - 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, - 49, 73, 73, 73, 73, 73, 73, 73, 21, 22, - - 72, 26, 67, 73, 60, 73, 73, 73, 73, 54, - 52, 73, 66, 73, 73, 72, 73, 73, 73, 73, - 73, 73, 73, 73, 33, 73, 73, 42, 51, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 41, 73, - 50, 73, 73, 73, 73, 55, 53, 73, 73, 73, - 73, 73, 73, 56, 73, 73, 57, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 5, 6, 7, 8, 8, 8, 9, 10, - 10, 8, 8, 1, 11, 12, 13, 14, 15, 16, - 16, 16, 16, 16, 16, 16, 16, 17, 18, 8, - 8, 8, 8, 8, 19, 20, 21, 22, 23, 20, - 24, 8, 25, 8, 8, 26, 27, 28, 8, 8, - 8, 29, 30, 31, 32, 8, 8, 8, 8, 8, - 1, 33, 1, 8, 34, 1, 35, 36, 37, 38, - - 39, 40, 41, 42, 43, 8, 44, 45, 46, 47, - 48, 49, 8, 50, 51, 52, 53, 54, 55, 56, - 57, 8, 1, 58, 1, 8, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static const YY_CHAR yy_meta[59] = - { 0, - 1, 1, 2, 1, 3, 1, 1, 3, 4, 1, - 3, 3, 3, 5, 5, 5, 1, 1, 5, 5, - 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 1, 3, 5, 5, 5, 5, 5, 5, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 1 - } ; - -static const flex_int16_t yy_base[565] = - { 0, - 0, 0, 57, 62, 67, 70, 666, 667, 73, 76, - 0, 667, 26, 0, 667, 69, 77, 92, 94, 0, - 642, 632, 632, 0, 611, 619, 621, 603, 610, 618, - 617, 46, 616, 58, 612, 603, 667, 667, 667, 667, - 667, 667, 80, 667, 667, 667, 667, 667, 667, 107, - 0, 73, 0, 100, 105, 108, 135, 111, 140, 0, - 85, 59, 86, 599, 604, 615, 122, 599, 96, 110, - 606, 124, 0, 626, 619, 616, 593, 604, 124, 599, - 591, 588, 587, 588, 588, 585, 600, 582, 587, 593, - 588, 667, 667, 151, 0, 153, 156, 161, 164, 167, - - 170, 585, 577, 588, 592, 576, 138, 578, 572, 576, - 576, 569, 145, 573, 154, 569, 583, 578, 571, 565, - 589, 590, 587, 572, 573, 564, 565, 140, 572, 595, - 0, 0, 0, 563, 566, 592, 553, 553, 548, 182, - 185, 188, 191, 588, 556, 554, 555, 547, 559, 554, - 541, 552, 549, 550, 549, 540, 548, 547, 533, 530, - 530, 529, 532, 526, 158, 551, 548, 548, 525, 530, - 538, 525, 519, 0, 525, 173, 0, 558, 167, 523, - 517, 527, 203, 514, 516, 516, 515, 511, 513, 512, - 547, 507, 503, 517, 503, 501, 499, 503, 502, 504, - - 497, 494, 496, 506, 496, 500, 523, 522, 516, 487, - 527, 487, 497, 484, 489, 482, 485, 482, 480, 482, - 493, 476, 479, 477, 475, 480, 465, 510, 468, 469, - 475, 469, 505, 477, 463, 475, 477, 476, 0, 0, - 499, 472, 462, 460, 471, 494, 453, 460, 451, 450, - 452, 473, 472, 0, 0, 446, 457, 484, 0, 0, - 443, 171, 441, 444, 440, 445, 437, 448, 446, 434, - 445, 0, 173, 449, 432, 430, 430, 444, 468, 435, - 438, 439, 434, 423, 434, 461, 460, 420, 431, 0, - 429, 0, 424, 419, 0, 0, 430, 453, 174, 189, - - 415, 423, 418, 412, 424, 405, 422, 408, 412, 411, - 396, 399, 399, 398, 0, 406, 396, 408, 408, 397, - 393, 391, 403, 388, 429, 388, 385, 426, 397, 384, - 382, 0, 381, 193, 379, 383, 380, 388, 0, 378, - 379, 386, 373, 385, 371, 0, 385, 373, 0, 373, - 384, 375, 369, 373, 373, 375, 366, 375, 368, 0, - 373, 185, 370, 361, 359, 355, 0, 348, 0, 356, - 350, 354, 354, 350, 347, 351, 348, 349, 0, 384, - 0, 355, 0, 346, 341, 339, 339, 342, 351, 352, - 346, 334, 334, 329, 345, 330, 332, 329, 331, 338, - - 332, 322, 337, 0, 326, 325, 321, 0, 318, 326, - 322, 319, 0, 329, 0, 0, 0, 326, 312, 0, - 352, 308, 318, 0, 317, 320, 319, 306, 318, 307, - 303, 315, 305, 299, 300, 298, 0, 296, 0, 299, - 307, 300, 296, 0, 300, 294, 298, 293, 290, 327, - 286, 293, 296, 286, 298, 0, 284, 282, 287, 277, - 0, 281, 280, 291, 275, 287, 270, 274, 278, 268, - 273, 267, 276, 271, 275, 262, 258, 259, 262, 0, - 259, 257, 261, 268, 255, 253, 254, 251, 259, 253, - 0, 253, 248, 247, 286, 249, 243, 242, 0, 0, - - 241, 0, 0, 243, 0, 248, 242, 251, 242, 0, - 0, 250, 0, 275, 242, 233, 230, 234, 234, 241, - 240, 230, 240, 228, 0, 223, 227, 0, 0, 226, - 222, 229, 223, 258, 217, 215, 227, 227, 0, 222, - 0, 192, 191, 194, 198, 0, 0, 192, 202, 197, - 188, 184, 113, 0, 101, 51, 0, 667, 244, 249, - 252, 255, 260, 62 - } ; - -static const flex_int16_t yy_def[565] = - { 0, - 558, 1, 559, 559, 560, 560, 558, 558, 558, 558, - 561, 558, 558, 561, 558, 561, 558, 558, 562, 563, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 561, 558, 564, 561, 561, 558, 558, 558, 558, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 563, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 558, 558, 558, 564, 561, 561, 561, 558, 558, - - 558, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 558, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - - 562, 562, 562, 562, 562, 562, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 561, 561, 561, 561, 561, 561, - - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - - 562, 562, 562, 562, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 561, - 561, 561, 561, 561, 561, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 561, - 561, 561, 561, 561, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 561, 561, - - 561, 561, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 561, 562, 562, 562, 562, - 562, 562, 562, 562, 561, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 562, 562, 562, - 562, 562, 562, 562, 562, 562, 562, 0, 558, 558, - 558, 558, 558, 558 - } ; - -static const flex_int16_t yy_nxt[726] = - { 0, - 8, 9, 10, 9, 11, 12, 13, 14, 14, 15, - 16, 14, 14, 17, 18, 18, 19, 20, 14, 14, - 14, 21, 14, 14, 14, 14, 14, 22, 14, 23, - 14, 14, 8, 24, 25, 14, 26, 27, 28, 29, - 30, 14, 14, 14, 31, 14, 14, 14, 32, 33, - 34, 35, 14, 14, 36, 14, 14, 37, 39, 40, - 41, 52, 42, 39, 40, 41, 95, 42, 45, 46, - 47, 45, 46, 47, 50, 50, 50, 50, 50, 50, - 84, 53, 54, 55, 55, 92, 94, 94, 56, 43, - 57, 57, 57, 85, 43, 557, 88, 104, 86, 48, - - 89, 105, 48, 56, 58, 59, 59, 59, 50, 50, - 50, 96, 93, 54, 54, 54, 96, 97, 98, 98, - 98, 99, 100, 100, 49, 101, 101, 49, 61, 102, - 114, 62, 63, 64, 115, 106, 65, 103, 66, 556, - 67, 107, 68, 69, 70, 71, 56, 72, 57, 57, - 57, 56, 58, 59, 59, 59, 111, 116, 119, 555, - 126, 117, 120, 127, 94, 94, 140, 141, 141, 112, - 142, 142, 96, 97, 98, 98, 98, 99, 100, 100, - 100, 100, 100, 143, 143, 143, 149, 156, 159, 150, - 173, 174, 157, 205, 160, 140, 141, 141, 141, 141, - - 141, 183, 183, 183, 143, 143, 143, 216, 206, 223, - 301, 224, 312, 335, 225, 217, 183, 183, 183, 396, - 218, 219, 302, 313, 336, 220, 221, 337, 554, 370, - 397, 338, 371, 398, 553, 552, 551, 399, 550, 549, - 548, 547, 546, 372, 38, 38, 38, 38, 38, 44, - 44, 44, 44, 44, 51, 51, 51, 60, 545, 60, - 73, 544, 73, 73, 73, 543, 542, 541, 540, 539, - 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, - 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, - 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, - - 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, - 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, - 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, - 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, - 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, - 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, - 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, - 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, - 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, - 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, - - 408, 407, 406, 405, 404, 403, 402, 401, 400, 395, - 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, - 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, - 374, 373, 369, 368, 367, 366, 365, 364, 363, 362, - 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, - 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, - 341, 340, 339, 334, 333, 332, 331, 330, 329, 328, - 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, - 317, 316, 315, 314, 311, 310, 309, 308, 307, 306, - 305, 304, 303, 300, 299, 298, 297, 296, 295, 294, - - 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, - 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, - 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, - 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, - 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, - 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, - 233, 232, 231, 230, 229, 228, 227, 226, 222, 215, - 214, 213, 212, 211, 210, 209, 208, 207, 204, 203, - 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, - 192, 191, 190, 189, 188, 187, 186, 185, 184, 182, - - 181, 180, 179, 178, 177, 176, 175, 172, 171, 170, - 169, 168, 167, 166, 165, 164, 163, 162, 161, 158, - 155, 154, 153, 152, 151, 148, 147, 146, 145, 144, - 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, - 129, 128, 125, 124, 123, 122, 121, 118, 113, 110, - 109, 108, 91, 90, 87, 83, 82, 81, 80, 79, - 78, 77, 76, 75, 74, 558, 7, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558 - } ; - -static const flex_int16_t yy_chk[726] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, - 3, 13, 3, 4, 4, 4, 564, 4, 5, 5, - 5, 6, 6, 6, 9, 9, 9, 10, 10, 10, - 32, 13, 16, 16, 16, 43, 52, 52, 17, 3, - 17, 17, 17, 32, 4, 556, 34, 62, 32, 5, - - 34, 62, 6, 18, 18, 18, 18, 18, 50, 50, - 50, 54, 43, 54, 54, 54, 55, 55, 55, 55, - 55, 56, 56, 56, 5, 58, 58, 6, 19, 61, - 69, 19, 19, 19, 69, 63, 19, 61, 19, 555, - 19, 63, 19, 19, 19, 19, 57, 19, 57, 57, - 57, 59, 59, 59, 59, 59, 67, 70, 72, 553, - 79, 70, 72, 79, 94, 94, 96, 96, 96, 67, - 97, 97, 98, 98, 98, 98, 98, 99, 99, 99, - 100, 100, 100, 101, 101, 101, 107, 113, 115, 107, - 128, 128, 113, 165, 115, 140, 140, 140, 141, 141, - - 141, 142, 142, 142, 143, 143, 143, 176, 165, 179, - 262, 179, 273, 299, 179, 176, 183, 183, 183, 362, - 176, 176, 262, 273, 299, 176, 176, 300, 552, 334, - 362, 300, 334, 362, 551, 550, 549, 362, 548, 545, - 544, 543, 542, 334, 559, 559, 559, 559, 559, 560, - 560, 560, 560, 560, 561, 561, 561, 562, 540, 562, - 563, 538, 563, 563, 563, 537, 536, 535, 534, 533, - 532, 531, 530, 527, 526, 524, 523, 522, 521, 520, - 519, 518, 517, 516, 515, 514, 512, 509, 508, 507, - 506, 504, 501, 498, 497, 496, 495, 494, 493, 492, - - 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, - 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, - 469, 468, 467, 466, 465, 464, 463, 462, 460, 459, - 458, 457, 455, 454, 453, 452, 451, 450, 449, 448, - 447, 446, 445, 443, 442, 441, 440, 438, 436, 435, - 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, - 423, 422, 421, 419, 418, 414, 412, 411, 410, 409, - 407, 406, 405, 403, 402, 401, 400, 399, 398, 397, - 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, - 386, 385, 384, 382, 380, 378, 377, 376, 375, 374, - - 373, 372, 371, 370, 368, 366, 365, 364, 363, 361, - 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, - 348, 347, 345, 344, 343, 342, 341, 340, 338, 337, - 336, 335, 333, 331, 330, 329, 328, 327, 326, 325, - 324, 323, 322, 321, 320, 319, 318, 317, 316, 314, - 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, - 303, 302, 301, 298, 297, 294, 293, 291, 289, 288, - 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, - 277, 276, 275, 274, 271, 270, 269, 268, 267, 266, - 265, 264, 263, 261, 258, 257, 256, 253, 252, 251, - - 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, - 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, - 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, - 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, - 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, - 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, - 188, 187, 186, 185, 184, 182, 181, 180, 178, 175, - 173, 172, 171, 170, 169, 168, 167, 166, 164, 163, - 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, - 152, 151, 150, 149, 148, 147, 146, 145, 144, 139, - - 138, 137, 136, 135, 134, 130, 129, 127, 126, 125, - 124, 123, 122, 121, 120, 119, 118, 117, 116, 114, - 112, 111, 110, 109, 108, 106, 105, 104, 103, 102, - 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, - 81, 80, 78, 77, 76, 75, 74, 71, 68, 66, - 65, 64, 36, 35, 33, 31, 30, 29, 28, 27, - 26, 25, 23, 22, 21, 7, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558 - } ; - -/* Table of booleans, true if rule could match eol. */ -static const flex_int32_t yy_rule_can_match_eol[92] = - { 0, -0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, }; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -#line 1 "smt2new/smt2newlexer.ll" -/********************************************************************* -Author: Antti Hyvarinen - -OpenSMT2 -- Copyright (C) 2012 - 2014 Antti Hyvarinen - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*********************************************************************/ -#line 36 "smt2new/smt2newlexer.ll" - -#include -#include -#include -#include - -#include "smt2tokens.h" -#include "smt2newcontext.h" -#include "smt2newparser.hh" - -#define YY_EXTRA_TYPE Smt2newContext* -#define YY_USER_ACTION yyget_lloc(yyscanner)->first_line = yyget_lineno(yyscanner); -#line 1065 "smt2new/smt2newlexer.cc" - -#line 1067 "smt2new/smt2newlexer.cc" - -#define INITIAL 0 -#define STR 1 -#define PSYM 2 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -/* Holds the entire state of the reentrant scanner. */ -struct yyguts_t - { - - /* User-defined. Not touched by flex. */ - YY_EXTRA_TYPE yyextra_r; - - /* The rest are the same as the globals declared in the non-reentrant scanner. */ - FILE *yyin_r, *yyout_r; - size_t yy_buffer_stack_top; /**< index of top of stack. */ - size_t yy_buffer_stack_max; /**< capacity of stack. */ - YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ - char yy_hold_char; - int yy_n_chars; - int yyleng_r; - char *yy_c_buf_p; - int yy_init; - int yy_start; - int yy_did_buffer_switch_on_eof; - int yy_start_stack_ptr; - int yy_start_stack_depth; - int *yy_start_stack; - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; - - int yylineno_r; - int yy_flex_debug_r; - - char *yytext_r; - int yy_more_flag; - int yy_more_len; - - YYSTYPE * yylval_r; - - YYLTYPE * yylloc_r; - - }; /* end struct yyguts_t */ - -static int yy_init_globals ( yyscan_t yyscanner ); - - /* This must go here because YYSTYPE and YYLTYPE are included - * from bison output in section 1.*/ - # define yylval yyg->yylval_r - - # define yylloc yyg->yylloc_r - -int yylex_init (yyscan_t* scanner); - -int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy ( yyscan_t yyscanner ); - -int yyget_debug ( yyscan_t yyscanner ); - -void yyset_debug ( int debug_flag , yyscan_t yyscanner ); - -YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); - -void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); - -FILE *yyget_in ( yyscan_t yyscanner ); - -void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); - -FILE *yyget_out ( yyscan_t yyscanner ); - -void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); - - int yyget_leng ( yyscan_t yyscanner ); - -char *yyget_text ( yyscan_t yyscanner ); - -int yyget_lineno ( yyscan_t yyscanner ); - -void yyset_lineno ( int _line_number , yyscan_t yyscanner ); - -int yyget_column ( yyscan_t yyscanner ); - -void yyset_column ( int _column_no , yyscan_t yyscanner ); - -YYSTYPE * yyget_lval ( yyscan_t yyscanner ); - -void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); - - YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); - - void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap ( yyscan_t yyscanner ); -#else -extern int yywrap ( yyscan_t yyscanner ); -#endif -#endif - -#ifndef YY_NO_UNPUT - - static void yyunput ( int c, char *buf_ptr , yyscan_t yyscanner); - -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * , yyscan_t yyscanner); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput ( yyscan_t yyscanner ); -#else -static int input ( yyscan_t yyscanner ); -#endif - -#endif - - static void yy_push_state ( int _new_state , yyscan_t yyscanner); - - static void yy_pop_state ( yyscan_t yyscanner ); - - static int yy_top_state ( yyscan_t yyscanner ); - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - int n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex \ - (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); - -#define YY_DECL int yylex \ - (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - yylval = yylval_param; - - yylloc = yylloc_param; - - if ( !yyg->yy_init ) - { - yyg->yy_init = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yyg->yy_start ) - yyg->yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (yyscanner); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); - } - - yy_load_buffer_state( yyscanner ); - } - - { -#line 53 "smt2new/smt2newlexer.ll" - - -#line 1362 "smt2new/smt2newlexer.cc" - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ - { - yy_cp = yyg->yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yyg->yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yyg->yy_start; -yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 559 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 667 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - int yyl; - for ( yyl = 0; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - - do{ yylineno++; - yycolumn=0; - }while(0) -; - } - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yyg->yy_hold_char; - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 55 "smt2new/smt2newlexer.ll" -// Eat comments - YY_BREAK -case 2: -/* rule 2 can match eol */ -YY_RULE_SETUP -#line 56 "smt2new/smt2newlexer.ll" -// Eat spaces - YY_BREAK -case 3: -YY_RULE_SETUP -#line 58 "smt2new/smt2newlexer.ll" -{ return *yyget_text(yyscanner); } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 59 "smt2new/smt2newlexer.ll" -{ return *yyget_text(yyscanner); } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 60 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_as }; return TK_AS; } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 62 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_DECIMAL }; return TK_DECIMAL; } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 63 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_exists }; return TK_EXISTS; } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 64 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_forall }; return TK_FORALL; } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 65 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_let }; return TK_LET; } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 66 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_NUMERAL }; return TK_NUMERAL; } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 67 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_par }; return TK_PAR; } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 68 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_STRING}; return TK_STRING; } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 70 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_assert }; return TK_ASSERT; } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 71 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_checksat }; return TK_CHECKSAT; } - YY_BREAK -case 15: -YY_RULE_SETUP -#line 72 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_declaresort }; return TK_DECLARESORT; } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 73 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_declarefun }; return TK_DECLAREFUN; } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 74 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_declareconst} ; return TK_DECLARECONST; } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 75 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_definesort }; return TK_DEFINESORT; } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 76 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_definefun }; return TK_DEFINEFUN; } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 77 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_exit }; return TK_EXIT; } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 78 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_getassertions }; return TK_GETASSERTIONS; } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 79 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_getassignment }; return TK_GETASSIGNMENT; } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 80 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_getinfo }; return TK_GETINFO; } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 81 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_getoption }; return TK_GETOPTION; } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 82 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_getproof }; return TK_GETPROOF; } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 83 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_getunsatcore }; return TK_GETUNSATCORE; } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 84 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_getvalue }; return TK_GETVALUE; } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 85 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_pop }; return TK_POP; } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 86 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_push }; return TK_PUSH; } - YY_BREAK -case 30: -YY_RULE_SETUP -#line 87 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_setlogic }; return TK_SETLOGIC; } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 88 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_setinfo }; return TK_SETINFO; } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 89 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_setoption }; return TK_SETOPTION; } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 90 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_getinterpolants }; return TK_GETITPS; } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 91 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_theory }; return TK_THEORY; } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 92 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_writestate }; return TK_WRSTATE; } - YY_BREAK -case 36: -YY_RULE_SETUP -#line 93 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_readstate }; return TK_RDSTATE; } - YY_BREAK -case 37: -YY_RULE_SETUP -#line 94 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_simplify }; return TK_SIMPLIFY; } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 95 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->tok = { t_writefuns }; return TK_WRFUNS; } - YY_BREAK -case 39: -YY_RULE_SETUP -#line 97 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_SORTS; } - YY_BREAK -case 40: -YY_RULE_SETUP -#line 98 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_FUNS; } - YY_BREAK -case 41: -YY_RULE_SETUP -#line 99 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_SORTSDESCRIPTION; } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 100 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_FUNSDESCRIPTION; } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 101 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_DEFINITION; } - YY_BREAK -case 44: -YY_RULE_SETUP -#line 102 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_VALUES; } - YY_BREAK -case 45: -YY_RULE_SETUP -#line 103 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_NOTES; } - YY_BREAK -case 46: -YY_RULE_SETUP -#line 104 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_THEORIES; } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 105 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_LANGUAGE; } - YY_BREAK -case 48: -YY_RULE_SETUP -#line 106 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_EXTENSIONS; } - YY_BREAK -case 49: -YY_RULE_SETUP -#line 107 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRINTSUCCESS; } - YY_BREAK -case 50: -YY_RULE_SETUP -#line 108 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_EXPANDDEFINITIONS; } - YY_BREAK -case 51: -YY_RULE_SETUP -#line 109 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_INTERACTIVEMODE; } - YY_BREAK -case 52: -YY_RULE_SETUP -#line 110 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRODUCEPROOFS; } - YY_BREAK -case 53: -YY_RULE_SETUP -#line 111 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRODUCEUNSATCORES; } - YY_BREAK -case 54: -YY_RULE_SETUP -#line 112 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRODUCEMODELS; } - YY_BREAK -case 55: -YY_RULE_SETUP -#line 113 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_PRODUCEASSIGNMENTS; } - YY_BREAK -case 56: -YY_RULE_SETUP -#line 114 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_REGULAROUTPUTCHANNEL; } - YY_BREAK -case 57: -YY_RULE_SETUP -#line 115 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_DIAGNOSTICOUTPUTCHANNEL; } - YY_BREAK -case 58: -YY_RULE_SETUP -#line 116 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_RANDOMSEED; } - YY_BREAK -case 59: -YY_RULE_SETUP -#line 117 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_VERBOSITY; } - YY_BREAK -case 60: -YY_RULE_SETUP -#line 118 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_ERRORBEHAVIOR; } - YY_BREAK -case 61: -YY_RULE_SETUP -#line 119 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_NAME; } - YY_BREAK -case 62: -YY_RULE_SETUP -#line 120 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_NAMED; } - YY_BREAK -case 63: -YY_RULE_SETUP -#line 121 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_AUTHORS; } - YY_BREAK -case 64: -YY_RULE_SETUP -#line 122 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_VERSION; } - YY_BREAK -case 65: -YY_RULE_SETUP -#line 123 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_STATUS; } - YY_BREAK -case 66: -YY_RULE_SETUP -#line 124 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_REASONUNKNOWN; } - YY_BREAK -case 67: -YY_RULE_SETUP -#line 125 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return KW_ALLSTATISTICS; } - YY_BREAK -case 68: -YY_RULE_SETUP -#line 128 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_NUM; } - YY_BREAK -case 69: -YY_RULE_SETUP -#line 129 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_DEC; } - YY_BREAK -case 70: -YY_RULE_SETUP -#line 130 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_HEX; } - YY_BREAK -case 71: -YY_RULE_SETUP -#line 131 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_BIN; } - YY_BREAK -case 72: -YY_RULE_SETUP -#line 133 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_SYM; } - YY_BREAK -case 73: -YY_RULE_SETUP -#line 134 "smt2new/smt2newlexer.ll" -{ yyget_lval(yyscanner)->str = strdup( yyget_text(yyscanner) ); return TK_KEY; } - YY_BREAK -case 74: -YY_RULE_SETUP -#line 136 "smt2new/smt2newlexer.ll" -{ return *yyget_text(yyscanner); } - YY_BREAK -case 75: -YY_RULE_SETUP -#line 138 "smt2new/smt2newlexer.ll" -{ yy_push_state(STR, yyscanner); } - YY_BREAK - -case 76: -YY_RULE_SETUP -#line 141 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf(' '); } - YY_BREAK -case 77: -YY_RULE_SETUP -#line 142 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf('\t'); } - YY_BREAK -case 78: -/* rule 78 can match eol */ -YY_RULE_SETUP -#line 143 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf('\n'); } - YY_BREAK -case 79: -YY_RULE_SETUP -#line 144 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf('"'); } - YY_BREAK -case 80: -YY_RULE_SETUP -#line 145 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf('\\'); } - YY_BREAK -case 81: -YY_RULE_SETUP -#line 146 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf(yyget_text(yyscanner)[0]); } - YY_BREAK -case 82: -YY_RULE_SETUP -#line 147 "smt2new/smt2newlexer.ll" -{ yylval->str = strdup(yyextra->getBuf()); yyextra->clearBuf(); - yy_pop_state(yyscanner); return TK_STR; } - YY_BREAK - -case 83: -YY_RULE_SETUP -#line 151 "smt2new/smt2newlexer.ll" -{ yy_push_state(PSYM, yyscanner); } - YY_BREAK - -case 84: -YY_RULE_SETUP -#line 154 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf(' '); } - YY_BREAK -case 85: -YY_RULE_SETUP -#line 155 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf('\t'); } - YY_BREAK -case 86: -/* rule 86 can match eol */ -YY_RULE_SETUP -#line 156 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf('\n'); } - YY_BREAK -case 87: -YY_RULE_SETUP -#line 157 "smt2new/smt2newlexer.ll" -{ yyextra->insertBuf(yyget_text(yyscanner)[0]); } - YY_BREAK -case 88: -YY_RULE_SETUP -#line 158 "smt2new/smt2newlexer.ll" -{ yylval->str = strdup(yyextra->getBuf()); yyextra->clearBuf(); - yy_pop_state(yyscanner); return TK_SYM; } - YY_BREAK -case 89: -YY_RULE_SETUP -#line 160 "smt2new/smt2newlexer.ll" -{ printf("Syntax error at line %d near %s, \\ not allowed inside | ... |\n", yyget_lineno(yyscanner), yyget_text(yyscanner)); exit(1); } - YY_BREAK - -case 90: -YY_RULE_SETUP -#line 163 "smt2new/smt2newlexer.ll" -{ printf( "Syntax error at line %d near %s\n", yyget_lineno(yyscanner), yyget_text(yyscanner) ); exit( 1 ); } - YY_BREAK -case 91: -YY_RULE_SETUP -#line 165 "smt2new/smt2newlexer.ll" -ECHO; - YY_BREAK -#line 1895 "smt2new/smt2newlexer.cc" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(STR): -case YY_STATE_EOF(PSYM): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yyg->yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( yyscanner ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); - - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yyg->yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yyg->yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( yyscanner ) ) - { - case EOB_ACT_END_OF_FILE: - { - yyg->yy_did_buffer_switch_on_eof = 0; - - if ( yywrap( yyscanner ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yyg->yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yyg->yy_c_buf_p = - yyg->yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( yyscanner ); - - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yyg->yy_c_buf_p = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; - - yy_current_state = yy_get_previous_state( yyscanner ); - - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = yyg->yytext_ptr; - int number_to_move, i; - int ret_val; - - if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) (yyg->yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - if ( yyg->yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin , yyscanner); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( - (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); - } - - yyg->yy_n_chars += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (yyscan_t yyscanner) -{ - yy_state_type yy_current_state; - char *yy_cp; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - yy_current_state = yyg->yy_start; - - for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 559 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) -{ - int yy_is_jam; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - char *yy_cp = yyg->yy_c_buf_p; - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 559 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 558); - - (void)yyg; - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) -{ - char *yy_cp; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - yy_cp = yyg->yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yyg->yy_hold_char; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = yyg->yy_n_chars + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - if ( c == '\n' ){ - --yylineno; - } - - yyg->yytext_ptr = yy_bp; - yyg->yy_hold_char = *yy_cp; - yyg->yy_c_buf_p = yy_cp; -} - -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (yyscan_t yyscanner) -#else - static int input (yyscan_t yyscanner) -#endif - -{ - int c; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - *yyg->yy_c_buf_p = yyg->yy_hold_char; - - if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) - /* This was really a NUL. */ - *yyg->yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); - ++yyg->yy_c_buf_p; - - switch ( yy_get_next_buffer( yyscanner ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin , yyscanner); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( yyscanner ) ) - return 0; - - if ( ! yyg->yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(yyscanner); -#else - return input(yyscanner); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yyg->yy_c_buf_p = yyg->yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ - *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ - yyg->yy_hold_char = *++yyg->yy_c_buf_p; - - if ( c == '\n' ) - - do{ yylineno++; - yycolumn=0; - }while(0) -; - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * @param yyscanner The scanner object. - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (yyscanner); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); - } - - yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); - yy_load_buffer_state( yyscanner ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * @param yyscanner The scanner object. - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (yyscanner); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *yyg->yy_c_buf_p = yyg->yy_hold_char; - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( yyscanner ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yyg->yy_did_buffer_switch_on_eof = 1; -} - -static void yy_load_buffer_state (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - yyg->yy_hold_char = *yyg->yy_c_buf_p; -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * @param yyscanner The scanner object. - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file , yyscanner); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * @param yyscanner The scanner object. - */ - void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf , yyscanner ); - - yyfree( (void *) b , yyscanner ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) - -{ - int oerrno = errno; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - yy_flush_buffer( b , yyscanner); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * @param yyscanner The scanner object. - */ - void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( yyscanner ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * @param yyscanner The scanner object. - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(yyscanner); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *yyg->yy_c_buf_p = yyg->yy_hold_char; - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - yyg->yy_buffer_stack_top++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( yyscanner ); - yyg->yy_did_buffer_switch_on_eof = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * @param yyscanner The scanner object. - */ -void yypop_buffer_state (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); - YY_CURRENT_BUFFER_LVALUE = NULL; - if (yyg->yy_buffer_stack_top > 0) - --yyg->yy_buffer_stack_top; - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( yyscanner ); - yyg->yy_did_buffer_switch_on_eof = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (yyscan_t yyscanner) -{ - yy_size_t num_to_alloc; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - if (!yyg->yy_buffer_stack) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - , yyscanner); - if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - yyg->yy_buffer_stack_max = num_to_alloc; - yyg->yy_buffer_stack_top = 0; - return; - } - - if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = yyg->yy_buffer_stack_max + grow_size; - yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc - (yyg->yy_buffer_stack, - num_to_alloc * sizeof(struct yy_buffer_state*) - , yyscanner); - if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); - yyg->yy_buffer_stack_max = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * @param yyscanner The scanner object. - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return NULL; - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = NULL; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b , yyscanner ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * @param yyscanner The scanner object. - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) -{ - - return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * @param yyscanner The scanner object. - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n , yyscanner ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n , yyscanner); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - - static void yy_push_state (int _new_state , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) - { - yy_size_t new_size; - - yyg->yy_start_stack_depth += YY_START_STACK_INCR; - new_size = (yy_size_t) yyg->yy_start_stack_depth * sizeof( int ); - - if ( ! yyg->yy_start_stack ) - yyg->yy_start_stack = (int *) yyalloc( new_size , yyscanner ); - - else - yyg->yy_start_stack = (int *) yyrealloc( - (void *) yyg->yy_start_stack, new_size , yyscanner ); - - if ( ! yyg->yy_start_stack ) - YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); - } - - yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; - - BEGIN(_new_state); -} - - static void yy_pop_state (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( --yyg->yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); -} - - static int yy_top_state (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = yyg->yy_hold_char; \ - yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ - yyg->yy_hold_char = *yyg->yy_c_buf_p; \ - *yyg->yy_c_buf_p = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the user-defined data for this scanner. - * @param yyscanner The scanner object. - */ -YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yyextra; -} - -/** Get the current line number. - * @param yyscanner The scanner object. - */ -int yyget_lineno (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - if (! YY_CURRENT_BUFFER) - return 0; - - return yylineno; -} - -/** Get the current column number. - * @param yyscanner The scanner object. - */ -int yyget_column (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - if (! YY_CURRENT_BUFFER) - return 0; - - return yycolumn; -} - -/** Get the input stream. - * @param yyscanner The scanner object. - */ -FILE *yyget_in (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yyin; -} - -/** Get the output stream. - * @param yyscanner The scanner object. - */ -FILE *yyget_out (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yyout; -} - -/** Get the length of the current token. - * @param yyscanner The scanner object. - */ -int yyget_leng (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yyleng; -} - -/** Get the current token. - * @param yyscanner The scanner object. - */ - -char *yyget_text (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yytext; -} - -/** Set the user-defined data. This data is never touched by the scanner. - * @param user_defined The data to be associated with this scanner. - * @param yyscanner The scanner object. - */ -void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyextra = user_defined ; -} - -/** Set the current line number. - * @param _line_number line number - * @param yyscanner The scanner object. - */ -void yyset_lineno (int _line_number , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - /* lineno is only valid if an input buffer exists. */ - if (! YY_CURRENT_BUFFER ) - YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); - - yylineno = _line_number; -} - -/** Set the current column. - * @param _column_no column number - * @param yyscanner The scanner object. - */ -void yyset_column (int _column_no , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - /* column is only valid if an input buffer exists. */ - if (! YY_CURRENT_BUFFER ) - YY_FATAL_ERROR( "yyset_column called with no buffer" ); - - yycolumn = _column_no; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param _in_str A readable stream. - * @param yyscanner The scanner object. - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * _in_str , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = _in_str ; -} - -void yyset_out (FILE * _out_str , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = _out_str ; -} - -int yyget_debug (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yy_flex_debug; -} - -void yyset_debug (int _bdebug , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = _bdebug ; -} - -/* Accessor methods for yylval and yylloc */ - -YYSTYPE * yyget_lval (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yylval; -} - -void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yylval = yylval_param; -} - -YYLTYPE *yyget_lloc (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yylloc; -} - -void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yylloc = yylloc_param; -} - -/* User-visible API */ - -/* yylex_init is special because it creates the scanner itself, so it is - * the ONLY reentrant function that doesn't take the scanner as the last argument. - * That's why we explicitly handle the declaration, instead of using our macros. - */ -int yylex_init(yyscan_t* ptr_yy_globals) -{ - if (ptr_yy_globals == NULL){ - errno = EINVAL; - return 1; - } - - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); - - if (*ptr_yy_globals == NULL){ - errno = ENOMEM; - return 1; - } - - /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ - memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - - return yy_init_globals ( *ptr_yy_globals ); -} - -/* yylex_init_extra has the same functionality as yylex_init, but follows the - * convention of taking the scanner as the last argument. Note however, that - * this is a *pointer* to a scanner, as it will be allocated by this call (and - * is the reason, too, why this function also must handle its own declaration). - * The user defined value in the first argument will be available to yyalloc in - * the yyextra field. - */ -int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) -{ - struct yyguts_t dummy_yyguts; - - yyset_extra (yy_user_defined, &dummy_yyguts); - - if (ptr_yy_globals == NULL){ - errno = EINVAL; - return 1; - } - - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); - - if (*ptr_yy_globals == NULL){ - errno = ENOMEM; - return 1; - } - - /* By setting to 0xAA, we expose bugs in - yy_init_globals. Leave at 0x00 for releases. */ - memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - - yyset_extra (yy_user_defined, *ptr_yy_globals); - - return yy_init_globals ( *ptr_yy_globals ); -} - -static int yy_init_globals (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - yyg->yy_buffer_stack = NULL; - yyg->yy_buffer_stack_top = 0; - yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = NULL; - yyg->yy_init = 0; - yyg->yy_start = 0; - - yyg->yy_start_stack_ptr = 0; - yyg->yy_start_stack_depth = 0; - yyg->yy_start_stack = NULL; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = NULL; - yyout = NULL; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(yyscanner); - } - - /* Destroy the stack itself. */ - yyfree(yyg->yy_buffer_stack , yyscanner); - yyg->yy_buffer_stack = NULL; - - /* Destroy the start condition stack. */ - yyfree( yyg->yy_start_stack , yyscanner ); - yyg->yy_start_stack = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( yyscanner); - - /* Destroy the main struct (reentrant only). */ - yyfree ( yyscanner , yyscanner ); - yyscanner = NULL; - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (const char * s , yyscan_t yyscanner) -{ - int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - return malloc(size); -} - -void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return realloc(ptr, size); -} - -void yyfree (void * ptr , yyscan_t yyscanner) -{ - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 165 "smt2new/smt2newlexer.ll" - - -int Smt2newContext::init_scanner() -{ - if (is != NULL) { - yylex_init_extra(this, &scanner); - yyset_in(is, scanner); - } - else if (ib != NULL) { - yylex_init(&scanner); - yylex_init_extra(this, &scanner); - yy_scan_string(ib, scanner); - } - else - return -1; - return 0; -} - -void Smt2newContext::destroy_scanner() -{ - yylex_destroy(scanner); -} - - diff --git a/src/parsers/smt2new/smt2newparser.cc b/src/parsers/smt2new/smt2newparser.cc deleted file mode 100644 index 6a3c8730..00000000 --- a/src/parsers/smt2new/smt2newparser.cc +++ /dev/null @@ -1,2887 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.0.4" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 1 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - -/* Substitute the variable and function names. */ -#define yyparse smt2newparse -#define yylex smt2newlex -#define yyerror smt2newerror -#define yydebug smt2newdebug -#define yynerrs smt2newnerrs - - -/* Copy the first part of user declarations. */ -#line 35 "smt2new/smt2newparser.yy" /* yacc.c:339 */ - -#include -#include -#include -#include -#include -#include -#include - -#include "smt2newcontext.h" -#include "smt2newparser.hh" -#include "smt2tokens.h" - -int smt2newlex(YYSTYPE* lvalp, YYLTYPE* llocp, void* scanner); - -void smt2newerror( YYLTYPE* locp, Smt2newContext* context, const char * s ) -{ - if (context->interactive) - printf("At interactive input: %s\n", s); - else - printf( "At line %d: %s\n", locp->first_line, s ); -// exit( 1 ); -} - -#define scanner context->scanner - -/* Overallocation to prevent stack overflow */ -#define YYMAXDEPTH 1024 * 1024 - -#line 102 "smt2new/smt2newparser.cc" /* yacc.c:339 */ - -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 1 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "smt2newparser.hh". */ -#ifndef YY_SMT2NEW_SMT2NEW_SMT2NEWPARSER_HH_INCLUDED -# define YY_SMT2NEW_SMT2NEW_SMT2NEWPARSER_HH_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int smt2newdebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - TK_AS = 258, - TK_DECIMAL = 259, - TK_EXISTS = 260, - TK_FORALL = 261, - TK_LET = 262, - TK_NUMERAL = 263, - TK_PAR = 264, - TK_STRING = 265, - TK_ASSERT = 266, - TK_CHECKSAT = 267, - TK_DECLARESORT = 268, - TK_DECLAREFUN = 269, - TK_DECLARECONST = 270, - TK_DEFINESORT = 271, - TK_DEFINEFUN = 272, - TK_EXIT = 273, - TK_GETASSERTIONS = 274, - TK_GETASSIGNMENT = 275, - TK_GETINFO = 276, - TK_GETOPTION = 277, - TK_GETPROOF = 278, - TK_GETUNSATCORE = 279, - TK_GETVALUE = 280, - TK_POP = 281, - TK_PUSH = 282, - TK_SETLOGIC = 283, - TK_SETINFO = 284, - TK_SETOPTION = 285, - TK_THEORY = 286, - TK_GETITPS = 287, - TK_WRSTATE = 288, - TK_RDSTATE = 289, - TK_SIMPLIFY = 290, - TK_WRFUNS = 291, - TK_NUM = 292, - TK_SYM = 293, - TK_KEY = 294, - TK_STR = 295, - TK_DEC = 296, - TK_HEX = 297, - TK_BIN = 298, - KW_SORTS = 299, - KW_FUNS = 300, - KW_SORTSDESCRIPTION = 301, - KW_FUNSDESCRIPTION = 302, - KW_DEFINITION = 303, - KW_NOTES = 304, - KW_THEORIES = 305, - KW_LANGUAGE = 306, - KW_EXTENSIONS = 307, - KW_VALUES = 308, - KW_PRINTSUCCESS = 309, - KW_EXPANDDEFINITIONS = 310, - KW_INTERACTIVEMODE = 311, - KW_PRODUCEPROOFS = 312, - KW_PRODUCEUNSATCORES = 313, - KW_PRODUCEMODELS = 314, - KW_PRODUCEASSIGNMENTS = 315, - KW_REGULAROUTPUTCHANNEL = 316, - KW_DIAGNOSTICOUTPUTCHANNEL = 317, - KW_RANDOMSEED = 318, - KW_VERBOSITY = 319, - KW_ERRORBEHAVIOR = 320, - KW_NAME = 321, - KW_NAMED = 322, - KW_AUTHORS = 323, - KW_VERSION = 324, - KW_STATUS = 325, - KW_REASONUNKNOWN = 326, - KW_ALLSTATISTICS = 327 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE -{ -#line 66 "smt2new/smt2newparser.yy" /* yacc.c:355 */ - - char * str; - std::vector< std::string > * str_list; - ASTNode * snode; - std::list< ASTNode * > * snode_list; - smt2token tok; - -#line 223 "smt2new/smt2newparser.cc" /* yacc.c:355 */ -}; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - -/* Location type. */ -#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE YYLTYPE; -struct YYLTYPE -{ - int first_line; - int first_column; - int last_line; - int last_column; -}; -# define YYLTYPE_IS_DECLARED 1 -# define YYLTYPE_IS_TRIVIAL 1 -#endif - - - -int smt2newparse (Smt2newContext* context); - -#endif /* !YY_SMT2NEW_SMT2NEW_SMT2NEWPARSER_HH_INCLUDED */ - -/* Copy the second part of user declarations. */ - -#line 253 "smt2new/smt2newparser.cc" /* yacc.c:358 */ - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ - && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; - YYLTYPE yyls_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ - + 2 * YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 3 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 378 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 77 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 27 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 129 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 246 - -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 327 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 76, 2, 2, 2, 2, 2, 2, - 73, 74, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 75, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72 -}; - -#if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 97, 97, 101, 102, 106, 112, 118, 124, 131, - 144, 156, 168, 181, 187, 193, 199, 203, 207, 211, - 215, 221, 227, 233, 237, 243, 247, 253, 259, 265, - 269, 274, 275, 279, 281, 283, 285, 289, 291, 295, - 302, 304, 308, 310, 318, 321, 324, 330, 334, 338, - 346, 349, 357, 359, 361, 363, 365, 369, 371, 375, - 377, 381, 383, 393, 394, 398, 403, 404, 408, 412, - 413, 417, 419, 421, 428, 438, 448, 458, 535, 536, - 693, 706, 712, 718, 724, 730, 736, 742, 748, 754, - 760, 766, 772, 780, 782, 784, 786, 788, 790, 792, - 794, 796, 798, 800, 802, 804, 806, 808, 810, 812, - 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, - 834, 836, 840, 842, 844, 846, 848, 850, 852, 854 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 1 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "TK_AS", "TK_DECIMAL", "TK_EXISTS", - "TK_FORALL", "TK_LET", "TK_NUMERAL", "TK_PAR", "TK_STRING", "TK_ASSERT", - "TK_CHECKSAT", "TK_DECLARESORT", "TK_DECLAREFUN", "TK_DECLARECONST", - "TK_DEFINESORT", "TK_DEFINEFUN", "TK_EXIT", "TK_GETASSERTIONS", - "TK_GETASSIGNMENT", "TK_GETINFO", "TK_GETOPTION", "TK_GETPROOF", - "TK_GETUNSATCORE", "TK_GETVALUE", "TK_POP", "TK_PUSH", "TK_SETLOGIC", - "TK_SETINFO", "TK_SETOPTION", "TK_THEORY", "TK_GETITPS", "TK_WRSTATE", - "TK_RDSTATE", "TK_SIMPLIFY", "TK_WRFUNS", "TK_NUM", "TK_SYM", "TK_KEY", - "TK_STR", "TK_DEC", "TK_HEX", "TK_BIN", "KW_SORTS", "KW_FUNS", - "KW_SORTSDESCRIPTION", "KW_FUNSDESCRIPTION", "KW_DEFINITION", "KW_NOTES", - "KW_THEORIES", "KW_LANGUAGE", "KW_EXTENSIONS", "KW_VALUES", - "KW_PRINTSUCCESS", "KW_EXPANDDEFINITIONS", "KW_INTERACTIVEMODE", - "KW_PRODUCEPROOFS", "KW_PRODUCEUNSATCORES", "KW_PRODUCEMODELS", - "KW_PRODUCEASSIGNMENTS", "KW_REGULAROUTPUTCHANNEL", - "KW_DIAGNOSTICOUTPUTCHANNEL", "KW_RANDOMSEED", "KW_VERBOSITY", - "KW_ERRORBEHAVIOR", "KW_NAME", "KW_NAMED", "KW_AUTHORS", "KW_VERSION", - "KW_STATUS", "KW_REASONUNKNOWN", "KW_ALLSTATISTICS", "'('", "')'", "'_'", - "'!'", "$accept", "script", "command_list", "command", "attribute_list", - "attribute", "attribute_value", "identifier", "sort", "sort_list", - "s_expr", "s_expr_list", "spec_const", "const_val", "numeral_list", - "qual_identifier", "var_binding_list", "var_binding", "sorted_var_list", - "sorted_var", "term_list", "term", "symbol_list", "b_value", "option", - "predef_key", "info_flag", YY_NULLPTR -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 40, 41, 95, 33 -}; -# endif - -#define YYPACT_NINF -161 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-161))) - -#define YYTABLE_NINF -1 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = -{ - -161, 10, -58, -161, 342, -161, -1, -10, 27, 29, - 112, 32, 33, 3, 5, 11, 104, 212, 12, 13, - 1, 43, 47, 50, 246, 280, 17, 54, 65, 36, - 73, -161, -161, -161, -161, -161, -161, 0, -161, -161, - -161, 44, -161, 82, 49, -161, -161, 53, 61, 62, - -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, - -161, 57, 63, -161, -161, -161, -161, -161, -161, -161, - -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, - -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, - -161, -161, 64, -161, -161, -1, 67, 68, 70, 87, - 71, 87, 98, 98, 98, 98, 98, 98, 98, 111, - 116, 120, 121, -161, 85, -161, 93, 97, -161, 103, - -22, 105, 106, 107, 6, 143, -1, -1, -161, 108, - -161, 109, -161, -161, -161, -161, -161, -161, -161, -161, - -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, - -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, - -161, -161, -161, 110, -14, 113, 113, 114, 147, 246, - -161, -161, -11, -14, -24, -48, 66, -20, -27, -161, - 115, 150, -161, -161, 152, -161, -161, -25, -161, 74, - -14, -161, 118, -161, -14, -14, -161, 119, -161, -161, - -161, -161, -161, -161, -161, -14, -161, -14, -45, -42, - -1, -30, -161, -161, 178, -161, 122, -161, 123, -1, - -161, 59, -161, 124, -1, -1, 125, -1, -161, -161, - -161, -161, -161, 126, -161, -5, -161, 127, 128, -161, - 129, -161, -161, -161, -161, -161 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 3, 0, 2, 1, 0, 4, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 52, 40, 56, 53, 54, 55, 0, 61, 71, - 72, 0, 16, 0, 0, 57, 58, 0, 0, 0, - 30, 17, 25, 129, 122, 123, 124, 125, 126, 127, - 128, 0, 0, 93, 94, 95, 96, 97, 99, 100, - 101, 102, 98, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 0, 18, 23, 0, 0, 0, 0, 33, - 0, 35, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 92, 0, 19, 0, 0, 29, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, - 45, 0, 78, 66, 28, 26, 27, 69, 14, 13, - 5, 38, 50, 34, 37, 7, 36, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 6, - 20, 21, 22, 0, 0, 0, 0, 0, 0, 0, - 69, 8, 0, 0, 0, 0, 0, 0, 0, 42, - 0, 0, 66, 66, 0, 63, 60, 0, 31, 0, - 0, 44, 0, 79, 0, 0, 67, 0, 70, 47, - 48, 50, 39, 51, 46, 0, 62, 0, 0, 0, - 0, 0, 59, 41, 0, 73, 0, 11, 0, 0, - 24, 0, 45, 0, 0, 0, 0, 0, 64, 77, - 32, 10, 9, 0, 49, 0, 68, 0, 0, 65, - 0, 12, 43, 76, 75, 74 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -161, -161, -161, -161, -161, -23, 94, -112, -160, -28, - -161, 4, -9, -161, -161, 169, -161, -4, -127, -108, - 38, -6, -161, 58, -161, 192, -161 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 1, 2, 5, 214, 100, 143, 38, 191, 172, - 203, 177, 39, 47, 187, 40, 211, 185, 175, 196, - 176, 198, 174, 148, 114, 101, 61 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_uint8 yytable[] = -{ - 41, 46, 113, 120, 180, 121, 122, 123, 164, 120, - 3, 32, 212, 192, 193, 4, 32, 31, 199, 200, - 33, 34, 35, 36, 32, 181, 195, 32, 181, 224, - 216, 181, 225, 32, 218, 219, 31, 32, 32, 33, - 34, 35, 36, 184, 227, 222, 163, 223, 125, 213, - 194, 163, 179, 201, 202, 208, 209, 182, 183, 178, - 179, 179, 178, 190, 42, 43, 205, 44, 178, 242, - 48, 49, 37, 124, 95, 125, 126, 50, 179, 51, - 96, 125, 179, 179, 97, 52, 93, 94, 98, 137, - 144, 115, 144, 179, 116, 179, 31, 199, 200, 33, - 34, 35, 36, 31, 32, 117, 33, 34, 35, 36, - 118, 31, 32, 119, 33, 34, 35, 36, 128, 129, - 169, 170, 130, 179, 31, 141, 131, 33, 34, 35, - 36, 134, 201, 234, 132, 133, 147, 135, 136, 37, - 197, 138, 139, 53, 140, 145, 188, 37, 215, 31, - 45, 155, 33, 34, 35, 36, 156, 157, 158, 159, - 142, 149, 150, 151, 152, 153, 154, 160, 204, 54, - 55, 161, 56, 57, 58, 59, 60, 162, 165, 166, - 167, 168, 171, 173, 186, 125, 181, 184, 207, 206, - 210, 230, 217, 220, 235, 146, 231, 232, 236, 239, - 241, 243, 244, 245, 226, 221, 127, 228, 189, 92, - 0, 0, 204, 233, 0, 0, 0, 99, 237, 238, - 0, 240, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 62, 229, 0, 0, 0, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 99, 0, 0, 0, 0, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 99, - 0, 0, 0, 0, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 84, 85, 86, 87, 88, - 89, 90, 91, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 0, 26, 27, 28, 29, 30 -}; - -static const yytype_int16 yycheck[] = -{ - 6, 10, 25, 3, 164, 5, 6, 7, 120, 3, - 0, 38, 37, 173, 38, 73, 38, 37, 38, 39, - 40, 41, 42, 43, 38, 73, 74, 38, 73, 74, - 190, 73, 74, 38, 194, 195, 37, 38, 38, 40, - 41, 42, 43, 73, 74, 205, 73, 207, 75, 74, - 74, 73, 164, 73, 74, 182, 183, 165, 166, 73, - 172, 173, 73, 74, 74, 38, 178, 38, 73, 74, - 38, 38, 73, 73, 73, 75, 76, 74, 190, 74, - 37, 75, 194, 195, 37, 74, 74, 74, 38, 95, - 99, 74, 101, 205, 40, 207, 37, 38, 39, 40, - 41, 42, 43, 37, 38, 40, 40, 41, 42, 43, - 74, 37, 38, 40, 40, 41, 42, 43, 74, 37, - 126, 127, 73, 235, 37, 38, 73, 40, 41, 42, - 43, 74, 73, 74, 73, 73, 38, 74, 74, 73, - 74, 74, 74, 39, 74, 74, 169, 73, 74, 37, - 38, 40, 40, 41, 42, 43, 40, 37, 37, 74, - 73, 103, 104, 105, 106, 107, 108, 74, 177, 65, - 66, 74, 68, 69, 70, 71, 72, 74, 73, 73, - 73, 38, 74, 74, 37, 75, 73, 73, 38, 74, - 38, 214, 74, 74, 222, 101, 74, 74, 74, 74, - 74, 74, 74, 74, 210, 201, 37, 211, 170, 17, - -1, -1, 221, 219, -1, -1, -1, 39, 224, 225, - -1, 227, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 39, 74, -1, -1, -1, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 39, -1, -1, -1, -1, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 39, - -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, -1, 32, 33, 34, 35, 36 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 78, 79, 0, 73, 80, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, - 36, 37, 38, 40, 41, 42, 43, 73, 84, 89, - 92, 98, 74, 38, 38, 38, 89, 90, 38, 38, - 74, 74, 74, 39, 65, 66, 68, 69, 70, 71, - 72, 103, 39, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 102, 74, 74, 73, 37, 37, 38, 39, - 82, 102, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 82, 101, 74, 40, 40, 74, 40, - 3, 5, 6, 7, 73, 75, 76, 92, 74, 37, - 73, 73, 73, 73, 74, 74, 74, 98, 74, 74, - 74, 38, 73, 83, 89, 74, 83, 38, 100, 100, - 100, 100, 100, 100, 100, 40, 40, 37, 37, 74, - 74, 74, 74, 73, 84, 73, 73, 73, 38, 98, - 98, 74, 86, 74, 99, 95, 97, 88, 73, 84, - 85, 73, 96, 96, 73, 94, 37, 91, 82, 97, - 74, 85, 85, 38, 74, 74, 96, 74, 98, 38, - 39, 73, 74, 87, 89, 84, 74, 38, 95, 95, - 38, 93, 37, 74, 81, 74, 85, 74, 85, 85, - 74, 88, 85, 85, 74, 74, 98, 74, 94, 74, - 82, 74, 74, 98, 74, 86, 74, 98, 98, 74, - 98, 74, 74, 74, 74, 74 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 77, 78, 79, 79, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 81, 81, 82, 82, 82, 82, 83, 83, 83, - 84, 84, 85, 85, 86, 86, 87, 87, 87, 87, - 88, 88, 89, 89, 89, 89, 89, 90, 90, 91, - 91, 92, 92, 93, 93, 94, 95, 95, 96, 97, - 97, 98, 98, 98, 98, 98, 98, 98, 99, 99, - 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, - 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 103, 103, 103, 103, 103, 103, 103, 103 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 0, 2, 4, 4, 4, 5, 8, - 8, 7, 9, 4, 4, 4, 3, 3, 3, 3, - 4, 4, 4, 3, 7, 3, 4, 4, 4, 3, - 3, 0, 2, 1, 2, 1, 2, 1, 1, 3, - 1, 5, 1, 5, 2, 0, 1, 1, 1, 3, - 0, 2, 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 5, 0, 2, 4, 0, 2, 4, 0, - 2, 1, 1, 5, 8, 8, 8, 6, 0, 2, - 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (&yylloc, context, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (N) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (0) -#endif - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL - -/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ - -YY_ATTRIBUTE_UNUSED -static unsigned -yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) -{ - unsigned res = 0; - int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; - if (0 <= yylocp->first_line) - { - res += YYFPRINTF (yyo, "%d", yylocp->first_line); - if (0 <= yylocp->first_column) - res += YYFPRINTF (yyo, ".%d", yylocp->first_column); - } - if (0 <= yylocp->last_line) - { - if (yylocp->first_line < yylocp->last_line) - { - res += YYFPRINTF (yyo, "-%d", yylocp->last_line); - if (0 <= end_col) - res += YYFPRINTF (yyo, ".%d", end_col); - } - else if (0 <= end_col && yylocp->first_column < end_col) - res += YYFPRINTF (yyo, "-%d", end_col); - } - return res; - } - -# define YY_LOCATION_PRINT(File, Loc) \ - yy_location_print_ (File, &(Loc)) - -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, Location, context); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, Smt2newContext* context) -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - YYUSE (yylocationp); - YYUSE (context); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, Smt2newContext* context) -{ - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - YY_LOCATION_PRINT (yyoutput, *yylocationp); - YYFPRINTF (yyoutput, ": "); - yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, Smt2newContext* context) -{ - unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , &(yylsp[(yyi + 1) - (yynrhs)]) , context); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, yylsp, Rule, context); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, Smt2newContext* context) -{ - YYUSE (yyvaluep); - YYUSE (yylocationp); - YYUSE (context); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (Smt2newContext* context) -{ -/* The lookahead symbol. */ -int yychar; - - -/* The semantic value of the lookahead symbol. */ -/* Default value used for initialization, for pacifying older GCCs - or non-GCC compilers. */ -YY_INITIAL_VALUE (static YYSTYPE yyval_default;) -YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); - -/* Location data for the lookahead symbol. */ -static YYLTYPE yyloc_default -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL - = { 1, 1, 1, 1 } -# endif -; -YYLTYPE yylloc = yyloc_default; - - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - 'yyls': related to locations. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls; - YYLTYPE *yylsp; - - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[3]; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yylsp = yyls = yylsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - yylsp[0] = yylloc; - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - YYLTYPE *yyls1 = yyls; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), - &yystacksize); - - yyls = yyls1; - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); - YYSTACK_RELOCATE (yyls_alloc, yyls); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - yylsp = yyls + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (&yylval, &yylloc, scanner); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - *++yylsp = yylloc; - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - /* Default location. */ - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 97 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { ASTNode *n = new ASTNode(CMDL_T, strdup("main-script")); n->children = (yyvsp[0].snode_list); context->insertRoot(n); } -#line 1642 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 3: -#line 101 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode_list) = new std::list(); } -#line 1648 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 4: -#line 103 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (*(yyvsp[-1].snode_list)).push_back((yyvsp[0].snode)); (yyval.snode_list) = (yyvsp[-1].snode_list); } -#line 1654 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 5: -#line 107 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(SYM_T, (yyvsp[-1].str))); - } -#line 1664 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 6: -#line 113 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 1674 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 7: -#line 119 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 1684 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 8: -#line 125 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-3].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(SYM_T, (yyvsp[-2].str))); - (yyval.snode)->children->push_back(new ASTNode(NUM_T, (yyvsp[-1].str))); - } -#line 1695 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 9: -#line 132 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-6].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(SYM_T, (yyvsp[-5].str))); - - ASTNode* syml = new ASTNode(SYML_T, NULL); - syml->children = (yyvsp[-3].snode_list); - (yyval.snode)->children->push_back(syml); - - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 1711 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 10: -#line 145 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-6].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(SYM_T, (yyvsp[-5].str))); - - ASTNode* sortl = new ASTNode(SORTL_T, NULL); - sortl->children = (yyvsp[-3].snode_list); - (yyval.snode)->children->push_back(sortl); - - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 1727 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 11: -#line 157 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-5].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[-4].snode)); - - ASTNode* sortl = new ASTNode(SORTL_T, NULL); - sortl->children = new std::list(); - (yyval.snode)->children->push_back(sortl); - - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 1743 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 12: -#line 169 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-7].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(SYM_T, (yyvsp[-6].str))); - - ASTNode* svl = new ASTNode(SVL_T, NULL); - svl->children = (yyvsp[-4].snode_list); - (yyval.snode)->children->push_back(svl); - - (yyval.snode)->children->push_back((yyvsp[-2].snode)); - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 1760 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 13: -#line 182 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(NUM_T, (yyvsp[-1].str))); - } -#line 1770 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 14: -#line 188 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(NUM_T, (yyvsp[-1].str))); - } -#line 1780 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 15: -#line 194 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 1790 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 16: -#line 200 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-1].tok)); - } -#line 1798 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 17: -#line 204 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-1].tok)); - } -#line 1806 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 18: -#line 208 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-1].tok)); - } -#line 1814 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 19: -#line 212 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-1].tok)); - } -#line 1822 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 20: -#line 216 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(UATTR_T, (yyvsp[-1].str))); - } -#line 1832 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 21: -#line 222 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(UATTR_T, (yyvsp[-1].str))); - } -#line 1842 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 22: -#line 228 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(UATTR_T, (yyvsp[-1].str))); - } -#line 1852 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 23: -#line 234 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-1].tok)); - } -#line 1860 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 24: -#line 238 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-5].tok)); - (yyval.snode)->children = (yyvsp[-2].snode_list); - (yyval.snode)->children->push_front((yyvsp[-3].snode)); - } -#line 1870 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 25: -#line 244 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-1].tok)); - } -#line 1878 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 26: -#line 248 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(UATTR_T, (yyvsp[-1].str))); - } -#line 1888 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 27: -#line 254 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(PATTR_T, (yyvsp[-1].str))); - } -#line 1898 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 28: -#line 260 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-2].tok)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 1908 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 29: -#line 266 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-1].tok)); - } -#line 1916 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 30: -#line 270 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(CMD_T, (yyvsp[-1].tok)); } -#line 1922 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 31: -#line 274 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode_list) = new std::list(); } -#line 1928 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 32: -#line 276 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyvsp[-1].snode_list)->push_back((yyvsp[0].snode)); (yyval.snode_list) = (yyvsp[-1].snode_list); } -#line 1934 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 33: -#line 280 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(UATTR_T, (yyvsp[0].str)); } -#line 1940 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 34: -#line 282 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(UATTR_T, (yyvsp[-1].str)); (yyval.snode)->children = new std::list(); (yyval.snode)->children->push_back((yyvsp[0].snode)); } -#line 1946 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 35: -#line 284 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(PATTR_T, (yyvsp[0].str)); } -#line 1952 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 36: -#line 286 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(PATTR_T, (yyvsp[-1].str)); (yyval.snode)->children = new std::list(); (yyval.snode)->children->push_back((yyvsp[0].snode)); } -#line 1958 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 37: -#line 290 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(SPECC_T, NULL); (yyval.snode)->children = new std::list(); (yyval.snode)->children->push_back((yyvsp[0].snode)); } -#line 1964 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 38: -#line 292 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(SYM_T, (yyvsp[0].str)); - } -#line 1972 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 39: -#line 296 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(SEXPRL_T, NULL); - (yyval.snode)->children = (yyvsp[-1].snode_list); - } -#line 1981 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 40: -#line 303 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(SYM_T, (yyvsp[0].str)); } -#line 1987 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 41: -#line 305 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(SYM_T, (yyvsp[-2].str)); (yyval.snode)->children = (yyvsp[-1].snode_list); } -#line 1993 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 42: -#line 309 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(ID_T, NULL); (yyval.snode)->children = new std::list(); (yyval.snode)->children->push_back((yyvsp[0].snode)); } -#line 1999 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 43: -#line 311 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(LID_T, NULL); - (yyval.snode)->children = (yyvsp[-1].snode_list); - (yyval.snode)->children->push_front((yyvsp[-2].snode)); - } -#line 2009 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 44: -#line 319 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyvsp[-1].snode_list)->push_back((yyvsp[0].snode)); (yyval.snode_list) = (yyvsp[-1].snode_list); } -#line 2015 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 45: -#line 321 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode_list) = new std::list(); } -#line 2021 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 46: -#line 325 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(SPECC_T, NULL); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[0].snode)); - } -#line 2031 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 47: -#line 331 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(SYM_T, (yyvsp[0].str)); - } -#line 2039 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 48: -#line 335 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(UATTR_T, (yyvsp[0].str)); - } -#line 2047 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 49: -#line 339 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(SEXPRL_T, NULL); - (yyval.snode)->children = (yyvsp[-1].snode_list); - } -#line 2056 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 50: -#line 346 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode_list) = new std::list(); - } -#line 2064 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 51: -#line 350 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyvsp[-1].snode_list)->push_back((yyvsp[0].snode)); - (yyval.snode_list) = (yyvsp[-1].snode_list); - } -#line 2073 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 52: -#line 358 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(NUM_T, (yyvsp[0].str)); } -#line 2079 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 53: -#line 360 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(DEC_T, (yyvsp[0].str)); } -#line 2085 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 54: -#line 362 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(HEX_T, (yyvsp[0].str)); } -#line 2091 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 55: -#line 364 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(BIN_T, (yyvsp[0].str)); } -#line 2097 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 56: -#line 366 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(STR_T, (yyvsp[0].str)); } -#line 2103 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 57: -#line 370 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(SYM_T, (yyvsp[0].str)); } -#line 2109 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 58: -#line 372 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = (yyvsp[0].snode); } -#line 2115 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 59: -#line 376 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyvsp[-1].snode_list)->push_back(new ASTNode(NUM_T, (yyvsp[0].str))); (yyval.snode_list) = (yyvsp[-1].snode_list); } -#line 2121 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 60: -#line 378 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode_list) = new std::list(); (yyval.snode_list)->push_back(new ASTNode(NUM_T, (yyvsp[0].str))); } -#line 2127 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 61: -#line 382 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = (yyvsp[0].snode); } -#line 2133 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 62: -#line 384 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(AS_T, NULL); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[-2].snode)); - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 2144 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 63: -#line 393 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode_list) = new std::list(); } -#line 2150 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 64: -#line 395 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyvsp[-1].snode_list)->push_back((yyvsp[0].snode)); (yyval.snode_list) = (yyvsp[-1].snode_list); } -#line 2156 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 65: -#line 399 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(VARB_T, (yyvsp[-2].str)); (yyval.snode)->children = new std::list(); (yyval.snode)->children->push_back((yyvsp[-1].snode)); } -#line 2162 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 66: -#line 403 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode_list) = new std::list(); } -#line 2168 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 67: -#line 405 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyvsp[-1].snode_list)->push_back((yyvsp[0].snode)); (yyval.snode_list) = (yyvsp[-1].snode_list); } -#line 2174 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 68: -#line 409 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(SV_T, (yyvsp[-2].str)); (yyval.snode)->children = new std::list(); (yyval.snode)->children->push_back((yyvsp[-1].snode)); } -#line 2180 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 69: -#line 412 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode_list) = new std::list(); } -#line 2186 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 70: -#line 414 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyvsp[-1].snode_list)->push_back((yyvsp[0].snode)); (yyval.snode_list) = (yyvsp[-1].snode_list); } -#line 2192 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 71: -#line 418 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(TERM_T, NULL); (yyval.snode)->children = new std::list(); (yyval.snode)->children->push_back((yyvsp[0].snode)); } -#line 2198 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 72: -#line 420 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(QID_T, NULL); (yyval.snode)->children = new std::list(); (yyval.snode)->children->push_back((yyvsp[0].snode)); } -#line 2204 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 73: -#line 422 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(LQID_T, NULL); - (yyval.snode)->children = (yyvsp[-1].snode_list); - (yyval.snode)->children->push_front((yyvsp[-2].snode)); - (yyval.snode)->children->push_front((yyvsp[-3].snode)); - } -#line 2215 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 74: -#line 429 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(LET_T, NULL); - (yyval.snode)->children = new std::list(); - (yyvsp[-3].snode_list)->push_front((yyvsp[-4].snode)); - ASTNode* vbl = new ASTNode(VARBL_T, NULL); - vbl->children = (yyvsp[-3].snode_list); - (yyval.snode)->children->push_back(vbl); - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 2229 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 75: -#line 439 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(FORALL_T, NULL); - (yyval.snode)->children = new std::list(); - (yyvsp[-3].snode_list)->push_front((yyvsp[-4].snode)); - ASTNode* svl = new ASTNode(SVL_T, NULL); - svl->children = (yyvsp[-3].snode_list); - (yyval.snode)->children->push_back(svl); - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 2243 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 76: -#line 449 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(EXISTS_T, NULL); - (yyval.snode)->children = new std::list(); - (yyvsp[-3].snode_list)->push_front((yyvsp[-4].snode)); - ASTNode* svl = new ASTNode(SVL_T, NULL); - svl->children = (yyvsp[-3].snode_list); - (yyval.snode)->children->push_back(svl); - (yyval.snode)->children->push_back((yyvsp[-1].snode)); - } -#line 2257 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 77: -#line 459 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(BANG_T, NULL); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_front((yyvsp[-3].snode)); - ASTNode *atrs = new ASTNode(GATTRL_T, NULL); - (yyvsp[-1].snode_list)->push_front((yyvsp[-2].snode)); - atrs->children = (yyvsp[-1].snode_list); - (yyval.snode)->children->push_back(atrs); - } -#line 2271 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 78: -#line 535 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode_list) = new std::list(); } -#line 2277 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 79: -#line 537 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyvsp[-1].snode_list)->push_back(new ASTNode(SYM_T, (yyvsp[0].str))); (yyval.snode_list) = (yyvsp[-1].snode_list); } -#line 2283 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 80: -#line 694 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - if (strcmp((yyvsp[0].str), "true") == 0) - (yyval.snode) = new ASTNode(BOOL_T, strdup("true")); - else if (strcmp((yyvsp[0].str), "false") == 0) - (yyval.snode) = new ASTNode(BOOL_T, strdup("false")); - else { - printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", (yyvsp[0].str)); - YYERROR; - } - } -#line 2298 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 81: -#line 707 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[0].snode)); - } -#line 2308 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 82: -#line 713 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[0].snode)); - } -#line 2318 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 83: -#line 719 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[0].snode)); - } -#line 2328 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 84: -#line 725 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[0].snode)); - } -#line 2338 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 85: -#line 731 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[0].snode)); - } -#line 2348 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 86: -#line 737 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[0].snode)); - } -#line 2358 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 87: -#line 743 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[0].snode)); - } -#line 2368 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 88: -#line 749 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(STR_T, (yyvsp[0].str))); - } -#line 2378 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 89: -#line 755 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(STR_T, (yyvsp[0].str))); - } -#line 2388 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 90: -#line 761 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(NUM_T, (yyvsp[0].str))); - } -#line 2398 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 91: -#line 767 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, (yyvsp[-1].str)); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(NUM_T, (yyvsp[0].str))); - } -#line 2408 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 92: -#line 773 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(OPTION_T, NULL); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back((yyvsp[0].snode)); - } -#line 2418 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 93: -#line 781 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2424 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 94: -#line 783 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2430 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 95: -#line 785 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2436 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 96: -#line 787 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2442 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 97: -#line 789 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2448 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 98: -#line 791 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2454 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 99: -#line 793 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2460 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 100: -#line 795 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2466 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 101: -#line 797 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2472 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 102: -#line 799 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2478 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 103: -#line 801 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2484 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 104: -#line 803 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2490 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 105: -#line 805 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2496 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 106: -#line 807 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2502 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 107: -#line 809 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2508 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 108: -#line 811 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2514 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 109: -#line 813 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2520 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 110: -#line 815 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2526 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 111: -#line 817 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2532 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 112: -#line 819 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2538 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 113: -#line 821 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2544 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 114: -#line 823 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2550 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 115: -#line 825 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2556 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 116: -#line 827 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2562 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 117: -#line 829 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2568 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 118: -#line 831 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2574 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 119: -#line 833 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2580 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 120: -#line 835 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2586 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 121: -#line 837 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.str) = (yyvsp[0].str); } -#line 2592 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 122: -#line 841 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(INFO_T, (yyvsp[0].str)); } -#line 2598 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 123: -#line 843 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(INFO_T, (yyvsp[0].str)); } -#line 2604 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 124: -#line 845 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(INFO_T, (yyvsp[0].str)); } -#line 2610 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 125: -#line 847 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(INFO_T, (yyvsp[0].str)); } -#line 2616 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 126: -#line 849 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(INFO_T, (yyvsp[0].str)); } -#line 2622 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 127: -#line 851 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(INFO_T, (yyvsp[0].str)); } -#line 2628 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 128: -#line 853 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { (yyval.snode) = new ASTNode(INFO_T, (yyvsp[0].str)); } -#line 2634 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - case 129: -#line 855 "smt2new/smt2newparser.yy" /* yacc.c:1646 */ - { - (yyval.snode) = new ASTNode(INFO_T, NULL); - (yyval.snode)->children = new std::list(); - (yyval.snode)->children->push_back(new ASTNode(GATTR_T, (yyvsp[0].str))); - } -#line 2644 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - break; - - -#line 2648 "smt2new/smt2newparser.cc" /* yacc.c:1646 */ - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - *++yylsp = yyloc; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (&yylloc, context, YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (&yylloc, context, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - yyerror_range[1] = yylloc; - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval, &yylloc, context); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - yyerror_range[1] = yylsp[1-yylen]; - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - yyerror_range[1] = *yylsp; - yydestruct ("Error: popping", - yystos[yystate], yyvsp, yylsp, context); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - yyerror_range[2] = yylloc; - /* Using YYLLOC is tempting, but would change the location of - the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, yyerror_range, 2); - *++yylsp = yyloc; - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (&yylloc, context, YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, &yylloc, context); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, yylsp, context); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} -#line 862 "smt2new/smt2newparser.yy" /* yacc.c:1906 */ - - -//======================================================================================= -// Auxiliary Routines - diff --git a/src/parsers/smt2new/smt2newparser.hh b/src/parsers/smt2new/smt2newparser.hh deleted file mode 100644 index 9cbb1ec9..00000000 --- a/src/parsers/smt2new/smt2newparser.hh +++ /dev/null @@ -1,160 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_SMT2NEW_SMT2NEW_SMT2NEWPARSER_HH_INCLUDED -# define YY_SMT2NEW_SMT2NEW_SMT2NEWPARSER_HH_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int smt2newdebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - TK_AS = 258, - TK_DECIMAL = 259, - TK_EXISTS = 260, - TK_FORALL = 261, - TK_LET = 262, - TK_NUMERAL = 263, - TK_PAR = 264, - TK_STRING = 265, - TK_ASSERT = 266, - TK_CHECKSAT = 267, - TK_DECLARESORT = 268, - TK_DECLAREFUN = 269, - TK_DECLARECONST = 270, - TK_DEFINESORT = 271, - TK_DEFINEFUN = 272, - TK_EXIT = 273, - TK_GETASSERTIONS = 274, - TK_GETASSIGNMENT = 275, - TK_GETINFO = 276, - TK_GETOPTION = 277, - TK_GETPROOF = 278, - TK_GETUNSATCORE = 279, - TK_GETVALUE = 280, - TK_POP = 281, - TK_PUSH = 282, - TK_SETLOGIC = 283, - TK_SETINFO = 284, - TK_SETOPTION = 285, - TK_THEORY = 286, - TK_GETITPS = 287, - TK_WRSTATE = 288, - TK_RDSTATE = 289, - TK_SIMPLIFY = 290, - TK_WRFUNS = 291, - TK_NUM = 292, - TK_SYM = 293, - TK_KEY = 294, - TK_STR = 295, - TK_DEC = 296, - TK_HEX = 297, - TK_BIN = 298, - KW_SORTS = 299, - KW_FUNS = 300, - KW_SORTSDESCRIPTION = 301, - KW_FUNSDESCRIPTION = 302, - KW_DEFINITION = 303, - KW_NOTES = 304, - KW_THEORIES = 305, - KW_LANGUAGE = 306, - KW_EXTENSIONS = 307, - KW_VALUES = 308, - KW_PRINTSUCCESS = 309, - KW_EXPANDDEFINITIONS = 310, - KW_INTERACTIVEMODE = 311, - KW_PRODUCEPROOFS = 312, - KW_PRODUCEUNSATCORES = 313, - KW_PRODUCEMODELS = 314, - KW_PRODUCEASSIGNMENTS = 315, - KW_REGULAROUTPUTCHANNEL = 316, - KW_DIAGNOSTICOUTPUTCHANNEL = 317, - KW_RANDOMSEED = 318, - KW_VERBOSITY = 319, - KW_ERRORBEHAVIOR = 320, - KW_NAME = 321, - KW_NAMED = 322, - KW_AUTHORS = 323, - KW_VERSION = 324, - KW_STATUS = 325, - KW_REASONUNKNOWN = 326, - KW_ALLSTATISTICS = 327 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE -{ -#line 66 "smt2new/smt2newparser.yy" /* yacc.c:1909 */ - - char * str; - std::vector< std::string > * str_list; - ASTNode * snode; - std::list< ASTNode * > * snode_list; - smt2token tok; - -#line 135 "smt2new/smt2newparser.hh" /* yacc.c:1909 */ -}; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - -/* Location type. */ -#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE YYLTYPE; -struct YYLTYPE -{ - int first_line; - int first_column; - int last_line; - int last_column; -}; -# define YYLTYPE_IS_DECLARED 1 -# define YYLTYPE_IS_TRIVIAL 1 -#endif - - - -int smt2newparse (Smt2newContext* context); - -#endif /* !YY_SMT2NEW_SMT2NEW_SMT2NEWPARSER_HH_INCLUDED */ From acfd779da78f4d3bdc0b916da4e458ae1a541bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 28 Jul 2022 15:17:14 +0200 Subject: [PATCH 22/94] parser: last attempt with custom name It starts to look like using a reentrant parser with custom name is not supported by flex/bison combination. This is the last commit where I still have an attempt at writing the system like that. --- src/parsers/smt2new/smt2newparser.yy | 35 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 25205ed3..998f0e4a 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -25,12 +25,32 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. %define api.pure +%lex-param { void * myScanner } %define parse.error verbose %define api.prefix {smt2new} +%code provides +{ + // Tell Flex the expected prototype of yylex. + //#define YY_DECL int smt2newlex (SMT2NEWSTYPE *yylval, SMT2NEWLTYPE *yylloc) + // Declare the scanner. + //YY_DECL; + + int smt2newlex(SMT2NEWSTYPE* lvalp, SMT2NEWLTYPE* llocp, void * myScanner); + + void smt2newerror(SMT2NEWLTYPE* locp, Smt2newContext* context, const char * s ) + { + if (context->interactive) + printf("At interactive input: %s\n", s); + else + printf("At line %d: %s\n", locp->first_line, s); + } + + #define myScanner context->scanner +} + %locations %defines %parse-param { Smt2newContext* context } -%lex-param { void* scanner } %{ #include @@ -40,7 +60,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "smt2newcontext.h" -#include "smt2newparser.hh" #include "smt2tokens.h" using ASTNode_up = std::unique_ptr; @@ -50,18 +69,6 @@ using string_up = std::unique_ptr; std::unique_ptr mkUniqueStr(std::string const & s) { return std::make_unique(s); } -int smt2newlex(YYSTYPE* lvalp, YYLTYPE* llocp, void* scanner); - -void smt2newerror( YYLTYPE* locp, Smt2newContext* context, const char * s ) -{ - if (context->interactive) - printf("At interactive input: %s\n", s); - else - printf( "At line %d: %s\n", locp->first_line, s ); -// exit( 1 ); -} - -#define scanner context->scanner /* Overallocation to prevent stack overflow */ #define YYMAXDEPTH 1024 * 1024 From b368e0859fb118d7d2d1cde6539e3c5836c7696d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 28 Jul 2022 18:00:34 +0200 Subject: [PATCH 23/94] Itp-Regression: fix interpolation algorithm number --- regression_itp/dec-far1.smt2 | 2 +- regression_itp/dec-far2.smt2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/regression_itp/dec-far1.smt2 b/regression_itp/dec-far1.smt2 index e1933980..6f39ed34 100644 --- a/regression_itp/dec-far1.smt2 +++ b/regression_itp/dec-far1.smt2 @@ -1,7 +1,7 @@ (set-option :produce-interpolants true) (set-option :certify-interpolants 1) (set-logic QF_LRA) -(set-option :interpolation-lra-algorithm 4) ; decomposed Farkas +(set-option :interpolation-lra-algorithm 11) ; decomposed Farkas (declare-fun x1 () Real) (declare-fun x2 () Real) (declare-fun x3 () Real) diff --git a/regression_itp/dec-far2.smt2 b/regression_itp/dec-far2.smt2 index f9147c3c..1aa35fd6 100644 --- a/regression_itp/dec-far2.smt2 +++ b/regression_itp/dec-far2.smt2 @@ -1,7 +1,7 @@ (set-option :produce-interpolants true) (set-option :certify-interpolants 1) (set-logic QF_LRA) -(set-option :interpolation-lra-algorithm 4) ; decomposed Farkas +(set-option :interpolation-lra-algorithm 11) ; decomposed Farkas (declare-fun x1 () Real) (declare-fun x2 () Real) (declare-fun x3 () Real) From 131c23e1a3b27506c970be0747960c152ca701ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 28 Jul 2022 18:02:03 +0200 Subject: [PATCH 24/94] Interpret: fix option parsing --- src/api/Interpret.cc | 9 ++++++--- src/options/SMTConfig.cc | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index 0c7ab8fe..6ae975ed 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -50,7 +50,7 @@ void Interpret::setInfo(ASTNode const & n) { assert(n.getType() == ASTType::UATTR_T || n.getType() == ASTType::PATTR_T); std::string name; - if (n.hasValue()) { + if (not n.hasValue()) { ASTNode const & an = *(*n.children)[0]; assert(an.getType() == ASTType::UATTR_T || an.getType() == ASTType::PATTR_T); name = an.getValue(); @@ -64,7 +64,7 @@ void Interpret::setInfo(ASTNode const & n) { void Interpret::getInfo(ASTNode const & n) { assert(n.getType() == ASTType::INFO_T); assert(n.hasValue() or n.children->size() == 1); - std::string const & name = n.hasValue() ? (*(*n.children)[0]).getValue() : n.getValue(); + std::string const & name = n.hasValue() ? n.getValue() : (*(*n.children)[0]).getValue(); const Info& value = config.getInfo(name); @@ -136,10 +136,13 @@ void Interpret::interp(ASTNode const & n) { break; } case t_setinfo: - case t_setoption : { setInfo(*(*n.children)[0]); notify_success(); break; + case t_setoption : { + setOption(*(*n.children)[0]); + notify_success(); + break; } case t_getinfo: { getInfo(*(*n.children)[0]); diff --git a/src/options/SMTConfig.cc b/src/options/SMTConfig.cc index 5805653e..8bfabfa1 100644 --- a/src/options/SMTConfig.cc +++ b/src/options/SMTConfig.cc @@ -180,7 +180,7 @@ std::string ConfValue::toString() const { Info::Info(ASTNode const & n) { assert(n.getType() == ASTType::UATTR_T or n.getType() == ASTType::PATTR_T); - if (n.children->empty()) { + if (not n.children or n.children->empty()) { value.type = O_EMPTY; return; } else { @@ -235,7 +235,7 @@ SMTOption::SMTOption(ASTNode const & n) { assert(child.getType() == ASTType::UATTR_T or child.getType() == ASTType::PATTR_T); // The option is an attribute - if (child.children->empty()) { + if (not child.children or child.children->empty()) { value.type = O_EMPTY; return; } else { From 77fc02df356ac10f1bff4bcc27c0709b84b8270e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 28 Jul 2022 18:03:04 +0200 Subject: [PATCH 25/94] Parser: remove the prefix It looks like flex + bison combination does not support at the same time having a custom name for a parser and a reentrant parser. This commit removes the custom name for a parser so that we can use reentrancy. --- src/api/Interpret.cc | 6 +++--- src/bin/opensmt.cc | 2 +- src/parsers/smt2new/smt2newcontext.h | 2 +- src/parsers/smt2new/smt2newlexer.ll | 1 - src/parsers/smt2new/smt2newparser.yy | 6 ++---- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index 6ae975ed..39b95ca1 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -997,7 +997,7 @@ void Interpret::execute(ASTNode const & r) { int Interpret::interpFile(FILE* in) { Smt2newContext context(in); - int rval = smt2newparse(&context); + int rval = yyparse(&context); if (rval != 0) return rval; @@ -1008,7 +1008,7 @@ int Interpret::interpFile(FILE* in) { int Interpret::interpFile(char *content){ Smt2newContext context(content); - int rval = smt2newparse(&context); + int rval = yyparse(&context); if (rval != 0) return rval; ASTNode const & r = context.getRoot(); @@ -1110,7 +1110,7 @@ int Interpret::interpPipe() { i = -1; // will be incremented to 0 by the loop condition. Smt2newContext context(buf_out); - int rval = smt2newparse(&context); + int rval = yyparse(&context); if (rval != 0) notify_formatted(true, "scanner"); else { diff --git a/src/bin/opensmt.cc b/src/bin/opensmt.cc index 6db12ffd..9c90c6b6 100644 --- a/src/bin/opensmt.cc +++ b/src/bin/opensmt.cc @@ -203,7 +203,7 @@ void interpretInteractive(Interpret & interpret) { // Parsing should be done from a string that I get from the readline // library. Smt2newContext context(parse_buf); - int rval = smt2newparse(&context); + int rval = yyparse(&context); if (rval != 0) interpret.reportError("scanner"); else { diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 7aae3726..7185a06e 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -104,6 +104,6 @@ class Smt2newContext { } }; -int smt2newparse(Smt2newContext*); +int yyparse(Smt2newContext*); #endif diff --git a/src/parsers/smt2new/smt2newlexer.ll b/src/parsers/smt2new/smt2newlexer.ll index 46e0a626..84c1c9cc 100644 --- a/src/parsers/smt2new/smt2newlexer.ll +++ b/src/parsers/smt2new/smt2newlexer.ll @@ -24,7 +24,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *********************************************************************/ -%option prefix="smt2new" %option reentrant %option bison-bridge %option bison-locations diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 998f0e4a..9c0e2425 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -27,7 +27,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. %define api.pure %lex-param { void * myScanner } %define parse.error verbose -%define api.prefix {smt2new} %code provides { // Tell Flex the expected prototype of yylex. @@ -35,10 +34,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // Declare the scanner. //YY_DECL; - int smt2newlex(SMT2NEWSTYPE* lvalp, SMT2NEWLTYPE* llocp, void * myScanner); + int yylex(YYSTYPE* lvalp, YYLTYPE* llocp, void * myScanner); - void smt2newerror(SMT2NEWLTYPE* locp, Smt2newContext* context, const char * s ) - { + inline void yyerror(YYLTYPE* locp, Smt2newContext* context, const char * s ) { if (context->interactive) printf("At interactive input: %s\n", s); else From e7007529acceb99d9e764c2b1a73d14b74d791d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 28 Jul 2022 18:04:37 +0200 Subject: [PATCH 26/94] Interpret: fix signature --- src/bin/opensmt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/opensmt.cc b/src/bin/opensmt.cc index 9c90c6b6..28d6da17 100644 --- a/src/bin/opensmt.cc +++ b/src/bin/opensmt.cc @@ -207,7 +207,7 @@ void interpretInteractive(Interpret & interpret) { if (rval != 0) interpret.reportError("scanner"); else { - const ASTNode* r = context.getRoot(); + ASTNode const & r = context.getRoot(); interpret.execute(r); done = interpret.gotExit(); } From 11347ff87401126c6f0df87458f634d27e879508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 28 Jul 2022 18:04:52 +0200 Subject: [PATCH 27/94] Parser: fix memory leak --- src/parsers/smt2new/smt2newparser.yy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 9c0e2425..a6f74aff 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -82,6 +82,7 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma %destructor { delete $$; } %destructor { delete $$; } +%destructor { if ($$) { delete $$; } } %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %token TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO From b1b109da4c3dc6a4fe7d5736a8e4fbf46186a348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 28 Jul 2022 18:05:12 +0200 Subject: [PATCH 28/94] Parser: small style fix --- src/parsers/smt2new/smt2newparser.yy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index a6f74aff..f5e4fc67 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -311,7 +311,8 @@ attribute_value: spec_const { auto tmp = std::make_unique(); tmp->push_back(ASTNode_up($1)); - $$ = new ASTNode(ASTType::SPECC_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); } + $$ = new ASTNode(ASTType::SPECC_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); + } | symbol { $$ = $1; From 08c946f0eca5c217356de7861ae6745be70097c0 Mon Sep 17 00:00:00 2001 From: Antti Hyvarinen Date: Fri, 26 Aug 2022 11:40:09 +0200 Subject: [PATCH 29/94] splitting: update to new parser --- src/parallel/SplitterInterpret.cc | 28 ++++------------------------ src/parallel/SplitterInterpret.h | 3 +-- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/parallel/SplitterInterpret.cc b/src/parallel/SplitterInterpret.cc index 6fcdd196..30390a7a 100644 --- a/src/parallel/SplitterInterpret.cc +++ b/src/parallel/SplitterInterpret.cc @@ -12,7 +12,7 @@ * Usage: Parallel solver ***********************************************************/ -void SplitterInterpret::writeSplits(const char* filename) +void SplitterInterpret::writeSplits(std::string const & filename) { try { dynamic_cast(getMainSolver()).writeSplits(filename); @@ -26,9 +26,9 @@ sstat SplitterInterpret::checkSat() { if (not search) return s_Undef; - char* name = config.dump_state(); + auto name = config.dump_state(); sstat res = Interpret::checkSat(); - if (res == s_Undef and strcmp(config.output_dir(),"") != 0) { + if (res == s_Undef and not config.output_dir().empty()) { writeSplits(name); } return res; @@ -44,24 +44,4 @@ sstat SplitterInterpret::interpSMTContent(char *content, vec SplitterInterpret::createMainSolver(const char* logic_name) { - if (config.sat_split_type() != spt_none) { - auto th = MainSolver::createTheory(*logic, config); - auto tm = std::make_unique(*logic); - auto thandler = new THandler(*th, *tm); - return std::make_unique(std::move(th), - std::move(tm), - std::unique_ptr(thandler), - MainSplitter::createInnerSolver(config, *thandler, channel), - *logic, - config, - std::string(logic_name) - + " splitter"); - } else - return std::make_unique(*logic, config, std::string(logic_name) + " solver"); -} - - - +} \ No newline at end of file diff --git a/src/parallel/SplitterInterpret.h b/src/parallel/SplitterInterpret.h index 8037c47c..ee35a6b5 100644 --- a/src/parallel/SplitterInterpret.h +++ b/src/parallel/SplitterInterpret.h @@ -17,8 +17,7 @@ class SplitterInterpret : public Interpret { bool search = true; protected: - void writeSplits(const char* filename); - std::unique_ptr createMainSolver(const char* logic_name) override; + void writeSplits(std::string const & filename); sstat checkSat() override; void exit() override { return; } From eaf050df6dde4377307b542a978f6b8dd92bcd36 Mon Sep 17 00:00:00 2001 From: Antti Hyvarinen Date: Mon, 29 Aug 2022 15:14:29 +0200 Subject: [PATCH 30/94] tmp: parse only --- src/api/Interpret.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index 39b95ca1..a26865c8 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -1000,7 +1000,7 @@ int Interpret::interpFile(FILE* in) { int rval = yyparse(&context); if (rval != 0) return rval; - + return 0; const ASTNode & r = context.getRoot(); execute(r); return rval; From 0c95d439beae1e0fca53769469d7f1250601fc93 Mon Sep 17 00:00:00 2001 From: Antti Hyvarinen Date: Tue, 30 Aug 2022 10:51:29 +0200 Subject: [PATCH 31/94] tmp: parser ideas --- src/api/handwritten.h | 195 +++++++++++++++++++++++++++++++++++++ src/bin/opensmt.cc | 9 +- src/parsers/handwritten.cc | 5 + 3 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 src/api/handwritten.h create mode 100644 src/parsers/handwritten.cc diff --git a/src/api/handwritten.h b/src/api/handwritten.h new file mode 100644 index 00000000..d5da5998 --- /dev/null +++ b/src/api/handwritten.h @@ -0,0 +1,195 @@ +// +// Created by Antti Hyvarinen on 29.08.22. +// + +#ifndef OPENSMT_HANDWRITTEN_H +#define OPENSMT_HANDWRITTEN_H +#include +#include +#include +#include +#include + +class OsmtParserException: public std::exception { + std::string msg; +public: + OsmtParserException(const std::string & msg) : msg(msg) {} + virtual const char* what() const noexcept override { return msg.c_str(); } +}; + +struct SExpr { + std::variant> data; + std::string toString() const { + if (auto str_p = std::get_if(&data)) { + return *str_p; + } else if (auto vec_p = std::get_if>(&data)) { + std::string out = "("; + for (int i = 0; i != vec_p->size(); ++i) { + out += (*vec_p)[i]->toString() + (i == vec_p->size()-1 ? "" : " "); + } + out += ")"; + return out; + } + assert(false); + return {}; + } +}; + +class SExprParser { + std::istream & input; + char token = 0; + std::vector stack; + uint32_t line = 0; + uint32_t column = 0; + + static bool isWhiteSpace(char token) { + return (token == ' ' or token == '\t' or token == '\r' or token == '\n'); + } + + char get() { + auto c = static_cast(input.get()); + if (c == '\n') { ++ line; column = 0; } + ++ column; + return c; + } + + void advance(bool comments = true) { + token = get(); + if (comments and token == ';') { + while (token != '\n' and token != 0) { + token = static_cast(get()); + } + } + } + + void skipWhitespace() { + while (isWhiteSpace(token)) { + advance(); + } + } + + std::string parseToken() { + std::string result; + skipWhitespace(); + bool inQuotedSymbol = token == '|'; + bool inString = token == '"'; + if (inQuotedSymbol) { + advance(false); + } + while (token != 0) { + char c = token; + if (inQuotedSymbol and c == '|') { + advance(); + break; + } else if (inString and result.size() > 1 and c == '"') { + inString = false; + } else if (not inQuotedSymbol and not inString and (isWhiteSpace(token) or c == '(' or c == ')')) { + break; + } + result.push_back(c); + advance(not inString and not inQuotedSymbol); + } + return result; + } + + void parseError(std::string const & error) { + throw OsmtParserException("At line " + std::to_string(line) + ", column " + std::to_string(column) + ": " + error); + } + +public: + SExprParser(std::istream & input) : input(input), token(' '), line(1) {} + + bool isEOF() { + skipWhitespace(); + return input.eof(); + } + + SExpr * parseExpr() { + while (not isEOF()) { + skipWhitespace(); + if (token == '(') { + stack.emplace_back(new SExpr{std::vector()}); + advance(); + skipWhitespace(); + } else if (token == ')') { + if (stack.empty()) { + parseError("Unexpected `" + std::string(1, token) + "`"); + } else if (stack.size() == 1) { + advance(); + skipWhitespace(); + break; + } else { + // Copy the contents of this stack to the SExpr in the previous frame. + auto & prevData = std::get>((stack.rbegin()[1])->data); + prevData.emplace_back(stack.back()); + assert(stack.size() > 1); + stack.pop_back(); + advance(); + skipWhitespace(); + } + } else { + if (stack.empty()) { + parseError("Expected `(` or `;`, got " + std::string(1, token)); + } + assert(not stack.empty()); + auto & currentData = std::get>(stack.back()->data); + currentData.emplace_back(new SExpr{parseToken()}); + } + } + if (stack.size() != 1) { + parseError("Unexpected EOF"); + } + assert(stack.size() == 1); + auto res = stack[0]; + stack.pop_back(); + return res; + } +}; + +class HandWrittenParser { + std::istream & input; + +public: + HandWrittenParser(std::istream & input) : input(input) {} + template void traverse(SExpr * root, F & op) { + struct Qel { SExpr * node; uint32_t processed; }; + std::vector queue; + queue.emplace_back(Qel{root, static_cast(0)}); + while (not queue.empty()) { + auto & [node, processed] = queue.back(); + auto children = std::get_if>(&node->data); + if (children and processed < children->size()) { + ++ processed; + queue.emplace_back(Qel{(*children)[processed-1], 0}); + continue; + } + assert(not children or processed == children->size()); + assert(node); + op(*node); + queue.pop_back(); + } + } + void parse() { + SExprParser parser(input); + class Counter { + uint32_t count = 0; + public: + void operator() (SExpr &) { + ++ count; + } + uint32_t getCount() const { return count; } + }; + Counter counter; + while (not parser.isEOF()) { + try { + auto sexpr = parser.parseExpr(); + traverse(sexpr, counter); + } catch (OsmtParserException const & e) { + std::cout << e.what() << std::endl; + break; + } + } + std::cout << std::to_string(counter.getCount()) << std::endl; + } +}; +#endif // OPENSMT_HANDWRITTEN_H \ No newline at end of file diff --git a/src/bin/opensmt.cc b/src/bin/opensmt.cc index 28d6da17..0612348a 100644 --- a/src/bin/opensmt.cc +++ b/src/bin/opensmt.cc @@ -26,6 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "Interpret.h" +#include "handwritten.h" #include #include @@ -145,7 +146,13 @@ int main( int argc, char * argv[] ) opensmt_error( "SMTLIB 1.2 format is not supported in this version, sorry" ); } else if ( extension != NULL && strcmp( extension, ".smt2" ) == 0 ) { - interpreter.interpFile(fin); + std::filebuf fb; + fb.open(filename, std::ios::in); + std::istream is(&fb); + HandWrittenParser parser(is); + parser.parse(); + +// interpreter.interpFile(fin); } else opensmt_error2( filename, " extension not recognized. Please use one in { smt2, cnf } or stdin (smtlib2 is assumed)" ); diff --git a/src/parsers/handwritten.cc b/src/parsers/handwritten.cc new file mode 100644 index 00000000..80b22d31 --- /dev/null +++ b/src/parsers/handwritten.cc @@ -0,0 +1,5 @@ +// +// Created by Antti Hyvarinen on 29.08.22. +// + +#include "handwritten.h" From ecca33b7939920fc65d1240724faea1eb3adaf9a Mon Sep 17 00:00:00 2001 From: aehyvari Date: Wed, 31 Aug 2022 18:55:26 +0200 Subject: [PATCH 32/94] SMTConfig: add missing header --- src/options/SMTConfig.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index 42559ae6..1bd28c8f 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -37,6 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include enum class ASTType { CMD_T , CMDL_T From 5f70ff7e9b8c33adfc97d93f05672e69a4844535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Wed, 14 Sep 2022 10:31:58 +0200 Subject: [PATCH 33/94] tmp: disable checking --- src/api/Interpret.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index a26865c8..fb894c2a 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -1001,9 +1001,9 @@ int Interpret::interpFile(FILE* in) { if (rval != 0) return rval; return 0; - const ASTNode & r = context.getRoot(); - execute(r); - return rval; +// const ASTNode & r = context.getRoot(); +// execute(r); +// return rval; } int Interpret::interpFile(char *content){ @@ -1011,8 +1011,8 @@ int Interpret::interpFile(char *content){ int rval = yyparse(&context); if (rval != 0) return rval; - ASTNode const & r = context.getRoot(); - execute(r); +// ASTNode const & r = context.getRoot(); +// execute(r); return rval; } @@ -1114,8 +1114,8 @@ int Interpret::interpPipe() { if (rval != 0) notify_formatted(true, "scanner"); else { - ASTNode const & r = context.getRoot(); - execute(r); +// ASTNode const & r = context.getRoot(); +// execute(r); done = f_exit; } free(buf_out); From dd2d886ae5f8f56f850daafc0964b8dc513b76f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Wed, 14 Sep 2022 10:35:16 +0200 Subject: [PATCH 34/94] Handwritten-parser: An attempt at more semantic parsing [WiP] --- src/api/handwritten.h | 80 ++++++++++++++++++++++++++++++++------ src/api/smt2tokens.h | 39 ++++++++++++++++++- src/parsers/handwritten.cc | 5 --- 3 files changed, 107 insertions(+), 17 deletions(-) delete mode 100644 src/parsers/handwritten.cc diff --git a/src/api/handwritten.h b/src/api/handwritten.h index d5da5998..0b70dab3 100644 --- a/src/api/handwritten.h +++ b/src/api/handwritten.h @@ -4,12 +4,15 @@ #ifndef OPENSMT_HANDWRITTEN_H #define OPENSMT_HANDWRITTEN_H +#include "smt2tokens.h" + #include #include #include #include #include + class OsmtParserException: public std::exception { std::string msg; public: @@ -17,14 +20,25 @@ class OsmtParserException: public std::exception { virtual const char* what() const noexcept override { return msg.c_str(); } }; +class Expr {}; +class EmptyExpr : public Expr {}; +class DeclareFun : public Expr {}; + +struct Token { + std::string name; + osmttokens::token token; + opensmt::pair pos = {0, 0}; + Expr * parsedType = nullptr; +}; + struct SExpr { - std::variant> data; + std::variant> data; std::string toString() const { - if (auto str_p = std::get_if(&data)) { - return *str_p; + if (auto token_p = std::get_if(&data)) { + return (token_p->name); } else if (auto vec_p = std::get_if>(&data)) { std::string out = "("; - for (int i = 0; i != vec_p->size(); ++i) { + for (unsigned long i = 0; i != vec_p->size(); ++i) { out += (*vec_p)[i]->toString() + (i == vec_p->size()-1 ? "" : " "); } out += ")"; @@ -68,11 +82,22 @@ class SExprParser { } } - std::string parseToken() { + osmttokens::token resolveToken(std::string const & name) { + if (osmttokens::nameToToken.find(name) != osmttokens::nameToToken.end()) { + return osmttokens::nameToToken.at(name); + } else { + return osmttokens::t_none; + } + } + + Token parseToken() { std::string result; skipWhitespace(); + opensmt::pair tokenStartPos {line, column}; bool inQuotedSymbol = token == '|'; bool inString = token == '"'; + bool isString = inString; + if (inQuotedSymbol) { advance(false); } @@ -89,7 +114,8 @@ class SExprParser { result.push_back(c); advance(not inString and not inQuotedSymbol); } - return result; + osmttokens::token type = isString ? osmttokens::t_STRING : resolveToken(result); + return {result, type, tokenStartPos}; } void parseError(std::string const & error) { @@ -165,7 +191,7 @@ class HandWrittenParser { } assert(not children or processed == children->size()); assert(node); - op(*node); + op(node); queue.pop_back(); } } @@ -174,22 +200,54 @@ class HandWrittenParser { class Counter { uint32_t count = 0; public: - void operator() (SExpr &) { + void operator() (SExpr *) { ++ count; } uint32_t getCount() const { return count; } }; - Counter counter; + class Deleter { + public: + void operator() (SExpr * e) { + delete e; + } + }; + + class Printer { + void error(Token * token, std::string const & msg) { + std::cout << "At line " + << std::to_string(token->pos.first) + << " column " + << std::to_string(token->pos.second) + << ", " + << token->name << " " << msg << std::endl; + } + public: + Expr * operator() (SExpr * e) { + if (auto expr_p = std::get_if>(&e->data)) { + if (expr_p->empty()) { return new EmptyExpr(); } + if (auto token_p = std::get_if(&((*expr_p)[0])->data)) { + if (token_p->token == osmttokens::t_declarefun) { + if (expr_p->size() != 3) { error(token_p, "expected 3 arguments"); } + } + } + } + return nullptr; + } + }; +// Counter counter; + Printer printer; + Deleter deleter; while (not parser.isEOF()) { try { auto sexpr = parser.parseExpr(); - traverse(sexpr, counter); + traverse(sexpr, printer); + traverse(sexpr, deleter); } catch (OsmtParserException const & e) { std::cout << e.what() << std::endl; break; } } - std::cout << std::to_string(counter.getCount()) << std::endl; +// std::cout << std::to_string(counter.getCount()) << std::endl; } }; #endif // OPENSMT_HANDWRITTEN_H \ No newline at end of file diff --git a/src/api/smt2tokens.h b/src/api/smt2tokens.h index 42aa1e68..20b6035d 100644 --- a/src/api/smt2tokens.h +++ b/src/api/smt2tokens.h @@ -150,7 +150,44 @@ namespace osmttokens { {t_let, "let"}, {t_echo, "echo"} }; - + inline const std::unordered_map nameToToken = { + {"none", t_none}, + {"as", t_as}, + {"decimal", t_DECIMAL}, + {"numeral", t_NUMERAL}, + {"par", t_par}, + {"string", t_STRING}, + {"exists", t_exists}, + {"forall", t_forall}, + {"assert", t_assert}, + {"check-sat", t_checksat}, + {"declare-sort", t_declaresort}, + {"define-sort", t_definesort}, + {"declare-fun", t_declarefun}, + {"declare-const", t_declareconst}, + {"define-fun", t_definefun}, + {"exit", t_exit}, + {"get-assertions", t_getassertions}, + {"get-assignment", t_getassignment}, + {"get-info", t_getinfo}, + {"set-info", t_setinfo}, + {"get-option", t_getoption}, + {"set-option", t_setoption}, + {"get-proof", t_getproof}, + {"get-unsat-core", t_getunsatcore}, + {"get-value", t_getvalue}, + {"get-model", t_getmodel}, + {"pop", t_pop}, + {"push", t_push}, + {"set-logic", t_setlogic}, + {"get-interpolants", t_getinterpolants}, + {"theory", t_theory}, + {"write-state", t_writestate}, + {"read-state", t_readstate}, + {"simplify", t_simplify}, + {"let", t_let}, + {"echo", t_echo} + }; struct smt2token { token x; }; diff --git a/src/parsers/handwritten.cc b/src/parsers/handwritten.cc deleted file mode 100644 index 80b22d31..00000000 --- a/src/parsers/handwritten.cc +++ /dev/null @@ -1,5 +0,0 @@ -// -// Created by Antti Hyvarinen on 29.08.22. -// - -#include "handwritten.h" From ea59c68007cb7ae4c4064c52c4cb98d1c89a8dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Wed, 14 Sep 2022 10:36:24 +0200 Subject: [PATCH 35/94] parser: A first version of new bison-parser --- src/bin/opensmt.cc | 6 +- src/parsers/smt2new/smt2newcontext.h | 229 ++++++++++- src/parsers/smt2new/smt2newparser.yy | 543 +++++++++------------------ 3 files changed, 391 insertions(+), 387 deletions(-) diff --git a/src/bin/opensmt.cc b/src/bin/opensmt.cc index 0612348a..5c4567b9 100644 --- a/src/bin/opensmt.cc +++ b/src/bin/opensmt.cc @@ -26,7 +26,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "Interpret.h" -#include "handwritten.h" #include #include @@ -149,10 +148,7 @@ int main( int argc, char * argv[] ) std::filebuf fb; fb.open(filename, std::ios::in); std::istream is(&fb); - HandWrittenParser parser(is); - parser.parse(); - -// interpreter.interpFile(fin); + interpreter.interpFile(fin); } else opensmt_error2( filename, " extension not recognized. Please use one in { smt2, cnf } or stdin (smtlib2 is assumed)" ); diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 7185a06e..5720f6fb 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -30,6 +30,223 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "SMTConfig.h" +enum class ConstType { + numeral, + decimal, + hexadecimal, + binary, + string +}; + +class GeneralNode {}; + +struct SpecConstNode : public GeneralNode { + ConstType type; + std::string value; +}; + +struct SymbolNode : public GeneralNode { + std::variant name; + bool quoted; +}; + +struct SExpr : public GeneralNode { + std::variant> data; +}; + +struct AttributeValueNode : public GeneralNode { + std::variant> value; + AttributeValueNode(SpecConstNode && n) : value(std::move(n)) {} + AttributeValueNode(SymbolNode && n) : value(std::move(n)) {} + AttributeValueNode(std::vector n) : value(std::move(n)) {} +}; + +struct AttributeNode : public GeneralNode { + bool predefined = false; + std::string name; + AttributeValueNode value; +}; + +struct IdentifierNode : public GeneralNode { + SymbolNode symbol; + std::vector numeralList; +}; + + +class OptionNode : public GeneralNode { }; + +struct PrintSuccess : public OptionNode { bool value; }; +struct ExpandDefinitions : public OptionNode { bool value; }; +struct InteractiveMode : public OptionNode { bool value; }; +struct ProduceProofs : public OptionNode { bool value; }; +struct ProduceUnsatCores : public OptionNode { bool value; }; +struct ProduceModels : public OptionNode { bool value; }; +struct ProduceAssignments : public OptionNode { bool value; }; +struct RegularOutputChannel : public OptionNode { std::string value; }; +struct DiagnosticOutputChannel : public OptionNode { std::string value; }; +struct RandomSeed : public OptionNode { int value; }; +struct Verbosity : public OptionNode { int value; }; +struct Attribute : public OptionNode { AttributeNode value; }; + +class CommandNode : public GeneralNode {}; + +class SetLogic : public CommandNode { + SymbolNode logic; +public: + SetLogic(SymbolNode && logic) : logic(std::move(logic)) {} +}; + +class SetOption : public CommandNode { + OptionNode option; +public: + SetOption(OptionNode && option) : option(std::move(option)) {} +}; + +class SetInfo : public CommandNode { + AttributeNode attribute; +public: + SetInfo(AttributeNode && attribute) : attribute(std::move(attribute)) {} +}; + +class DeclareSort : public CommandNode { + SymbolNode symbol; + std::string num; +public: + DeclareSort(SymbolNode && symbol, std::string && num) : symbol(std::move(symbol)), num(std::move(num)) {} +}; + +struct SortNode : public GeneralNode { + IdentifierNode identifier; +}; + + +struct ComplexSortNode : public SortNode { + SortNode * sort; + std::vector sortList; +}; + +struct QualIdentifierNode : public GeneralNode { + IdentifierNode identifier; + SortNode * returnSort = nullptr; +}; + +class DefineSort : public CommandNode { + SymbolNode name; + std::vector argumentSorts; + SortNode sort; +public: + DefineSort(SymbolNode && name, std::vector && argumentSorts, SortNode && sort) + : name(std::move(name)) + , argumentSorts(std::move(argumentSorts)) + , sort(std::move(sort)) + {} +}; + +class DeclareFun : public CommandNode { + SymbolNode name; + std::vector argumentSorts; + SortNode returnSort; +public: + DeclareFun(SymbolNode && name, std::vector && argumentSorts, SortNode && returnSort) + : name(std::move(name)) + , argumentSorts(std::move(argumentSorts)) + , returnSort(std::move(returnSort)) + {} +}; + +class DeclareConst : public CommandNode { + std::variant name; + SortNode sort; +public: + DeclareConst(SymbolNode && name, SortNode && sort) : name(std::move(name)), sort(std::move(sort)) {} + DeclareConst(SpecConstNode && name, SortNode && sort) : name(std::move(name)), sort(std::move(sort)) {} +}; + +class TermNode : public GeneralNode {}; + +class NormalTermNode : public TermNode { + std::variant head; + SortNode * returnSort = nullptr; + std::vector arguments; +public: + NormalTermNode(SpecConstNode && head) : head(std::move(head)) {} + NormalTermNode(IdentifierNode && head, SortNode * returnSort, std::vector && arguments) + : head(std::move(head)) + , returnSort(returnSort) + , arguments(std::move(arguments)) + {} + SortNode * getSortIfKnown() { return returnSort; } +}; + +struct VarBindingNode : public GeneralNode { + SymbolNode symbol; + TermNode term; +}; + +struct LetTermNode : public TermNode { + TermNode term; + std::vector bindings; +}; + +struct SortedVarNode : public GeneralNode { + SymbolNode symbol; + SortNode sort; +}; + +struct ForallNode : public TermNode { + TermNode term; + std::vector bindings; +}; + +struct ExistsNode : public TermNode { + TermNode term; + std::vector bindings; +}; + +struct AnnotationNode : public TermNode { + TermNode term; + std::vector attributes; +}; + +struct DefineFun : public CommandNode { + SymbolNode name; + std::vector args; + SortNode returnSort; + TermNode term; +}; + +struct PushNode : public CommandNode { int num; }; + +struct PopNode : public CommandNode { int num; }; + +struct AssertNode : public CommandNode { TermNode term; }; + +struct CheckSatNode : public CommandNode {}; + +struct GetAssertions : public CommandNode {}; + +struct GetProof : public CommandNode {}; + +struct GetInterpolants : public CommandNode { std::vector configuration; }; + +struct GetUnsatCore : public CommandNode {}; + +struct GetValue : public CommandNode { std::vector terms; }; + +struct GetModel : public CommandNode {}; + +struct GetAssignment : public CommandNode {}; + +struct GetOption : public CommandNode { std::string key; }; + +struct GetInfo : public CommandNode { std::string key; }; + +struct Simplify : public CommandNode {}; + +struct Exit : public CommandNode {}; + +struct Echo : public CommandNode { std::string text; }; + class Smt2newContext { private: int init_scanner(); @@ -37,19 +254,18 @@ class Smt2newContext { char* buffer; int buffer_sz; int buffer_cap; - std::unique_ptr root; + std::vector root; public: void* scanner; int result; FILE* is; char* ib; bool interactive; - inline ASTNode const & getRoot() { return *root; }; + inline std::vector const & getRoot() { return root; }; Smt2newContext(FILE* in) : buffer_sz(0) , buffer_cap(1) - , root(nullptr) , result(0) , is(in) , ib(nullptr) @@ -62,7 +278,6 @@ class Smt2newContext { Smt2newContext(char* in_s) : buffer_sz(0) , buffer_cap(1) - , root(nullptr) , result(0) , is(nullptr) , ib(in_s) @@ -94,14 +309,10 @@ class Smt2newContext { buffer_sz = 0; } - void insertRoot(std::unique_ptr n) { + void insertRoot(std::vector && n) { root = std::move(n); } - void prettyPrint(std::ostream& o) { - o << "Starting print" << std::endl; - root->print(o, 0); - } }; int yyparse(Smt2newContext*); diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index f5e4fc67..e2eab04a 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -74,15 +74,36 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma %union { - std::string * str; - ASTNode * snode; + SortNode * n_sort; + IdentifierNode * n_identifier; + QualIdentifierNode * n_qualIdentifier; + VarBindingNode * n_varBinding; + std::vector * n_varBindingList; + std::vector * n_sortList; + std::vector * n_numeralList; + AttributeNode * n_attribute; + AttributeValueNode * n_attributeValue; + SpecConstNode * n_specConst; + SExpr * sexpr; + SymbolNode * n_symbol; + CommandNode * n_command; + TermNode * n_term; + SortedVarNode * n_sortedVar; + std::vector * n_sortedVarList; + std::vector * n_termList; + std::vector * n_attributeList; + std::vector * n_commandList; + std::vector * n_symbolList; + std::vector * sexpr_list; + std::string * str; + bool n_bool; + OptionNode * n_option; + ASTNode * snode; std::vector> * snode_list; - osmttokens::smt2token tok; + osmttokens::smt2token tok; } %destructor { delete $$; } -%destructor { delete $$; } -%destructor { if ($$) { delete $$; } } %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %token TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO @@ -94,437 +115,265 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma %type TK_NUM TK_SYM TK_QSYM TK_KEY TK_STR TK_DEC TK_HEX TK_BIN %type KW_SORTS KW_FUNS KW_SORTSDESCRIPTION KW_FUNSDESCRIPTION KW_DEFINITION KW_NOTES KW_THEORIES KW_EXTENSIONS KW_VALUES KW_PRINTSUCCESS KW_EXPANDDEFINITIONS KW_INTERACTIVEMODE KW_PRODUCEPROOFS KW_PRODUCEUNSATCORES KW_PRODUCEMODELS KW_PRODUCEASSIGNMENTS KW_REGULAROUTPUTCHANNEL KW_DIAGNOSTICOUTPUTCHANNEL KW_RANDOMSEED KW_VERBOSITY KW_ERRORBEHAVIOR KW_NAME KW_NAMED KW_AUTHORS KW_VERSION KW_STATUS KW_REASONUNKNOWN KW_ALLSTATISTICS predef_key -%type symbol identifier sort command attribute attribute_value s_expr spec_const qual_identifier var_binding sorted_var term const_val -%type sort_list command_list s_expr_list numeral_list term_list var_binding_list attribute_list sorted_var_list symbol_list -%type b_value option info_flag +%type sort +%type identifier +%type qual_identifier +%type var_binding +%type term +%type sorted_var +%type command +%type symbol const_val +%type s_expr +%type spec_const +%type attribute +%type attribute_value +%type sort_list +%type var_binding_list +%type term_list +%type attribute_list +%type sorted_var_list +%type symbol_list +%type command_list +%type s_expr_list +%type numeral_list +%type b_value +%type info_flag +%type option %start script %% -script: command_list { context->insertRoot(std::make_unique(ASTType::CMDL_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr("main-script"), ASTVec_up($1))); }; +script: command_list { context->insertRoot(std::move(*$1)); }; symbol: TK_SYM - { $$ = new ASTNode(ASTType::SYM_T, {osmttokens::t_none}, string_up($1)); } + { $$ = new SymbolNode{{}, {std::move(*$1)}, false}; } | TK_QSYM - { $$ = new ASTNode(ASTType::QSYM_T, {osmttokens::t_none}, string_up($1)); } + { $$ = new SymbolNode {{}, {std::move(*$1)}, true}; } ; command_list: - { $$ = new ASTVec(); } + { $$ = new std::vector(); } | command_list command - { (*$1).emplace_back(ASTNode_up($2)); $$ = $1; } + { (*$1).emplace_back($2); $$ = $1; } ; command: '(' TK_SETLOGIC symbol ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - $$ = new ASTNode(ASTType::CMD_T, $2, mkUniqueStr(""), std::move(tmp)); - } + { $$ = new SetLogic(std::move(*$3)); } | '(' TK_SETOPTION option ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - $$ = new ASTNode(ASTType::CMD_T, $2, mkUniqueStr(""), std::move(tmp)); - } + { $$ = new SetOption(std::move(*$3)); } | '(' TK_SETINFO attribute ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - $$ = new ASTNode(ASTType::CMD_T, $2, mkUniqueStr(""), std::move(tmp)); - } + { $$ = new SetInfo(std::move(*$3)); } | '(' TK_DECLARESORT symbol TK_NUM ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($4))); - $$ = new ASTNode(ASTType::CMD_T, - $2, - mkUniqueStr(""), - std::move(tmp)); - } + { $$ = new DeclareSort(std::move(*$3), std::move(*$4)); } | '(' TK_DEFINESORT symbol '(' symbol_list ')' sort ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - tmp->push_back(std::make_unique(ASTType::SYML_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr(""), ASTVec_up($5))); - tmp->push_back(ASTNode_up($7)); - $$ = new ASTNode(ASTType::CMD_T, $2, mkUniqueStr(""), std::move(tmp)); - } - + { $$ = new DefineSort(std::move(*$3), std::move(*$5), std::move(*$7)); } | '(' TK_DECLAREFUN symbol '(' sort_list ')' sort ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - tmp->push_back(std::make_unique(ASTType::SORTL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($5))); - tmp->push_back(ASTNode_up($7)); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new DeclareFun(std::move(*$3), std::move(*$5), std::move(*$7)); } | '(' TK_DECLARECONST const_val sort ')' - { - // todo: drop the second child? - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - tmp->push_back(std::make_unique(ASTType::SORTL_T)); - tmp->push_back(ASTNode_up($4)); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new DeclareConst(std::move(*$3), std::move(*$4)); } | '(' TK_DEFINEFUN symbol '(' sorted_var_list ')' sort term ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - tmp->push_back(std::make_unique(ASTType::SVL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($5))); - tmp->push_back(ASTNode_up($7)); - tmp->push_back(ASTNode_up($8)); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new DefineFun {{}, std::move(*$3), std::move(*$5), std::move(*$7), std::move(*$8)}; } | '(' TK_PUSH TK_NUM ')' - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new PushNode {{}, std::stoi(*$3)}; delete $3; } | '(' TK_POP TK_NUM ')' - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new PopNode {{}, std::stoi(*$3)}; delete $3; } | '(' TK_ASSERT term ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new AssertNode{{}, std::move(*$3)}; } | '(' TK_CHECKSAT ')' - { - $$ = new ASTNode(ASTType::CMD_T, $2); - } + { $$ = new CheckSatNode(); } | '(' TK_GETASSERTIONS ')' - { - $$ = new ASTNode(ASTType::CMD_T, $2); - } + { $$ = new GetAssertions(); } | '(' TK_GETPROOF ')' - { - $$ = new ASTNode(ASTType::CMD_T, $2); - } + { $$ = new GetProof() ; } | '(' TK_GETITPS term_list ')' - { - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, ASTVec_up($3)); - } - | '(' TK_WRSTATE TK_STR ')' - { - // todo: TK_{WR,RD}STATE and TK_WRFUNS is not implemented and is not part of the standard - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } - | '(' TK_RDSTATE TK_STR ')' - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } - | '(' TK_WRFUNS TK_STR ')' - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new GetInterpolants {{}, std::move(*$3)}; } | '(' TK_GETUNSATCORE ')' - { - $$ = new ASTNode(ASTType::CMD_T, $2); - } - | '(' TK_GETVALUE '(' term term_list ')' ')' - { - // todo: insert first $4 and then extend with $5? - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, ASTVec_up($5)); - $$->children->insert($$->children->begin(), ASTNode_up($4)); - } + { $$ = new GetUnsatCore(); } + | '(' TK_GETVALUE '(' term_list ')' ')' + { $$ = new GetValue { {}, std::move(*$4) }; } | '(' TK_GETMODEL ')' - { - $$ = new ASTNode(ASTType::CMD_T, $2); - } + { $$ = new GetModel(); } | '(' TK_GETASSIGNMENT ')' - { - $$ = new ASTNode(ASTType::CMD_T, $2); - } + { $$ = new GetAssignment(); } | '(' TK_GETOPTION TK_KEY ')' - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new GetOption{ {}, std::move(*$3) }; } | '(' TK_GETOPTION predef_key ')' - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::PATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new GetOption{ {}, std::move(*$3) }; } | '(' TK_GETINFO info_flag ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new GetInfo{ {}, std::move(*$3) }; } | '(' TK_SIMPLIFY ')' - { - $$ = new ASTNode(ASTType::CMD_T, $2); - } + { $$ = new Simplify(); } | '(' TK_EXIT ')' - { $$ = new ASTNode(ASTType::CMD_T, $2); } + { $$ = new Exit(); } | '(' TK_ECHO TK_STR ')' - { - // todo: consider using ASTNode's string instead of vector - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($3))); - $$ = new ASTNode(ASTType::CMD_T, $2, nullptr, std::move(tmp)); - } + { $$ = new Echo{ {}, std::move(*$3) }; } ; attribute_list: - { $$ = new ASTVec{}; } + { $$ = new std::vector(); } | attribute_list attribute - { $1->emplace_back(ASTNode_up($2)); $$ = $1; } + { $1->emplace_back(std::move(*$2)); $$ = $1; } ; attribute: TK_KEY - { $$ = new ASTNode(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = new AttributeNode { {}, false, std::move(*$1), AttributeValueNode{std::vector{}} }; } | TK_KEY attribute_value - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - $$ = new ASTNode(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new AttributeNode { {}, false, std::move(*$1), std::move(*$2) }; } | predef_key - { $$ = new ASTNode(ASTType::PATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = new AttributeNode { {}, true, std::move(*$1), AttributeValueNode{std::vector{}} }; } | predef_key attribute_value - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - $$ = new ASTNode(ASTType::PATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new AttributeNode { {}, true, std::move(*$1), std::move(*$2) }; } ; attribute_value: spec_const - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($1)); - $$ = new ASTNode(ASTType::SPECC_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } + { $$ = new AttributeValueNode {std::move(*$1)}; } | symbol - { - $$ = $1; - } + { $$ = new AttributeValueNode {std::move(*$1)}; } | '(' s_expr_list ')' - { - $$ = new ASTNode(ASTType::SEXPRL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($2)); - } + { $$ = new AttributeValueNode {std::move(*$2)}; } ; identifier: symbol - { $$ = $1; } + { $$ = new IdentifierNode {{}, std::move(*$1), {}}; } | '(' '_' symbol numeral_list ')' - { - $$ = $3; - $$->children = ASTVec_up($4); - } + { $$ = new IdentifierNode {{}, std::move(*$3), std::move(*$4)}; } ; sort: identifier - { $$ = $1; } + { $$ = new SortNode {{}, std::move(*$1)}; } | '(' identifier sort sort_list ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - tmp->push_back(ASTNode_up($3)); - $$ = new ASTNode(ASTType::LID_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - for (auto & c : *$4) { - $$->children->push_back(std::move(c)); - } - delete $4; - } + { $$ = new ComplexSortNode {{{}, std::move(*$2)}, $3, std::move(*$4)}; } ; sort_list: sort_list sort - { $1->emplace_back(ASTNode_up($2)); $$ = $1; } + { $1->emplace_back($2); $$ = $1; } | - { $$ = new ASTVec(); } + { $$ = new std::vector(); } ; s_expr: spec_const - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($1)); - $$ = new ASTNode(ASTType::SPECC_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } + { $$ = new SExpr{{}, std::move(*$1)}; } | symbol - { - $$ = $1; - } + { $$ = new SExpr{{}, std::move(*$1)}; } | TK_KEY - { - $$ = new ASTNode(ASTType::UATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); - } + { $$ = new SExpr{{}, std::move(*$1)}; } | '(' s_expr_list ')' - { - $$ = new ASTNode(ASTType::SEXPRL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($2)); - } + { $$ = new SExpr{{}, std::move(*$2)}; } ; s_expr_list: - { - $$ = new ASTVec(); - } + { $$ = new std::vector(); } | s_expr_list s_expr { - $1->emplace_back(ASTNode_up($2)); + $1->emplace_back($2); $$ = $1; } ; spec_const: TK_NUM - { $$ = new ASTNode(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = new SpecConstNode{{}, ConstType::numeral, std::move(*$1)}; } | TK_DEC - { $$ = new ASTNode(ASTType::DEC_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = new SpecConstNode{{}, ConstType::decimal, std::move(*$1)}; } | TK_HEX - { $$ = new ASTNode(ASTType::HEX_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = new SpecConstNode{{}, ConstType::hexadecimal, std::move(*$1)}; } | TK_BIN - { $$ = new ASTNode(ASTType::BIN_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = new SpecConstNode{{}, ConstType::binary, std::move(*$1)}; } | TK_STR - { $$ = new ASTNode(ASTType::STR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = new SpecConstNode{{}, ConstType::string, std::move(*$1)}; } ; const_val: symbol { $$ = $1; } | spec_const - { $$ = $1; } + { $$ = new SymbolNode {{}, std::move(*$1), false}; } ; numeral_list: numeral_list TK_NUM - { $1->emplace_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); $$ = $1; } + { $1->push_back(std::string(*$2)); delete $2; } | TK_NUM - { $$ = new ASTVec(); $$->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1))); } + { $$ = new std::vector{std::string(std::move(*$1))}; } ; qual_identifier: identifier - { $$ = $1; } + { $$ = new QualIdentifierNode {{}, std::move(*$1)}; } | '(' TK_AS identifier sort ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - tmp->push_back(ASTNode_up($4)); - $$ = new ASTNode(ASTType::AS_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } + { $$ = new QualIdentifierNode {{}, std::move(*$3), $4}; } ; var_binding_list: var_binding - { $$ = new ASTVec(); $$->push_back(ASTNode_up($1)); } + { $$ = new std::vector; $$->push_back(std::move(*$1)); } | var_binding_list var_binding - { $1->emplace_back(ASTNode_up($2)); $$ = $1; } + { $1->emplace_back(std::move(*$2)); $$ = $1; } ; var_binding: '(' symbol term ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - $$ = new ASTNode(ASTType::VARB_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr($2->getValue()), std::move(tmp)); - delete $2; - } + { $$ = new VarBindingNode { {}, std::move(*$2), std::move(*$3) }; } ; sorted_var_list: - { $$ = new ASTVec(); } + { $$ = new std::vector(); } | sorted_var_list sorted_var - { $1->emplace_back(ASTNode_up($2)); $$ = $1; } + { $1->emplace_back(std::move(*$2)); $$ = $1; } ; sorted_var: '(' symbol sort ')' - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - $$ = new ASTNode(ASTType::SV_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr($2->getValue()), std::move(tmp)); - delete $2; - } + { $$ = new SortedVarNode {{}, std::move(*$2), std::move(*$3)}; } term_list: - { $$ = new ASTVec(); } + { $$ = new std::vector(); } | term_list term - { $1->emplace_back(ASTNode_up($2)); $$ = $1; } + { $1->emplace_back($2); $$ = $1; } ; term: spec_const - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($1)); - $$ = new ASTNode(ASTType::TERM_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } + { $$ = new NormalTermNode(std::move(*$1)); } | qual_identifier - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($1)); - $$ = new ASTNode(ASTType::QID_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } + { $$ = new NormalTermNode(std::move($1->identifier), $1->returnSort, {}); delete $1; } | '(' qual_identifier term term_list ')' { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - tmp->push_back(ASTNode_up($3)); - $$ = new ASTNode(ASTType::LQID_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); + auto tmp = std::vector(); + tmp.push_back($3); for (auto & c : (*$4)) { - $$->children->emplace_back(std::move(c)); + tmp.emplace_back(std::move(c)); } delete $4; + $$ = new NormalTermNode(std::move($2->identifier), $2->returnSort, std::move(tmp)); } | '(' TK_LET '(' var_binding_list ')' term ')' - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::VARBL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($4))); - tmp->push_back(ASTNode_up($6)); - $$ = new ASTNode(ASTType::LET_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } - | '(' TK_FORALL '(' sorted_var_list ')' term ')' - { - // todo: AST traversal must ensure that sorted_var_list is non-empty - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::SVL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($4))); - tmp->push_back(ASTNode_up($6)); - $$ = new ASTNode(ASTType::FORALL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } - | '(' TK_EXISTS '(' sorted_var_list ')' term ')' - { - // todo: AST traversal must ensure that sorted_var_list is non-empty - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::SVL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($4))); - tmp->push_back(ASTNode_up($6)); - $$ = new ASTNode(ASTType::EXISTS_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } - | '(' '!' term attribute_list ')' - { - // todo: AST traversal must ensure that attribute_list is non-empty - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($3)); - tmp->push_back(std::make_unique(ASTType::GATTRL_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, ASTVec_up($4))); - $$ = new ASTNode(ASTType::BANG_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } + { $$ = new LetTermNode {{}, std::move(*$6), std::move(*$4)}; } + | '(' TK_FORALL '(' sorted_var_list ')' term ')' // todo: AST traversal must ensure that sorted_var_list is non-empty + { $$ = new ForallNode {{}, std::move(*$6), std::move(*$4)}; } + | '(' TK_EXISTS '(' sorted_var_list ')' term ')' // todo: AST traversal must ensure that sorted_var_list is non-empty + { $$ = new ExistsNode {{}, std::move(*$6), std::move(*$4)}; } + | '(' '!' term attribute_list ')' // todo: AST traversal must ensure that attribute_list is non-empty + { $$ = new AnnotationNode {{}, std::move(*$3), std::move(*$4)}; } ; symbol_list: - { $$ = new ASTVec(); } + { $$ = new std::vector(); } | symbol_list symbol - { $1->emplace_back(ASTNode_up($2)); $$ = $1; } + { $1->emplace_back(std::move(*$2)); $$ = $1; } ; b_value: symbol { - std::string const & str = $1->getValue(); - if (str == "true" or str == "false") { - $$ = new ASTNode(ASTType::BOOL_T, osmttokens::smt2token{osmttokens::t_none}, mkUniqueStr(str)); delete $1; - } - else { - printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", str.c_str()); + if (std::string const * str_p = std::get_if(&($1->name))) { + if (*str_p == "true") { + $$ = true; + } else if (*str_p == "false") { + $$ = false; + } else { + printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", str_p->c_str()); + delete $1; + YYERROR; + } + delete $1; + } else { + SpecConstNode const * node = std::get_if(&($1->name)); + assert(node); + printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", node->value.c_str()); delete $1; YYERROR; } @@ -532,77 +381,29 @@ b_value: symbol ; option: KW_PRINTSUCCESS b_value - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new PrintSuccess {{}, $2}; (void)$1; } | KW_EXPANDDEFINITIONS b_value - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new ExpandDefinitions {{}, $2}; (void)$1; } | KW_INTERACTIVEMODE b_value - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new InteractiveMode {{}, $2}; (void)$1; } | KW_PRODUCEPROOFS b_value - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new ProduceProofs {{}, $2}; (void)$1; } | KW_PRODUCEUNSATCORES b_value - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new ProduceUnsatCores {{}, $2}; (void)$1; } | KW_PRODUCEMODELS b_value - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new ProduceModels {{}, $2}; (void)$1; } | KW_PRODUCEASSIGNMENTS b_value - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($2)); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new ProduceAssignments {{}, $2}; (void)$1;} | KW_REGULAROUTPUTCHANNEL TK_STR - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::STR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new RegularOutputChannel {{}, std::move(*$2)}; (void)$1; } | KW_DIAGNOSTICOUTPUTCHANNEL TK_STR - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::STR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new DiagnosticOutputChannel {{}, std::move(*$2)}; (void)$1; } | KW_RANDOMSEED TK_NUM - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new RandomSeed {{}, std::stoi(*$2) }; free $2; (void)$1; } | KW_VERBOSITY TK_NUM - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::NUM_T, osmttokens::smt2token{osmttokens::t_none}, string_up($2))); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1), std::move(tmp)); - } + { $$ = new Verbosity {{}, std::stoi(*$2) }; free $2; (void)$1; } | attribute - { - auto tmp = std::make_unique(); - tmp->push_back(ASTNode_up($1)); - $$ = new ASTNode(ASTType::OPTION_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } + { $$ = new Attribute {{}, std::move(*$1) }; } ; predef_key: KW_SORTS @@ -664,25 +465,21 @@ predef_key: KW_SORTS ; info_flag: KW_ERRORBEHAVIOR - { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = $1; } | KW_NAME - { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = $1; } | KW_AUTHORS - { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = $1; } | KW_VERSION - { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = $1; } | KW_STATUS - { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = $1; } | KW_REASONUNKNOWN - { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = $1; } | KW_ALLSTATISTICS - { $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1)); } + { $$ = $1; } | TK_KEY - { - auto tmp = std::make_unique(); - tmp->push_back(std::make_unique(ASTType::GATTR_T, osmttokens::smt2token{osmttokens::t_none}, string_up($1))); - $$ = new ASTNode(ASTType::INFO_T, osmttokens::smt2token{osmttokens::t_none}, nullptr, std::move(tmp)); - } + { $$ = $1; } ; %% From 86925f7e8a6e7e56708db40d2847ccd45732fa5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Wed, 14 Sep 2022 10:40:03 +0200 Subject: [PATCH 36/94] parser: add a missing header --- src/parsers/smt2new/smt2newcontext.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 5720f6fb..3874f510 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SMT2NEWCONTEXT_H #include +#include #include "SMTConfig.h" enum class ConstType { From 750f28984ea128adf67a2305b89ba1973f397409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Wed, 14 Sep 2022 14:41:45 +0200 Subject: [PATCH 37/94] parser: prefer struct to class --- src/parsers/smt2new/smt2newcontext.h | 58 ++++------------------------ src/parsers/smt2new/smt2newparser.yy | 30 +++++++------- 2 files changed, 23 insertions(+), 65 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 3874f510..85ef46dd 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -57,9 +57,6 @@ struct SExpr : public GeneralNode { struct AttributeValueNode : public GeneralNode { std::variant> value; - AttributeValueNode(SpecConstNode && n) : value(std::move(n)) {} - AttributeValueNode(SymbolNode && n) : value(std::move(n)) {} - AttributeValueNode(std::vector n) : value(std::move(n)) {} }; struct AttributeNode : public GeneralNode { @@ -91,29 +88,13 @@ struct Attribute : public OptionNode { AttributeNode value; }; class CommandNode : public GeneralNode {}; -class SetLogic : public CommandNode { - SymbolNode logic; -public: - SetLogic(SymbolNode && logic) : logic(std::move(logic)) {} -}; - -class SetOption : public CommandNode { - OptionNode option; -public: - SetOption(OptionNode && option) : option(std::move(option)) {} -}; - -class SetInfo : public CommandNode { - AttributeNode attribute; -public: - SetInfo(AttributeNode && attribute) : attribute(std::move(attribute)) {} -}; +struct SetLogic : public CommandNode { SymbolNode logic; }; +struct SetOption : public CommandNode { OptionNode option; }; +struct SetInfo : public CommandNode { AttributeNode attribute; }; -class DeclareSort : public CommandNode { +struct DeclareSort : public CommandNode { SymbolNode symbol; std::string num; -public: - DeclareSort(SymbolNode && symbol, std::string && num) : symbol(std::move(symbol)), num(std::move(num)) {} }; struct SortNode : public GeneralNode { @@ -131,52 +112,29 @@ struct QualIdentifierNode : public GeneralNode { SortNode * returnSort = nullptr; }; -class DefineSort : public CommandNode { +struct DefineSort : public CommandNode { SymbolNode name; std::vector argumentSorts; SortNode sort; -public: - DefineSort(SymbolNode && name, std::vector && argumentSorts, SortNode && sort) - : name(std::move(name)) - , argumentSorts(std::move(argumentSorts)) - , sort(std::move(sort)) - {} }; -class DeclareFun : public CommandNode { +struct DeclareFun : public CommandNode { SymbolNode name; std::vector argumentSorts; SortNode returnSort; -public: - DeclareFun(SymbolNode && name, std::vector && argumentSorts, SortNode && returnSort) - : name(std::move(name)) - , argumentSorts(std::move(argumentSorts)) - , returnSort(std::move(returnSort)) - {} }; -class DeclareConst : public CommandNode { +struct DeclareConst : public CommandNode { std::variant name; SortNode sort; -public: - DeclareConst(SymbolNode && name, SortNode && sort) : name(std::move(name)), sort(std::move(sort)) {} - DeclareConst(SpecConstNode && name, SortNode && sort) : name(std::move(name)), sort(std::move(sort)) {} }; class TermNode : public GeneralNode {}; -class NormalTermNode : public TermNode { +struct NormalTermNode : public TermNode { std::variant head; SortNode * returnSort = nullptr; std::vector arguments; -public: - NormalTermNode(SpecConstNode && head) : head(std::move(head)) {} - NormalTermNode(IdentifierNode && head, SortNode * returnSort, std::vector && arguments) - : head(std::move(head)) - , returnSort(returnSort) - , arguments(std::move(arguments)) - {} - SortNode * getSortIfKnown() { return returnSort; } }; struct VarBindingNode : public GeneralNode { diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index e2eab04a..a5557192 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -159,19 +159,19 @@ command_list: ; command: '(' TK_SETLOGIC symbol ')' - { $$ = new SetLogic(std::move(*$3)); } + { $$ = new SetLogic {{}, std::move(*$3)}; } | '(' TK_SETOPTION option ')' - { $$ = new SetOption(std::move(*$3)); } + { $$ = new SetOption {{}, std::move(*$3)}; } | '(' TK_SETINFO attribute ')' - { $$ = new SetInfo(std::move(*$3)); } + { $$ = new SetInfo {{}, std::move(*$3)}; } | '(' TK_DECLARESORT symbol TK_NUM ')' - { $$ = new DeclareSort(std::move(*$3), std::move(*$4)); } + { $$ = new DeclareSort {{}, std::move(*$3), std::move(*$4)}; } | '(' TK_DEFINESORT symbol '(' symbol_list ')' sort ')' - { $$ = new DefineSort(std::move(*$3), std::move(*$5), std::move(*$7)); } + { $$ = new DefineSort {{}, std::move(*$3), std::move(*$5), std::move(*$7)}; } | '(' TK_DECLAREFUN symbol '(' sort_list ')' sort ')' - { $$ = new DeclareFun(std::move(*$3), std::move(*$5), std::move(*$7)); } + { $$ = new DeclareFun {{}, std::move(*$3), std::move(*$5), std::move(*$7)}; } | '(' TK_DECLARECONST const_val sort ')' - { $$ = new DeclareConst(std::move(*$3), std::move(*$4)); } + { $$ = new DeclareConst {{}, std::move(*$3), std::move(*$4)}; } | '(' TK_DEFINEFUN symbol '(' sorted_var_list ')' sort term ')' { $$ = new DefineFun {{}, std::move(*$3), std::move(*$5), std::move(*$7), std::move(*$8)}; } | '(' TK_PUSH TK_NUM ')' @@ -217,21 +217,21 @@ attribute_list: ; attribute: TK_KEY - { $$ = new AttributeNode { {}, false, std::move(*$1), AttributeValueNode{std::vector{}} }; } + { $$ = new AttributeNode { {}, false, std::move(*$1), {{}, std::vector{}} }; } | TK_KEY attribute_value { $$ = new AttributeNode { {}, false, std::move(*$1), std::move(*$2) }; } | predef_key - { $$ = new AttributeNode { {}, true, std::move(*$1), AttributeValueNode{std::vector{}} }; } + { $$ = new AttributeNode { {}, true, std::move(*$1), {{}, std::vector{}} }; } | predef_key attribute_value { $$ = new AttributeNode { {}, true, std::move(*$1), std::move(*$2) }; } ; attribute_value: spec_const - { $$ = new AttributeValueNode {std::move(*$1)}; } + { $$ = new AttributeValueNode {{}, std::move(*$1)}; } | symbol - { $$ = new AttributeValueNode {std::move(*$1)}; } + { $$ = new AttributeValueNode {{}, std::move(*$1)}; } | '(' s_expr_list ')' - { $$ = new AttributeValueNode {std::move(*$2)}; } + { $$ = new AttributeValueNode {{}, std::move(*$2)}; } ; identifier: symbol @@ -328,9 +328,9 @@ term_list: ; term: spec_const - { $$ = new NormalTermNode(std::move(*$1)); } + { $$ = new NormalTermNode {{}, std::move(*$1), nullptr, std::vector{}}; } | qual_identifier - { $$ = new NormalTermNode(std::move($1->identifier), $1->returnSort, {}); delete $1; } + { $$ = new NormalTermNode {{}, std::move($1->identifier), $1->returnSort, {}}; delete $1; } | '(' qual_identifier term term_list ')' { auto tmp = std::vector(); @@ -339,7 +339,7 @@ term: spec_const tmp.emplace_back(std::move(c)); } delete $4; - $$ = new NormalTermNode(std::move($2->identifier), $2->returnSort, std::move(tmp)); + $$ = new NormalTermNode {{}, std::move($2->identifier), $2->returnSort, std::move(tmp)}; } | '(' TK_LET '(' var_binding_list ')' term ')' { $$ = new LetTermNode {{}, std::move(*$6), std::move(*$4)}; } From 39015c42551a77b7c3433a194e703bd67483783f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Wed, 14 Sep 2022 15:13:56 +0200 Subject: [PATCH 38/94] parser: Some destructors --- src/parsers/smt2new/smt2newcontext.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 85ef46dd..8d34a908 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -53,10 +53,37 @@ struct SymbolNode : public GeneralNode { struct SExpr : public GeneralNode { std::variant> data; + ~SExpr() { + struct Qel { + SExpr * node; + uint32_t processed; + }; + std::vector queue; + queue.emplace_back(Qel{this, static_cast(0)}); + while (not queue.empty()) { + auto & [node, processed] = queue.back(); + auto children = std::get_if>(&node->data); + if (children and processed < children->size()) { + ++processed; + queue.emplace_back(Qel{(*children)[processed - 1], 0}); + } + assert(not children or processed == children->size()); + assert(node); + delete node; + queue.pop_back(); + } + } }; struct AttributeValueNode : public GeneralNode { std::variant> value; + ~AttributeValueNode() { + if (auto vec = std::get_if>(&value)) { + for (auto el : *vec) { + delete el; + } + } + } }; struct AttributeNode : public GeneralNode { From f34d38315bf76497d8107e4e11523fe765e683ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Tue, 20 Sep 2022 10:11:09 +0200 Subject: [PATCH 39/94] parser: more memory management --- src/parsers/smt2new/smt2newcontext.cc | 79 +++++++---- src/parsers/smt2new/smt2newcontext.h | 186 ++++++++++++++++---------- src/parsers/smt2new/smt2newparser.yy | 143 ++++++++++---------- 3 files changed, 239 insertions(+), 169 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.cc b/src/parsers/smt2new/smt2newcontext.cc index 66e6b93c..3f188e9f 100644 --- a/src/parsers/smt2new/smt2newcontext.cc +++ b/src/parsers/smt2new/smt2newcontext.cc @@ -1,30 +1,53 @@ -/********************************************************************* -Author: Antti Hyvarinen +/* +* Copyright (c) 2021, Antti Hyvarinen +* +* SPDX-License-Identifier: MIT +*/ -OpenSMT2 -- Copyright (C) 2012 - 2014 Antti Hyvarinen - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*********************************************************************/ - - -#include #include "smt2newcontext.h" - - +namespace { + struct Qel { + TermNode* node; + uint32_t processed; + }; + bool checkProcessedProperty(Qel & element) { + auto & [termNode, processed] = element; + assert(termNode); + if (auto normalTermNode = dynamic_cast(termNode)) { + return processed == normalTermNode->arguments->size(); + } else if (auto letTermNode = dynamic_cast(termNode)) { + return processed == letTermNode->arguments->size() + letTermNode->bindings->size(); + } + assert(false); + return false; + } +} + +TermNode::~TermNode() { + std::vector queue; + queue.emplace_back(Qel{this, static_cast(0)}); + while (not queue.empty()) { + auto & [termNode, processed] = queue.back(); + auto & children = *(termNode->arguments); + if (processed < children.size()) { + ++ processed; + queue.emplace_back(Qel{children[processed - 1], 0}); + } else if (auto letTermNode = dynamic_cast(termNode)) { + auto & bindings = *(letTermNode->bindings); + assert(children.size() == 1); + if (processed < bindings.size()+1) { + ++ processed; + queue.emplace_back(Qel{bindings[processed -1]->term, 0}); + } + } + assert(termNode); + assert(checkProcessedProperty(queue.back())); + + for (auto child : *arguments) { + assert(child->arguments->empty()); + delete child; + } + termNode->arguments->clear(); // delete is not called on the pointers + queue.pop_back(); + } +} diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 8d34a908..5b545672 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -43,16 +43,16 @@ class GeneralNode {}; struct SpecConstNode : public GeneralNode { ConstType type; - std::string value; + std::unique_ptr value; }; struct SymbolNode : public GeneralNode { - std::variant name; - bool quoted; + std::variant,std::unique_ptr> name; + bool quoted; }; struct SExpr : public GeneralNode { - std::variant> data; + std::variant,std::unique_ptr,std::unique_ptr,std::unique_ptr>> data; ~SExpr() { struct Qel { SExpr * node; @@ -62,12 +62,12 @@ struct SExpr : public GeneralNode { queue.emplace_back(Qel{this, static_cast(0)}); while (not queue.empty()) { auto & [node, processed] = queue.back(); - auto children = std::get_if>(&node->data); - if (children and processed < children->size()) { + auto children = std::get_if>>(&node->data); + if (children and processed < (*children)->size()) { ++processed; - queue.emplace_back(Qel{(*children)[processed - 1], 0}); + queue.emplace_back(Qel{(**children)[processed - 1], 0}); } - assert(not children or processed == children->size()); + assert(not children or processed == (*children)->size()); assert(node); delete node; queue.pop_back(); @@ -76,10 +76,13 @@ struct SExpr : public GeneralNode { }; struct AttributeValueNode : public GeneralNode { - std::variant> value; + std::variant, std::unique_ptr, std::unique_ptr>> value; + AttributeValueNode(std::unique_ptr && node) : value(std::move(node)) {} + AttributeValueNode(std::unique_ptr && node) : value(std::move(node)) {} + AttributeValueNode(std::unique_ptr> && node) : value(std::move(node)) {} ~AttributeValueNode() { - if (auto vec = std::get_if>(&value)) { - for (auto el : *vec) { + if (auto vec = std::get_if>>(&value)) { + for (auto el : (**vec)) { delete el; } } @@ -88,13 +91,13 @@ struct AttributeValueNode : public GeneralNode { struct AttributeNode : public GeneralNode { bool predefined = false; - std::string name; - AttributeValueNode value; + std::unique_ptr name; + std::unique_ptr value; }; struct IdentifierNode : public GeneralNode { - SymbolNode symbol; - std::vector numeralList; + std::unique_ptr symbol; + std::unique_ptr> numeralList; }; @@ -115,97 +118,142 @@ struct Attribute : public OptionNode { AttributeNode value; }; class CommandNode : public GeneralNode {}; -struct SetLogic : public CommandNode { SymbolNode logic; }; -struct SetOption : public CommandNode { OptionNode option; }; -struct SetInfo : public CommandNode { AttributeNode attribute; }; +struct SetLogic : public CommandNode { std::unique_ptr logic; }; +struct SetOption : public CommandNode { std::unique_ptr option; }; +struct SetInfo : public CommandNode { std::unique_ptr attribute; }; struct DeclareSort : public CommandNode { - SymbolNode symbol; - std::string num; + std::unique_ptr symbol; + std::unique_ptr num; }; struct SortNode : public GeneralNode { - IdentifierNode identifier; -}; - + std::unique_ptr identifier; + std::unique_ptr> sortList; -struct ComplexSortNode : public SortNode { - SortNode * sort; - std::vector sortList; + ~SortNode() { + struct Qel { + SortNode * node; + uint32_t processed; + }; + std::vector queue; + queue.emplace_back(Qel{this, static_cast(0)}); + while (not queue.empty()) { + auto & [node, processed] = queue.back(); + auto & children = *node->sortList; + if (processed < children.size()) { + ++processed; + queue.emplace_back(Qel{children[processed - 1], 0}); + } + assert(processed == children.size()); + assert(node); + for (auto child : *sortList) { + assert(child->sortList->empty()); + delete child; + } + node->sortList->clear(); // delete is not called on the pointers + queue.pop_back(); + } + } }; struct QualIdentifierNode : public GeneralNode { - IdentifierNode identifier; - SortNode * returnSort = nullptr; + std::unique_ptr identifier; + std::unique_ptr returnSort = nullptr; }; struct DefineSort : public CommandNode { - SymbolNode name; - std::vector argumentSorts; - SortNode sort; + std::unique_ptr name; + std::unique_ptr>> argumentSorts; + std::unique_ptr sort; }; struct DeclareFun : public CommandNode { - SymbolNode name; - std::vector argumentSorts; - SortNode returnSort; + std::unique_ptr name; + std::unique_ptr> argumentSorts; + std::unique_ptr returnSort; + ~DeclareFun() { + for (auto sort : *argumentSorts) { + delete sort; + } + } }; struct DeclareConst : public CommandNode { - std::variant name; - SortNode sort; + std::variant,std::unique_ptr> name; + std::unique_ptr sort; }; -class TermNode : public GeneralNode {}; - -struct NormalTermNode : public TermNode { - std::variant head; - SortNode * returnSort = nullptr; - std::vector arguments; +struct SortedVarNode : public GeneralNode { + std::unique_ptr symbol; + std::unique_ptr sort; }; +struct TermNode; + struct VarBindingNode : public GeneralNode { - SymbolNode symbol; - TermNode term; + std::unique_ptr symbol; + TermNode * term; }; -struct LetTermNode : public TermNode { - TermNode term; - std::vector bindings; +struct TermNode : public GeneralNode { + std::unique_ptr> arguments; + TermNode(std::unique_ptr> && arguments) : arguments(std::move(arguments)) {} + virtual ~TermNode(); }; -struct SortedVarNode : public GeneralNode { - SymbolNode symbol; - SortNode sort; +struct NormalTermNode : public TermNode { + std::variant,std::unique_ptr> head; + std::unique_ptr returnSort = nullptr; + // Todo: understand why I need this constructor + NormalTermNode(std::unique_ptr> && arguments, + std::variant, + std::unique_ptr> && head, + std::unique_ptr && returnSort) + : TermNode(std::move(arguments)), head(std::move(head)), returnSort(std::move(returnSort)) {} +}; + +struct LetTermNode : public TermNode { + std::unique_ptr>> bindings; + LetTermNode(TermNode * term, std::unique_ptr>> && bindings) + : TermNode{std::make_unique>(std::vector{term})} + , bindings(std::move(bindings)) + {} }; struct ForallNode : public TermNode { - TermNode term; - std::vector bindings; + std::unique_ptr> quantified; + ForallNode(TermNode * term, std::unique_ptr> && quantified) + : TermNode{std::make_unique>(std::vector{term})} + , quantified(std::move(quantified)) {} }; struct ExistsNode : public TermNode { - TermNode term; - std::vector bindings; + std::unique_ptr> quantified; + ExistsNode(TermNode * term, std::unique_ptr> && quantified) + : TermNode{std::make_unique>(std::vector{term})} + , quantified(std::move(quantified)) {} }; struct AnnotationNode : public TermNode { - TermNode term; - std::vector attributes; + std::unique_ptr> attributes; + AnnotationNode(TermNode * term, std::unique_ptr> && attributes) + : TermNode{std::make_unique>(std::vector{term})} + , attributes(std::move(attributes)) {} }; struct DefineFun : public CommandNode { - SymbolNode name; - std::vector args; - SortNode returnSort; - TermNode term; + std::unique_ptr name; + std::unique_ptr> args; + std::unique_ptr returnSort; + std::unique_ptr term; }; struct PushNode : public CommandNode { int num; }; struct PopNode : public CommandNode { int num; }; -struct AssertNode : public CommandNode { TermNode term; }; +struct AssertNode : public CommandNode { std::unique_ptr term; }; struct CheckSatNode : public CommandNode {}; @@ -213,25 +261,25 @@ struct GetAssertions : public CommandNode {}; struct GetProof : public CommandNode {}; -struct GetInterpolants : public CommandNode { std::vector configuration; }; +struct GetInterpolants : public CommandNode { std::unique_ptr> configuration; }; struct GetUnsatCore : public CommandNode {}; -struct GetValue : public CommandNode { std::vector terms; }; +struct GetValue : public CommandNode { std::unique_ptr> terms; }; struct GetModel : public CommandNode {}; struct GetAssignment : public CommandNode {}; -struct GetOption : public CommandNode { std::string key; }; +struct GetOption : public CommandNode { std::unique_ptr key; }; -struct GetInfo : public CommandNode { std::string key; }; +struct GetInfo : public CommandNode { std::unique_ptr key; }; struct Simplify : public CommandNode {}; struct Exit : public CommandNode {}; -struct Echo : public CommandNode { std::string text; }; +struct Echo : public CommandNode { std::unique_ptr text; }; class Smt2newContext { private: @@ -240,14 +288,14 @@ class Smt2newContext { char* buffer; int buffer_sz; int buffer_cap; - std::vector root; + std::unique_ptr> root; public: void* scanner; int result; FILE* is; char* ib; bool interactive; - inline std::vector const & getRoot() { return root; }; + inline std::vector const & getRoot() { return *root; }; Smt2newContext(FILE* in) : buffer_sz(0) @@ -295,7 +343,7 @@ class Smt2newContext { buffer_sz = 0; } - void insertRoot(std::vector && n) { + void insertRoot(std::unique_ptr> && n) { root = std::move(n); } diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index a5557192..95ad2096 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -78,7 +78,7 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma IdentifierNode * n_identifier; QualIdentifierNode * n_qualIdentifier; VarBindingNode * n_varBinding; - std::vector * n_varBindingList; + std::vector> * n_varBindingList; std::vector * n_sortList; std::vector * n_numeralList; AttributeNode * n_attribute; @@ -93,7 +93,7 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma std::vector * n_termList; std::vector * n_attributeList; std::vector * n_commandList; - std::vector * n_symbolList; + std::vector> * n_symbolList; std::vector * sexpr_list; std::string * str; bool n_bool; @@ -144,12 +144,12 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma %% -script: command_list { context->insertRoot(std::move(*$1)); }; +script: command_list { context->insertRoot(std::unique_ptr>($1)); }; symbol: TK_SYM - { $$ = new SymbolNode{{}, {std::move(*$1)}, false}; } + { $$ = new SymbolNode {{}, {std::unique_ptr($1)}, false}; } | TK_QSYM - { $$ = new SymbolNode {{}, {std::move(*$1)}, true}; } + { $$ = new SymbolNode {{}, {std::unique_ptr($1)}, true}; } ; command_list: @@ -159,27 +159,27 @@ command_list: ; command: '(' TK_SETLOGIC symbol ')' - { $$ = new SetLogic {{}, std::move(*$3)}; } + { $$ = new SetLogic {{}, std::unique_ptr($3)}; } | '(' TK_SETOPTION option ')' - { $$ = new SetOption {{}, std::move(*$3)}; } + { $$ = new SetOption {{}, std::unique_ptr($3)}; } | '(' TK_SETINFO attribute ')' - { $$ = new SetInfo {{}, std::move(*$3)}; } + { $$ = new SetInfo {{}, std::unique_ptr($3)}; } | '(' TK_DECLARESORT symbol TK_NUM ')' - { $$ = new DeclareSort {{}, std::move(*$3), std::move(*$4)}; } + { $$ = new DeclareSort {{}, std::unique_ptr($3), std::unique_ptr($4)}; } | '(' TK_DEFINESORT symbol '(' symbol_list ')' sort ')' - { $$ = new DefineSort {{}, std::move(*$3), std::move(*$5), std::move(*$7)}; } + { $$ = new DefineSort {{}, std::unique_ptr($3), std::unique_ptr>>($5), std::unique_ptr($7)}; } | '(' TK_DECLAREFUN symbol '(' sort_list ')' sort ')' - { $$ = new DeclareFun {{}, std::move(*$3), std::move(*$5), std::move(*$7)}; } + { $$ = new DeclareFun {{}, std::unique_ptr($3), std::unique_ptr>($5), std::unique_ptr($7)}; } | '(' TK_DECLARECONST const_val sort ')' - { $$ = new DeclareConst {{}, std::move(*$3), std::move(*$4)}; } + { $$ = new DeclareConst {{}, std::unique_ptr($3), std::unique_ptr($4)}; } | '(' TK_DEFINEFUN symbol '(' sorted_var_list ')' sort term ')' - { $$ = new DefineFun {{}, std::move(*$3), std::move(*$5), std::move(*$7), std::move(*$8)}; } + { $$ = new DefineFun {{}, std::unique_ptr($3), std::unique_ptr>($5), std::unique_ptr($7), std::unique_ptr($8)}; } | '(' TK_PUSH TK_NUM ')' { $$ = new PushNode {{}, std::stoi(*$3)}; delete $3; } | '(' TK_POP TK_NUM ')' { $$ = new PopNode {{}, std::stoi(*$3)}; delete $3; } | '(' TK_ASSERT term ')' - { $$ = new AssertNode{{}, std::move(*$3)}; } + { $$ = new AssertNode{{}, std::unique_ptr($3)}; } | '(' TK_CHECKSAT ')' { $$ = new CheckSatNode(); } | '(' TK_GETASSERTIONS ')' @@ -187,27 +187,27 @@ command: '(' TK_SETLOGIC symbol ')' | '(' TK_GETPROOF ')' { $$ = new GetProof() ; } | '(' TK_GETITPS term_list ')' - { $$ = new GetInterpolants {{}, std::move(*$3)}; } + { $$ = new GetInterpolants {{}, std::unique_ptr>($3)}; } | '(' TK_GETUNSATCORE ')' { $$ = new GetUnsatCore(); } | '(' TK_GETVALUE '(' term_list ')' ')' - { $$ = new GetValue { {}, std::move(*$4) }; } + { $$ = new GetValue { {}, std::unique_ptr>($4) }; } | '(' TK_GETMODEL ')' { $$ = new GetModel(); } | '(' TK_GETASSIGNMENT ')' { $$ = new GetAssignment(); } | '(' TK_GETOPTION TK_KEY ')' - { $$ = new GetOption{ {}, std::move(*$3) }; } + { $$ = new GetOption{ {}, std::unique_ptr($3) }; } | '(' TK_GETOPTION predef_key ')' - { $$ = new GetOption{ {}, std::move(*$3) }; } + { $$ = new GetOption{ {}, std::unique_ptr($3) }; } | '(' TK_GETINFO info_flag ')' - { $$ = new GetInfo{ {}, std::move(*$3) }; } + { $$ = new GetInfo{ {}, std::unique_ptr($3) }; } | '(' TK_SIMPLIFY ')' { $$ = new Simplify(); } | '(' TK_EXIT ')' { $$ = new Exit(); } | '(' TK_ECHO TK_STR ')' - { $$ = new Echo{ {}, std::move(*$3) }; } + { $$ = new Echo{ {}, std::unique_ptr($3) }; } ; attribute_list: @@ -217,33 +217,36 @@ attribute_list: ; attribute: TK_KEY - { $$ = new AttributeNode { {}, false, std::move(*$1), {{}, std::vector{}} }; } + { $$ = new AttributeNode { {}, false, std::unique_ptr($1), std::make_unique(std::make_unique>()) }; } | TK_KEY attribute_value - { $$ = new AttributeNode { {}, false, std::move(*$1), std::move(*$2) }; } + { $$ = new AttributeNode { {}, false, std::unique_ptr($1), std::unique_ptr($2) }; } | predef_key - { $$ = new AttributeNode { {}, true, std::move(*$1), {{}, std::vector{}} }; } + { $$ = new AttributeNode { {}, true, std::unique_ptr($1), std::make_unique(std::make_unique>()) }; } | predef_key attribute_value - { $$ = new AttributeNode { {}, true, std::move(*$1), std::move(*$2) }; } + { $$ = new AttributeNode { {}, true, std::unique_ptr($1), std::unique_ptr($2) }; } ; attribute_value: spec_const - { $$ = new AttributeValueNode {{}, std::move(*$1)}; } + { $$ = new AttributeValueNode(std::unique_ptr($1)); } | symbol - { $$ = new AttributeValueNode {{}, std::move(*$1)}; } + { $$ = new AttributeValueNode(std::unique_ptr($1)); } | '(' s_expr_list ')' - { $$ = new AttributeValueNode {{}, std::move(*$2)}; } + { $$ = new AttributeValueNode(std::unique_ptr>($2)); } ; identifier: symbol - { $$ = new IdentifierNode {{}, std::move(*$1), {}}; } + { $$ = new IdentifierNode {{}, std::unique_ptr($1), {}}; } | '(' '_' symbol numeral_list ')' - { $$ = new IdentifierNode {{}, std::move(*$3), std::move(*$4)}; } + { $$ = new IdentifierNode {{}, std::unique_ptr($3), std::unique_ptr>($4)}; } ; sort: identifier - { $$ = new SortNode {{}, std::move(*$1)}; } - | '(' identifier sort sort_list ')' - { $$ = new ComplexSortNode {{{}, std::move(*$2)}, $3, std::move(*$4)}; } + { $$ = new SortNode {{}, std::unique_ptr($1), std::make_unique>()}; } + | '(' identifier sort_list sort ')' + { + $3->push_back($4); + $$ = new SortNode {{}, std::unique_ptr($2), std::unique_ptr>($3)}; + } ; sort_list: sort_list sort @@ -253,13 +256,13 @@ sort_list: sort_list sort ; s_expr: spec_const - { $$ = new SExpr{{}, std::move(*$1)}; } + { $$ = new SExpr{{}, std::unique_ptr($1)}; } | symbol - { $$ = new SExpr{{}, std::move(*$1)}; } + { $$ = new SExpr{{}, std::unique_ptr($1)}; } | TK_KEY - { $$ = new SExpr{{}, std::move(*$1)}; } + { $$ = new SExpr{{}, std::unique_ptr($1)}; } | '(' s_expr_list ')' - { $$ = new SExpr{{}, std::move(*$2)}; } + { $$ = new SExpr{{}, std::unique_ptr>($2)}; } ; s_expr_list: @@ -273,43 +276,43 @@ s_expr_list: spec_const: TK_NUM - { $$ = new SpecConstNode{{}, ConstType::numeral, std::move(*$1)}; } + { $$ = new SpecConstNode{{}, ConstType::numeral, std::unique_ptr($1)}; } | TK_DEC - { $$ = new SpecConstNode{{}, ConstType::decimal, std::move(*$1)}; } + { $$ = new SpecConstNode{{}, ConstType::decimal, std::unique_ptr($1)}; } | TK_HEX - { $$ = new SpecConstNode{{}, ConstType::hexadecimal, std::move(*$1)}; } + { $$ = new SpecConstNode{{}, ConstType::hexadecimal, std::unique_ptr($1)}; } | TK_BIN - { $$ = new SpecConstNode{{}, ConstType::binary, std::move(*$1)}; } + { $$ = new SpecConstNode{{}, ConstType::binary, std::unique_ptr($1)}; } | TK_STR - { $$ = new SpecConstNode{{}, ConstType::string, std::move(*$1)}; } + { $$ = new SpecConstNode{{}, ConstType::string, std::unique_ptr($1)}; } ; const_val: symbol { $$ = $1; } | spec_const - { $$ = new SymbolNode {{}, std::move(*$1), false}; } + { $$ = new SymbolNode {{}, std::unique_ptr($1), false}; } ; numeral_list: numeral_list TK_NUM - { $1->push_back(std::string(*$2)); delete $2; } + { $1->emplace_back(std::move(*$2)); } | TK_NUM - { $$ = new std::vector{std::string(std::move(*$1))}; } + { $$ = new std::vector{std::string(std::move(*$1))}; } ; qual_identifier: identifier - { $$ = new QualIdentifierNode {{}, std::move(*$1)}; } + { $$ = new QualIdentifierNode {{}, std::unique_ptr($1)}; } | '(' TK_AS identifier sort ')' - { $$ = new QualIdentifierNode {{}, std::move(*$3), $4}; } + { $$ = new QualIdentifierNode {{}, std::unique_ptr($3), std::unique_ptr($4)}; } ; var_binding_list: var_binding - { $$ = new std::vector; $$->push_back(std::move(*$1)); } + { $$ = new std::vector>; $$->push_back(std::unique_ptr($1)); } | var_binding_list var_binding - { $1->emplace_back(std::move(*$2)); $$ = $1; } + { $1->emplace_back(std::unique_ptr($2)); $$ = $1; } ; var_binding: '(' symbol term ')' - { $$ = new VarBindingNode { {}, std::move(*$2), std::move(*$3) }; } + { $$ = new VarBindingNode { {}, std::unique_ptr($2), $3 }; } ; sorted_var_list: @@ -319,7 +322,7 @@ sorted_var_list: ; sorted_var: '(' symbol sort ')' - { $$ = new SortedVarNode {{}, std::move(*$2), std::move(*$3)}; } + { $$ = new SortedVarNode {{}, std::unique_ptr($2), std::unique_ptr($3)}; } term_list: { $$ = new std::vector(); } @@ -328,52 +331,48 @@ term_list: ; term: spec_const - { $$ = new NormalTermNode {{}, std::move(*$1), nullptr, std::vector{}}; } + { $$ = new NormalTermNode {{}, std::unique_ptr($1), nullptr}; } | qual_identifier - { $$ = new NormalTermNode {{}, std::move($1->identifier), $1->returnSort, {}}; delete $1; } - | '(' qual_identifier term term_list ')' + { $$ = new NormalTermNode {{}, std::unique_ptr($1->identifier.release()), std::unique_ptr($1->returnSort.release())}; delete $1; } + | '(' qual_identifier term_list term ')' { - auto tmp = std::vector(); - tmp.push_back($3); - for (auto & c : (*$4)) { - tmp.emplace_back(std::move(c)); - } - delete $4; - $$ = new NormalTermNode {{}, std::move($2->identifier), $2->returnSort, std::move(tmp)}; + $3->push_back($4); + $$ = new NormalTermNode {{std::unique_ptr>($3)}, std::unique_ptr($2->identifier.release()), std::unique_ptr($2->returnSort.release())}; + delete $2; } | '(' TK_LET '(' var_binding_list ')' term ')' - { $$ = new LetTermNode {{}, std::move(*$6), std::move(*$4)}; } + { $$ = new LetTermNode {$6, std::unique_ptr>>($4)}; } | '(' TK_FORALL '(' sorted_var_list ')' term ')' // todo: AST traversal must ensure that sorted_var_list is non-empty - { $$ = new ForallNode {{}, std::move(*$6), std::move(*$4)}; } + { $$ = new ForallNode {$6, std::unique_ptr>($4)}; } | '(' TK_EXISTS '(' sorted_var_list ')' term ')' // todo: AST traversal must ensure that sorted_var_list is non-empty - { $$ = new ExistsNode {{}, std::move(*$6), std::move(*$4)}; } + { $$ = new ExistsNode {$6, std::unique_ptr>($4)}; } | '(' '!' term attribute_list ')' // todo: AST traversal must ensure that attribute_list is non-empty - { $$ = new AnnotationNode {{}, std::move(*$3), std::move(*$4)}; } + { $$ = new AnnotationNode {$3, std::unique_ptr>($4)}; } ; symbol_list: - { $$ = new std::vector(); } + { $$ = new std::vector>(); } | symbol_list symbol - { $1->emplace_back(std::move(*$2)); $$ = $1; } + { $1->push_back(std::unique_ptr($2)); $$ = $1; } ; b_value: symbol { - if (std::string const * str_p = std::get_if(&($1->name))) { - if (*str_p == "true") { + if (auto const str_p = std::get_if>(&($1->name))) { + if (**str_p == "true") { $$ = true; - } else if (*str_p == "false") { + } else if (**str_p == "false") { $$ = false; } else { - printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", str_p->c_str()); + printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", (**str_p).c_str()); delete $1; YYERROR; } delete $1; } else { - SpecConstNode const * node = std::get_if(&($1->name)); + auto const * node = std::get_if>(&($1->name)); assert(node); - printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", node->value.c_str()); + printf("Syntax error: expecting either 'true' or 'false', got '%s'\n", (*(*node)->value).c_str()); delete $1; YYERROR; } From 9976f31c716541cf1dc6b7b3763fb9f2a3e4746e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Tue, 20 Sep 2022 10:11:53 +0200 Subject: [PATCH 40/94] parser: enable cleaning the parsed data structures --- src/api/Interpret.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index fb894c2a..a47bee9d 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -1000,10 +1000,12 @@ int Interpret::interpFile(FILE* in) { int rval = yyparse(&context); if (rval != 0) return rval; + + for (auto command : context.getRoot()) { +// execute(command); + delete command; + } return 0; -// const ASTNode & r = context.getRoot(); -// execute(r); -// return rval; } int Interpret::interpFile(char *content){ From b30aa52e1ce17f1239bcd39440ab8ffeb9308ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Tue, 20 Sep 2022 10:12:21 +0200 Subject: [PATCH 41/94] parser: add a unit test for checking mem leaks --- test/unit/CMakeLists.txt | 8 ++++++++ test/unit/test_ParserSymbols.cc | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/unit/test_ParserSymbols.cc diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 9d54259b..f543db09 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -245,3 +245,11 @@ PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/test_SATSolverTypes.cc" target_link_libraries(SATSolverTypesTest OpenSMT gtest gtest_main) gtest_add_tests(TARGET SATSolverTypesTest) + +add_executable(ParserSymbolsTest) +target_sources(ParserSymbolsTest +PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/test_ParserSymbols.cc" +) + +target_link_libraries(ParserSymbolsTest OpenSMT gtest gtest_main) +gtest_add_tests(TARGET ParserSymbolsTest) diff --git a/test/unit/test_ParserSymbols.cc b/test/unit/test_ParserSymbols.cc new file mode 100644 index 00000000..0e98f2fc --- /dev/null +++ b/test/unit/test_ParserSymbols.cc @@ -0,0 +1,11 @@ +// +// Created by Antti Hyvärinen on 20.09.22. +// + +#include +#include + +TEST(ParserSymbolsTest, test_DeclareSort) { +// auto str = new std::string("foo"); +// (void)SymbolNode{{}, std::unique_ptr(str), false}; +} \ No newline at end of file From 8bf3965983be8148a1067a402740da86117161ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Tue, 20 Sep 2022 11:23:57 +0200 Subject: [PATCH 42/94] parser: Add constructors for CommandNodes --- src/parsers/smt2new/smt2newcontext.h | 114 ++++++++++++++++++++------- src/parsers/smt2new/smt2newparser.yy | 34 ++++---- 2 files changed, 104 insertions(+), 44 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 5b545672..504c1725 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -116,15 +116,41 @@ struct RandomSeed : public OptionNode { int value; }; struct Verbosity : public OptionNode { int value; }; struct Attribute : public OptionNode { AttributeNode value; }; -class CommandNode : public GeneralNode {}; +// Note: classes derived from CommandNodes need to have a constructor because they need to be destructible as CommandNodes. +// In particular, CommandNode needs to have a virtual member function (destructor), which forbids aggregate initialization. -struct SetLogic : public CommandNode { std::unique_ptr logic; }; -struct SetOption : public CommandNode { std::unique_ptr option; }; -struct SetInfo : public CommandNode { std::unique_ptr attribute; }; +struct CommandNode : public GeneralNode { + virtual ~CommandNode() = default; +}; + +struct CheckSatNode : public CommandNode { }; +struct GetAssertions : public CommandNode { }; +struct GetProof : public CommandNode { }; +struct GetUnsatCore : public CommandNode { }; +struct GetModel : public CommandNode { }; +struct GetAssignment : public CommandNode { }; +struct Simplify : public CommandNode { }; +struct Exit : public CommandNode { }; + +struct SetLogic : public CommandNode { + std::unique_ptr logic; + SetLogic(std::unique_ptr && logic) : logic(std::move(logic)) {} +}; + +struct SetOption : public CommandNode { + std::unique_ptr option; + SetOption(std::unique_ptr && option) : option(std::move(option)) {} +}; + +struct SetInfo : public CommandNode { + std::unique_ptr attribute; + SetInfo(std::unique_ptr && attribute) : attribute(std::move(attribute)) {} +}; struct DeclareSort : public CommandNode { std::unique_ptr symbol; std::unique_ptr num; + DeclareSort(std::unique_ptr && symbol, std::unique_ptr && num) : symbol(std::move(symbol)), num(std::move(num)) {} }; struct SortNode : public GeneralNode { @@ -166,12 +192,26 @@ struct DefineSort : public CommandNode { std::unique_ptr name; std::unique_ptr>> argumentSorts; std::unique_ptr sort; + DefineSort(std::unique_ptr && name, + std::unique_ptr>> && argumentSorts, + std::unique_ptr && sort) + : name(std::move(name)) + , argumentSorts(std::move(argumentSorts)) + , sort(std::move(sort)) + {} }; struct DeclareFun : public CommandNode { std::unique_ptr name; std::unique_ptr> argumentSorts; std::unique_ptr returnSort; + DeclareFun(std::unique_ptr && name, + std::unique_ptr> && argumentSorts, + std::unique_ptr && returnSort) + : name(std::move(name)) + , argumentSorts(std::move(argumentSorts)) + , returnSort(std::move(returnSort)) + {} ~DeclareFun() { for (auto sort : *argumentSorts) { delete sort; @@ -182,6 +222,8 @@ struct DeclareFun : public CommandNode { struct DeclareConst : public CommandNode { std::variant,std::unique_ptr> name; std::unique_ptr sort; + DeclareConst(std::unique_ptr && name, std::unique_ptr && sort) : name(std::move(name)), sort(std::move(sort)) {} + DeclareConst(std::unique_ptr && name, std::unique_ptr && sort) : name(std::move(name)), sort(std::move(sort)) {} }; struct SortedVarNode : public GeneralNode { @@ -247,39 +289,57 @@ struct DefineFun : public CommandNode { std::unique_ptr> args; std::unique_ptr returnSort; std::unique_ptr term; + DefineFun(std::unique_ptr && name, + std::unique_ptr> && args, + std::unique_ptr && returnSort, + std::unique_ptr && term) + : name(std::move(name)) + , args(std::move(args)) + , returnSort(std::move(returnSort)) + , term(std::move(term)) + {} }; -struct PushNode : public CommandNode { int num; }; - -struct PopNode : public CommandNode { int num; }; - -struct AssertNode : public CommandNode { std::unique_ptr term; }; - -struct CheckSatNode : public CommandNode {}; - -struct GetAssertions : public CommandNode {}; - -struct GetProof : public CommandNode {}; - -struct GetInterpolants : public CommandNode { std::unique_ptr> configuration; }; - -struct GetUnsatCore : public CommandNode {}; +struct PushNode : public CommandNode { + int num; + PushNode(int num) : num(num) {} +}; -struct GetValue : public CommandNode { std::unique_ptr> terms; }; +struct PopNode : public CommandNode { + int num; + PopNode(int num) : num(num) {} +}; -struct GetModel : public CommandNode {}; +struct AssertNode : public CommandNode { + std::unique_ptr term; + AssertNode(std::unique_ptr && term) : term(std::move(term)) {} +}; -struct GetAssignment : public CommandNode {}; +struct GetInterpolants : public CommandNode { + std::unique_ptr> configuration; + GetInterpolants(std::unique_ptr> && configuration) : configuration(std::move(configuration)) {} +}; -struct GetOption : public CommandNode { std::unique_ptr key; }; -struct GetInfo : public CommandNode { std::unique_ptr key; }; +struct GetValue : public CommandNode { + std::unique_ptr> terms; + GetValue(std::unique_ptr> && terms) : terms(std::move(terms)) {} +}; -struct Simplify : public CommandNode {}; +struct GetOption : public CommandNode { + std::unique_ptr key; + GetOption(std::unique_ptr && key) : key(std::move(key)) {} +}; -struct Exit : public CommandNode {}; +struct GetInfo : public CommandNode { + std::unique_ptr key; + GetInfo(std::unique_ptr && key) : key(std::move(key)) {} +}; -struct Echo : public CommandNode { std::unique_ptr text; }; +struct Echo : public CommandNode { + std::unique_ptr text; + Echo(std::unique_ptr && text) : text(std::move(text)) {} +}; class Smt2newContext { private: diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 95ad2096..1741b131 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -159,27 +159,27 @@ command_list: ; command: '(' TK_SETLOGIC symbol ')' - { $$ = new SetLogic {{}, std::unique_ptr($3)}; } + { $$ = new SetLogic {std::unique_ptr($3)}; } | '(' TK_SETOPTION option ')' - { $$ = new SetOption {{}, std::unique_ptr($3)}; } + { $$ = new SetOption {std::unique_ptr($3)}; } | '(' TK_SETINFO attribute ')' - { $$ = new SetInfo {{}, std::unique_ptr($3)}; } + { $$ = new SetInfo {std::unique_ptr($3)}; } | '(' TK_DECLARESORT symbol TK_NUM ')' - { $$ = new DeclareSort {{}, std::unique_ptr($3), std::unique_ptr($4)}; } + { $$ = new DeclareSort {std::unique_ptr($3), std::unique_ptr($4)}; } | '(' TK_DEFINESORT symbol '(' symbol_list ')' sort ')' - { $$ = new DefineSort {{}, std::unique_ptr($3), std::unique_ptr>>($5), std::unique_ptr($7)}; } + { $$ = new DefineSort {std::unique_ptr($3), std::unique_ptr>>($5), std::unique_ptr($7)}; } | '(' TK_DECLAREFUN symbol '(' sort_list ')' sort ')' - { $$ = new DeclareFun {{}, std::unique_ptr($3), std::unique_ptr>($5), std::unique_ptr($7)}; } + { $$ = new DeclareFun {std::unique_ptr($3), std::unique_ptr>($5), std::unique_ptr($7)}; } | '(' TK_DECLARECONST const_val sort ')' - { $$ = new DeclareConst {{}, std::unique_ptr($3), std::unique_ptr($4)}; } + { $$ = new DeclareConst {std::unique_ptr($3), std::unique_ptr($4)}; } | '(' TK_DEFINEFUN symbol '(' sorted_var_list ')' sort term ')' - { $$ = new DefineFun {{}, std::unique_ptr($3), std::unique_ptr>($5), std::unique_ptr($7), std::unique_ptr($8)}; } + { $$ = new DefineFun {std::unique_ptr($3), std::unique_ptr>($5), std::unique_ptr($7), std::unique_ptr($8)}; } | '(' TK_PUSH TK_NUM ')' - { $$ = new PushNode {{}, std::stoi(*$3)}; delete $3; } + { $$ = new PushNode {std::stoi(*$3)}; delete $3; } | '(' TK_POP TK_NUM ')' - { $$ = new PopNode {{}, std::stoi(*$3)}; delete $3; } + { $$ = new PopNode {std::stoi(*$3)}; delete $3; } | '(' TK_ASSERT term ')' - { $$ = new AssertNode{{}, std::unique_ptr($3)}; } + { $$ = new AssertNode{std::unique_ptr($3)}; } | '(' TK_CHECKSAT ')' { $$ = new CheckSatNode(); } | '(' TK_GETASSERTIONS ')' @@ -187,27 +187,27 @@ command: '(' TK_SETLOGIC symbol ')' | '(' TK_GETPROOF ')' { $$ = new GetProof() ; } | '(' TK_GETITPS term_list ')' - { $$ = new GetInterpolants {{}, std::unique_ptr>($3)}; } + { $$ = new GetInterpolants {std::unique_ptr>($3)}; } | '(' TK_GETUNSATCORE ')' { $$ = new GetUnsatCore(); } | '(' TK_GETVALUE '(' term_list ')' ')' - { $$ = new GetValue { {}, std::unique_ptr>($4) }; } + { $$ = new GetValue {std::unique_ptr>($4)}; } | '(' TK_GETMODEL ')' { $$ = new GetModel(); } | '(' TK_GETASSIGNMENT ')' { $$ = new GetAssignment(); } | '(' TK_GETOPTION TK_KEY ')' - { $$ = new GetOption{ {}, std::unique_ptr($3) }; } + { $$ = new GetOption{ std::unique_ptr($3) }; } | '(' TK_GETOPTION predef_key ')' - { $$ = new GetOption{ {}, std::unique_ptr($3) }; } + { $$ = new GetOption{ std::unique_ptr($3) }; } | '(' TK_GETINFO info_flag ')' - { $$ = new GetInfo{ {}, std::unique_ptr($3) }; } + { $$ = new GetInfo{ std::unique_ptr($3) }; } | '(' TK_SIMPLIFY ')' { $$ = new Simplify(); } | '(' TK_EXIT ')' { $$ = new Exit(); } | '(' TK_ECHO TK_STR ')' - { $$ = new Echo{ {}, std::unique_ptr($3) }; } + { $$ = new Echo{ std::unique_ptr($3) }; } ; attribute_list: From 148e8c76ef3d5e7af163ded413226552bc1cf59c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Tue, 20 Sep 2022 11:31:07 +0200 Subject: [PATCH 43/94] Parser: Allow TermNode arguments to be nullptr --- src/parsers/smt2new/smt2newcontext.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parsers/smt2new/smt2newcontext.cc b/src/parsers/smt2new/smt2newcontext.cc index 3f188e9f..3e590392 100644 --- a/src/parsers/smt2new/smt2newcontext.cc +++ b/src/parsers/smt2new/smt2newcontext.cc @@ -28,6 +28,10 @@ TermNode::~TermNode() { queue.emplace_back(Qel{this, static_cast(0)}); while (not queue.empty()) { auto & [termNode, processed] = queue.back(); + if (not termNode->arguments) { + queue.pop_back(); + continue; + } auto & children = *(termNode->arguments); if (processed < children.size()) { ++ processed; From c29adaa47b608a04aaca2c3fb932ddc35e3c922f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 13 Oct 2022 14:41:27 +0200 Subject: [PATCH 44/94] Parser: fix debug code --- src/parsers/smt2new/smt2newcontext.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.cc b/src/parsers/smt2new/smt2newcontext.cc index 3e590392..58bc0bf4 100644 --- a/src/parsers/smt2new/smt2newcontext.cc +++ b/src/parsers/smt2new/smt2newcontext.cc @@ -10,16 +10,12 @@ namespace { TermNode* node; uint32_t processed; }; - bool checkProcessedProperty(Qel & element) { - auto & [termNode, processed] = element; + bool checkProcessedProperty(TermNode * termNode, size_t processed) { assert(termNode); - if (auto normalTermNode = dynamic_cast(termNode)) { - return processed == normalTermNode->arguments->size(); - } else if (auto letTermNode = dynamic_cast(termNode)) { + if (auto letTermNode = dynamic_cast(termNode)) { return processed == letTermNode->arguments->size() + letTermNode->bindings->size(); } - assert(false); - return false; + return processed == termNode->arguments->size(); } } @@ -45,7 +41,7 @@ TermNode::~TermNode() { } } assert(termNode); - assert(checkProcessedProperty(queue.back())); + assert(checkProcessedProperty(termNode, processed)); for (auto child : *arguments) { assert(child->arguments->empty()); From db52c0affb90ea0f0d5cd943521fb360055a70d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 13 Oct 2022 14:42:50 +0200 Subject: [PATCH 45/94] Parser: Fix deleting a TermNode --- src/parsers/smt2new/smt2newcontext.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.cc b/src/parsers/smt2new/smt2newcontext.cc index 58bc0bf4..eb146fb7 100644 --- a/src/parsers/smt2new/smt2newcontext.cc +++ b/src/parsers/smt2new/smt2newcontext.cc @@ -32,22 +32,25 @@ TermNode::~TermNode() { if (processed < children.size()) { ++ processed; queue.emplace_back(Qel{children[processed - 1], 0}); + continue; } else if (auto letTermNode = dynamic_cast(termNode)) { auto & bindings = *(letTermNode->bindings); assert(children.size() == 1); if (processed < bindings.size()+1) { ++ processed; - queue.emplace_back(Qel{bindings[processed -1]->term, 0}); + queue.emplace_back(Qel{bindings[processed - 2]->term, 0}); + continue; } } assert(termNode); assert(checkProcessedProperty(termNode, processed)); - for (auto child : *arguments) { - assert(child->arguments->empty()); + for (auto child : *(termNode->arguments)) { + assert(not child->arguments or child->arguments->empty()); delete child; } termNode->arguments->clear(); // delete is not called on the pointers + assert(termNode->arguments->empty()); queue.pop_back(); } } From 592bd87a5a1e5e497ab43a436b3a171fe3b6643e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 13 Oct 2022 14:43:08 +0200 Subject: [PATCH 46/94] Parser: fix deleting a SortNode --- src/parsers/smt2new/smt2newcontext.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 504c1725..274da47f 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -170,10 +170,11 @@ struct SortNode : public GeneralNode { if (processed < children.size()) { ++processed; queue.emplace_back(Qel{children[processed - 1], 0}); + continue; } assert(processed == children.size()); assert(node); - for (auto child : *sortList) { + for (auto child : *(node->sortList)) { assert(child->sortList->empty()); delete child; } From 3349cd577882832fb8867efa730df7bed6c7e2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 13 Oct 2022 15:14:53 +0200 Subject: [PATCH 47/94] Parser: fix memory leak on GetValue --- src/parsers/smt2new/smt2newcontext.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 274da47f..6a268e59 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -325,6 +325,7 @@ struct GetInterpolants : public CommandNode { struct GetValue : public CommandNode { std::unique_ptr> terms; GetValue(std::unique_ptr> && terms) : terms(std::move(terms)) {} + ~GetValue() { for (auto node : *terms) { delete node; } } }; struct GetOption : public CommandNode { From 56e14dc1e82cdc1d51eef082aa5a7882dd9bec72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 13 Oct 2022 16:17:00 +0200 Subject: [PATCH 48/94] Parser: fix memory leak on GetInterpolants --- src/parsers/smt2new/smt2newcontext.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 6a268e59..74149c05 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -319,6 +319,7 @@ struct AssertNode : public CommandNode { struct GetInterpolants : public CommandNode { std::unique_ptr> configuration; GetInterpolants(std::unique_ptr> && configuration) : configuration(std::move(configuration)) {} + ~GetInterpolants() { for (auto node : *configuration) { delete node; } } }; From 8236fa1c9011ba4a90de758798c1b715a095dc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 13 Oct 2022 16:39:45 +0200 Subject: [PATCH 49/94] Parser: free terms in let term bindings --- src/parsers/smt2new/smt2newcontext.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/parsers/smt2new/smt2newcontext.cc b/src/parsers/smt2new/smt2newcontext.cc index eb146fb7..a797a418 100644 --- a/src/parsers/smt2new/smt2newcontext.cc +++ b/src/parsers/smt2new/smt2newcontext.cc @@ -49,6 +49,12 @@ TermNode::~TermNode() { assert(not child->arguments or child->arguments->empty()); delete child; } + if (auto letTermNode = dynamic_cast(termNode)) { + for (auto & binding : *(letTermNode->bindings)) { + delete binding->term; + } + letTermNode->bindings->clear(); + } termNode->arguments->clear(); // delete is not called on the pointers assert(termNode->arguments->empty()); queue.pop_back(); From 5c6ca51511c758b926b9fa858ecdb5ff5af35cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 13 Oct 2022 17:35:59 +0200 Subject: [PATCH 50/94] Parser: correct deletion on top-level lets In current implementation let terms' bindings' terms are deleted inside TermNode::~TermNode. However, ~TermNode itself cannot know whether it is a LetTermNode. As a result, the top-level LetTermNode's bindings are not deleted. The commit fixes this by adding a destructor for LetTermNode. The destructor is guaranteed not to recurse because ~TermNode will take care of clearing bindings vector on all other TermNodes apart from the top-level. --- src/parsers/smt2new/smt2newcontext.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 74149c05..51e1785a 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -262,6 +262,13 @@ struct LetTermNode : public TermNode { : TermNode{std::make_unique>(std::vector{term})} , bindings(std::move(bindings)) {} + + // Note: ~TermNode makes sure that bindings is non-zero only on top-level LetTermNodes + ~LetTermNode() override { + for (auto & binding : *bindings) { + delete binding->term; + } + } }; struct ForallNode : public TermNode { From d8c9c280c363ee5161415684d6b45cc144342e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 13 Oct 2022 18:17:03 +0200 Subject: [PATCH 51/94] Parser: Fix memory leak on SortedVarNode --- src/parsers/smt2new/smt2newcontext.h | 12 ++++++------ src/parsers/smt2new/smt2newparser.yy | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 51e1785a..b7751be7 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -272,15 +272,15 @@ struct LetTermNode : public TermNode { }; struct ForallNode : public TermNode { - std::unique_ptr> quantified; - ForallNode(TermNode * term, std::unique_ptr> && quantified) + std::unique_ptr>> quantified; + ForallNode(TermNode * term, std::unique_ptr>> && quantified) : TermNode{std::make_unique>(std::vector{term})} , quantified(std::move(quantified)) {} }; struct ExistsNode : public TermNode { - std::unique_ptr> quantified; - ExistsNode(TermNode * term, std::unique_ptr> && quantified) + std::unique_ptr>> quantified; + ExistsNode(TermNode * term, std::unique_ptr>> && quantified) : TermNode{std::make_unique>(std::vector{term})} , quantified(std::move(quantified)) {} }; @@ -294,11 +294,11 @@ struct AnnotationNode : public TermNode { struct DefineFun : public CommandNode { std::unique_ptr name; - std::unique_ptr> args; + std::unique_ptr>> args; std::unique_ptr returnSort; std::unique_ptr term; DefineFun(std::unique_ptr && name, - std::unique_ptr> && args, + std::unique_ptr>> && args, std::unique_ptr && returnSort, std::unique_ptr && term) : name(std::move(name)) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 1741b131..b6efc7f6 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -89,7 +89,7 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma CommandNode * n_command; TermNode * n_term; SortedVarNode * n_sortedVar; - std::vector * n_sortedVarList; + std::vector> * n_sortedVarList; std::vector * n_termList; std::vector * n_attributeList; std::vector * n_commandList; @@ -173,7 +173,7 @@ command: '(' TK_SETLOGIC symbol ')' | '(' TK_DECLARECONST const_val sort ')' { $$ = new DeclareConst {std::unique_ptr($3), std::unique_ptr($4)}; } | '(' TK_DEFINEFUN symbol '(' sorted_var_list ')' sort term ')' - { $$ = new DefineFun {std::unique_ptr($3), std::unique_ptr>($5), std::unique_ptr($7), std::unique_ptr($8)}; } + { $$ = new DefineFun {std::unique_ptr($3), std::unique_ptr>>($5), std::unique_ptr($7), std::unique_ptr($8)}; } | '(' TK_PUSH TK_NUM ')' { $$ = new PushNode {std::stoi(*$3)}; delete $3; } | '(' TK_POP TK_NUM ')' @@ -316,9 +316,9 @@ var_binding: '(' symbol term ')' ; sorted_var_list: - { $$ = new std::vector(); } + { $$ = new std::vector>(); } | sorted_var_list sorted_var - { $1->emplace_back(std::move(*$2)); $$ = $1; } + { $1->emplace_back(std::unique_ptr($2)); $$ = $1; } ; sorted_var: '(' symbol sort ')' @@ -343,9 +343,9 @@ term: spec_const | '(' TK_LET '(' var_binding_list ')' term ')' { $$ = new LetTermNode {$6, std::unique_ptr>>($4)}; } | '(' TK_FORALL '(' sorted_var_list ')' term ')' // todo: AST traversal must ensure that sorted_var_list is non-empty - { $$ = new ForallNode {$6, std::unique_ptr>($4)}; } + { $$ = new ForallNode {$6, std::unique_ptr>>($4)}; } | '(' TK_EXISTS '(' sorted_var_list ')' term ')' // todo: AST traversal must ensure that sorted_var_list is non-empty - { $$ = new ExistsNode {$6, std::unique_ptr>($4)}; } + { $$ = new ExistsNode {$6, std::unique_ptr>>($4)}; } | '(' '!' term attribute_list ')' // todo: AST traversal must ensure that attribute_list is non-empty { $$ = new AnnotationNode {$3, std::unique_ptr>($4)}; } ; From 1e61c652b08d5032b6a03fb315f67ed444212296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Fri, 14 Oct 2022 13:44:59 +0200 Subject: [PATCH 52/94] Parser: fix delete/new mismatch --- src/parsers/smt2new/smt2newcontext.h | 31 +++++++++++++++------------- src/parsers/smt2new/smt2newparser.yy | 24 ++++++++++----------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index b7751be7..0b7d59bb 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -101,20 +101,23 @@ struct IdentifierNode : public GeneralNode { }; -class OptionNode : public GeneralNode { }; - -struct PrintSuccess : public OptionNode { bool value; }; -struct ExpandDefinitions : public OptionNode { bool value; }; -struct InteractiveMode : public OptionNode { bool value; }; -struct ProduceProofs : public OptionNode { bool value; }; -struct ProduceUnsatCores : public OptionNode { bool value; }; -struct ProduceModels : public OptionNode { bool value; }; -struct ProduceAssignments : public OptionNode { bool value; }; -struct RegularOutputChannel : public OptionNode { std::string value; }; -struct DiagnosticOutputChannel : public OptionNode { std::string value; }; -struct RandomSeed : public OptionNode { int value; }; -struct Verbosity : public OptionNode { int value; }; -struct Attribute : public OptionNode { AttributeNode value; }; +class OptionNode : public GeneralNode { +public: + virtual ~OptionNode() = default; +}; + +struct PrintSuccess : public OptionNode { bool value; PrintSuccess(bool value) : value(value) {} }; +struct ExpandDefinitions : public OptionNode { bool value; ExpandDefinitions(bool value) : value(value) {} }; +struct InteractiveMode : public OptionNode { bool value; InteractiveMode(bool value) : value(value) {} }; +struct ProduceProofs : public OptionNode { bool value; ProduceProofs(bool value) : value(value) {} }; +struct ProduceUnsatCores : public OptionNode { bool value; ProduceUnsatCores(bool value) : value(value) {} }; +struct ProduceModels : public OptionNode { bool value; ProduceModels(bool value) : value(value) {} }; +struct ProduceAssignments : public OptionNode { bool value; ProduceAssignments(bool value): value(value) {} }; +struct RegularOutputChannel : public OptionNode { std::string value; RegularOutputChannel(std::string value) : value(value) {} }; +struct DiagnosticOutputChannel : public OptionNode { std::string value; DiagnosticOutputChannel(std::string value) : value(value) {} }; +struct RandomSeed : public OptionNode { int value; RandomSeed(int value) : value(value) {} }; +struct Verbosity : public OptionNode { int value; Verbosity(int value) : value(value) {} }; +struct Attribute : public OptionNode { AttributeNode value; Attribute(AttributeNode && value) : value(std::move(value)) {} }; // Note: classes derived from CommandNodes need to have a constructor because they need to be destructible as CommandNodes. // In particular, CommandNode needs to have a virtual member function (destructor), which forbids aggregate initialization. diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index b6efc7f6..72b901c6 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -380,29 +380,29 @@ b_value: symbol ; option: KW_PRINTSUCCESS b_value - { $$ = new PrintSuccess {{}, $2}; (void)$1; } + { $$ = new PrintSuccess {$2}; (void)$1; } | KW_EXPANDDEFINITIONS b_value - { $$ = new ExpandDefinitions {{}, $2}; (void)$1; } + { $$ = new ExpandDefinitions {$2}; (void)$1; } | KW_INTERACTIVEMODE b_value - { $$ = new InteractiveMode {{}, $2}; (void)$1; } + { $$ = new InteractiveMode {$2}; (void)$1; } | KW_PRODUCEPROOFS b_value - { $$ = new ProduceProofs {{}, $2}; (void)$1; } + { $$ = new ProduceProofs {$2}; (void)$1; } | KW_PRODUCEUNSATCORES b_value - { $$ = new ProduceUnsatCores {{}, $2}; (void)$1; } + { $$ = new ProduceUnsatCores {$2}; (void)$1; } | KW_PRODUCEMODELS b_value - { $$ = new ProduceModels {{}, $2}; (void)$1; } + { $$ = new ProduceModels {$2}; (void)$1; } | KW_PRODUCEASSIGNMENTS b_value - { $$ = new ProduceAssignments {{}, $2}; (void)$1;} + { $$ = new ProduceAssignments {$2}; (void)$1;} | KW_REGULAROUTPUTCHANNEL TK_STR - { $$ = new RegularOutputChannel {{}, std::move(*$2)}; (void)$1; } + { $$ = new RegularOutputChannel {std::move(*$2)}; (void)$1; delete $2; } | KW_DIAGNOSTICOUTPUTCHANNEL TK_STR - { $$ = new DiagnosticOutputChannel {{}, std::move(*$2)}; (void)$1; } + { $$ = new DiagnosticOutputChannel {std::move(*$2)}; (void)$1; delete $2; } | KW_RANDOMSEED TK_NUM - { $$ = new RandomSeed {{}, std::stoi(*$2) }; free $2; (void)$1; } + { $$ = new RandomSeed { std::stoi(*$2) }; delete $2; (void)$1; } | KW_VERBOSITY TK_NUM - { $$ = new Verbosity {{}, std::stoi(*$2) }; free $2; (void)$1; } + { $$ = new Verbosity { std::stoi(*$2) }; delete $2; (void)$1; } | attribute - { $$ = new Attribute {{}, std::move(*$1) }; } + { $$ = new Attribute { std::move(*$1) }; delete $1; } ; predef_key: KW_SORTS From 9804f379064fafd012c47978637bb06e317bcca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Fri, 14 Oct 2022 13:50:07 +0200 Subject: [PATCH 53/94] Parser: Fix memory leak on AttributeNode --- src/parsers/smt2new/smt2newcontext.h | 2 +- src/parsers/smt2new/smt2newparser.yy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 0b7d59bb..558b6d43 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -117,7 +117,7 @@ struct RegularOutputChannel : public OptionNode { std::string value; RegularOutp struct DiagnosticOutputChannel : public OptionNode { std::string value; DiagnosticOutputChannel(std::string value) : value(value) {} }; struct RandomSeed : public OptionNode { int value; RandomSeed(int value) : value(value) {} }; struct Verbosity : public OptionNode { int value; Verbosity(int value) : value(value) {} }; -struct Attribute : public OptionNode { AttributeNode value; Attribute(AttributeNode && value) : value(std::move(value)) {} }; +struct Attribute : public OptionNode { std::unique_ptr value; Attribute(std::unique_ptr && value) : value(std::move(value)) {} }; // Note: classes derived from CommandNodes need to have a constructor because they need to be destructible as CommandNodes. // In particular, CommandNode needs to have a virtual member function (destructor), which forbids aggregate initialization. diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 72b901c6..3e8070a8 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -402,7 +402,7 @@ option: KW_PRINTSUCCESS b_value | KW_VERBOSITY TK_NUM { $$ = new Verbosity { std::stoi(*$2) }; delete $2; (void)$1; } | attribute - { $$ = new Attribute { std::move(*$1) }; delete $1; } + { $$ = new Attribute { std::unique_ptr($1) }; } ; predef_key: KW_SORTS From fea5c3942b90bf648fc79099ff2fef60f7b2756e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Fri, 14 Oct 2022 14:03:45 +0200 Subject: [PATCH 54/94] Parser: fix memory leak in AttributeNodes --- src/parsers/smt2new/smt2newcontext.h | 4 ++-- src/parsers/smt2new/smt2newparser.yy | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 558b6d43..282cd00a 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -289,8 +289,8 @@ struct ExistsNode : public TermNode { }; struct AnnotationNode : public TermNode { - std::unique_ptr> attributes; - AnnotationNode(TermNode * term, std::unique_ptr> && attributes) + std::unique_ptr>> attributes; + AnnotationNode(TermNode * term, std::unique_ptr>> && attributes) : TermNode{std::make_unique>(std::vector{term})} , attributes(std::move(attributes)) {} }; diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 3e8070a8..4e6de85d 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -91,7 +91,7 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma SortedVarNode * n_sortedVar; std::vector> * n_sortedVarList; std::vector * n_termList; - std::vector * n_attributeList; + std::vector> * n_attributeList; std::vector * n_commandList; std::vector> * n_symbolList; std::vector * sexpr_list; @@ -211,9 +211,9 @@ command: '(' TK_SETLOGIC symbol ')' ; attribute_list: - { $$ = new std::vector(); } + { $$ = new std::vector>(); } | attribute_list attribute - { $1->emplace_back(std::move(*$2)); $$ = $1; } + { $1->emplace_back(std::move($2)); $$ = $1; } ; attribute: TK_KEY @@ -347,7 +347,7 @@ term: spec_const | '(' TK_EXISTS '(' sorted_var_list ')' term ')' // todo: AST traversal must ensure that sorted_var_list is non-empty { $$ = new ExistsNode {$6, std::unique_ptr>>($4)}; } | '(' '!' term attribute_list ')' // todo: AST traversal must ensure that attribute_list is non-empty - { $$ = new AnnotationNode {$3, std::unique_ptr>($4)}; } + { $$ = new AnnotationNode {$3, std::unique_ptr>>($4)}; } ; symbol_list: From 8fa28242e31ad261954bfe690011b7fbe4d11734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Fri, 14 Oct 2022 14:43:09 +0200 Subject: [PATCH 55/94] SExprs: fix infinite recursion --- src/parsers/smt2new/smt2newcontext.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 282cd00a..edee32fd 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -69,7 +69,12 @@ struct SExpr : public GeneralNode { } assert(not children or processed == (*children)->size()); assert(node); - delete node; + if (children and *children) { + for (SExpr * child : (**children)) { + delete child; + } + (*children)->clear(); + } queue.pop_back(); } } @@ -80,13 +85,6 @@ struct AttributeValueNode : public GeneralNode { AttributeValueNode(std::unique_ptr && node) : value(std::move(node)) {} AttributeValueNode(std::unique_ptr && node) : value(std::move(node)) {} AttributeValueNode(std::unique_ptr> && node) : value(std::move(node)) {} - ~AttributeValueNode() { - if (auto vec = std::get_if>>(&value)) { - for (auto el : (**vec)) { - delete el; - } - } - } }; struct AttributeNode : public GeneralNode { From b287eb9e9e9418b62495e39aedf28508bf361b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Fri, 14 Oct 2022 16:23:43 +0200 Subject: [PATCH 56/94] SExprs: Fix destruction method --- src/parsers/smt2new/smt2newcontext.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index edee32fd..1d36cbc1 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -66,6 +66,7 @@ struct SExpr : public GeneralNode { if (children and processed < (*children)->size()) { ++processed; queue.emplace_back(Qel{(**children)[processed - 1], 0}); + continue; } assert(not children or processed == (*children)->size()); assert(node); @@ -85,6 +86,13 @@ struct AttributeValueNode : public GeneralNode { AttributeValueNode(std::unique_ptr && node) : value(std::move(node)) {} AttributeValueNode(std::unique_ptr && node) : value(std::move(node)) {} AttributeValueNode(std::unique_ptr> && node) : value(std::move(node)) {} + ~AttributeValueNode() { + if (auto vec = std::get_if>>(&value)) { + for (auto el : (**vec)) { + delete el; + } + } + } }; struct AttributeNode : public GeneralNode { From 5306db972526fb8835801bb99e1639c47aac029e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Sun, 16 Oct 2022 21:56:38 +0200 Subject: [PATCH 57/94] Parser: fix memory leaks in set-option --- src/parsers/smt2new/smt2newcontext.h | 4 ++-- src/parsers/smt2new/smt2newparser.yy | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 1d36cbc1..6e98e159 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -119,8 +119,8 @@ struct ProduceProofs : public OptionNode { bool value; ProduceProofs(bool value) struct ProduceUnsatCores : public OptionNode { bool value; ProduceUnsatCores(bool value) : value(value) {} }; struct ProduceModels : public OptionNode { bool value; ProduceModels(bool value) : value(value) {} }; struct ProduceAssignments : public OptionNode { bool value; ProduceAssignments(bool value): value(value) {} }; -struct RegularOutputChannel : public OptionNode { std::string value; RegularOutputChannel(std::string value) : value(value) {} }; -struct DiagnosticOutputChannel : public OptionNode { std::string value; DiagnosticOutputChannel(std::string value) : value(value) {} }; +struct RegularOutputChannel : public OptionNode { std::unique_ptr value; RegularOutputChannel(std::unique_ptr && value) : value(std::move(value)) {} }; +struct DiagnosticOutputChannel : public OptionNode { std::unique_ptr value; DiagnosticOutputChannel(std::unique_ptr && value) : value(std::move(value)) {} }; struct RandomSeed : public OptionNode { int value; RandomSeed(int value) : value(value) {} }; struct Verbosity : public OptionNode { int value; Verbosity(int value) : value(value) {} }; struct Attribute : public OptionNode { std::unique_ptr value; Attribute(std::unique_ptr && value) : value(std::move(value)) {} }; diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 4e6de85d..c8882620 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -380,27 +380,27 @@ b_value: symbol ; option: KW_PRINTSUCCESS b_value - { $$ = new PrintSuccess {$2}; (void)$1; } + { $$ = new PrintSuccess {$2}; delete $1; } | KW_EXPANDDEFINITIONS b_value - { $$ = new ExpandDefinitions {$2}; (void)$1; } + { $$ = new ExpandDefinitions {$2}; delete $1; } | KW_INTERACTIVEMODE b_value - { $$ = new InteractiveMode {$2}; (void)$1; } + { $$ = new InteractiveMode {$2}; delete $1; } | KW_PRODUCEPROOFS b_value - { $$ = new ProduceProofs {$2}; (void)$1; } + { $$ = new ProduceProofs {$2}; delete $1; } | KW_PRODUCEUNSATCORES b_value - { $$ = new ProduceUnsatCores {$2}; (void)$1; } + { $$ = new ProduceUnsatCores {$2}; delete $1; } | KW_PRODUCEMODELS b_value - { $$ = new ProduceModels {$2}; (void)$1; } + { $$ = new ProduceModels {$2}; delete $1; } | KW_PRODUCEASSIGNMENTS b_value - { $$ = new ProduceAssignments {$2}; (void)$1;} + { $$ = new ProduceAssignments {$2}; delete $1;} | KW_REGULAROUTPUTCHANNEL TK_STR - { $$ = new RegularOutputChannel {std::move(*$2)}; (void)$1; delete $2; } + { $$ = new RegularOutputChannel {std::unique_ptr($2)}; delete $1; } | KW_DIAGNOSTICOUTPUTCHANNEL TK_STR - { $$ = new DiagnosticOutputChannel {std::move(*$2)}; (void)$1; delete $2; } + { $$ = new DiagnosticOutputChannel {std::unique_ptr($2)}; delete $1; } | KW_RANDOMSEED TK_NUM - { $$ = new RandomSeed { std::stoi(*$2) }; delete $2; (void)$1; } + { $$ = new RandomSeed { std::stoi(*$2) }; delete $2; delete $1; } | KW_VERBOSITY TK_NUM - { $$ = new Verbosity { std::stoi(*$2) }; delete $2; (void)$1; } + { $$ = new Verbosity { std::stoi(*$2) }; delete $2; delete $1; } | attribute { $$ = new Attribute { std::unique_ptr($1) }; } ; From aa27878368a3a5b946a0a1947eb9a0ad2515b173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Sun, 16 Oct 2022 22:11:19 +0200 Subject: [PATCH 58/94] parser: Fix memory leak in numeral_list --- src/parsers/smt2new/smt2newcontext.h | 2 +- src/parsers/smt2new/smt2newparser.yy | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 6e98e159..4459ce6c 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -103,7 +103,7 @@ struct AttributeNode : public GeneralNode { struct IdentifierNode : public GeneralNode { std::unique_ptr symbol; - std::unique_ptr> numeralList; + std::unique_ptr>> numeralList; }; diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index c8882620..6c6dd2b7 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -80,7 +80,7 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma VarBindingNode * n_varBinding; std::vector> * n_varBindingList; std::vector * n_sortList; - std::vector * n_numeralList; + std::vector> * n_numeralList; AttributeNode * n_attribute; AttributeValueNode * n_attributeValue; SpecConstNode * n_specConst; @@ -237,7 +237,7 @@ attribute_value: spec_const identifier: symbol { $$ = new IdentifierNode {{}, std::unique_ptr($1), {}}; } | '(' '_' symbol numeral_list ')' - { $$ = new IdentifierNode {{}, std::unique_ptr($3), std::unique_ptr>($4)}; } + { $$ = new IdentifierNode {{}, std::unique_ptr($3), std::unique_ptr>>($4)}; } ; sort: identifier @@ -294,9 +294,9 @@ const_val: symbol ; numeral_list: numeral_list TK_NUM - { $1->emplace_back(std::move(*$2)); } + { $1->emplace_back(std::unique_ptr($2)); } | TK_NUM - { $$ = new std::vector{std::string(std::move(*$1))}; } + { $$ = new std::vector>(); $$->emplace_back(std::unique_ptr{$1}); } ; qual_identifier: identifier From 7ac34b204fc55cde9c1d2ca244941fca1d226988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 17 Oct 2022 07:31:41 +0200 Subject: [PATCH 59/94] Parser: error destructor for CommandList --- src/parsers/smt2new/smt2newparser.yy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 6c6dd2b7..e1e37668 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -104,6 +104,8 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma } %destructor { delete $$; } +%destructor { delete $$; } +%destructor { for (CommandNode * n : *$$ ) { delete n; }; delete $$; } %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %token TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO From 7625e28286578d68f6d03cf63dc9687858502fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 17 Oct 2022 07:36:42 +0200 Subject: [PATCH 60/94] Parser: error destructor for TermNode --- src/parsers/smt2new/smt2newparser.yy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index e1e37668..ff0263f8 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -106,6 +106,7 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma %destructor { delete $$; } %destructor { delete $$; } %destructor { for (CommandNode * n : *$$ ) { delete n; }; delete $$; } +%destructor { for (TermNode * n : *$$) { delete n; }; delete $$; } %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %token TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO From ec5c67210ece6ffacd2bbecd5bdf48276b3324c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 17 Oct 2022 07:40:20 +0200 Subject: [PATCH 61/94] Parser: error destructor for QualIdentifier --- src/parsers/smt2new/smt2newparser.yy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index ff0263f8..22c20452 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -107,6 +107,8 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma %destructor { delete $$; } %destructor { for (CommandNode * n : *$$ ) { delete n; }; delete $$; } %destructor { for (TermNode * n : *$$) { delete n; }; delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %token TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO From 32526d594a613537718323b62b31a7e66a8f733d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 17 Oct 2022 07:58:58 +0200 Subject: [PATCH 62/94] Parser: error destructor for n_numeralList --- src/parsers/smt2new/smt2newparser.yy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 22c20452..4462f89b 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -109,6 +109,7 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma %destructor { for (TermNode * n : *$$) { delete n; }; delete $$; } %destructor { delete $$; } %destructor { delete $$; } +%destructor { delete $$; } %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %token TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO From dc532f61a3c4775f095e9fe90b7e930fe976f550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 17 Oct 2022 11:29:06 +0200 Subject: [PATCH 63/94] Parser: remove unused tokens --- src/parsers/smt2new/smt2newparser.yy | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 4462f89b..73cd2f56 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -98,8 +98,6 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma std::string * str; bool n_bool; OptionNode * n_option; - ASTNode * snode; - std::vector> * snode_list; osmttokens::smt2token tok; } From 2ae66090f86bcc6468aeff98a1bd7909d99d22c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 17 Oct 2022 11:29:34 +0200 Subject: [PATCH 64/94] Parser: add missing error destructors and sort --- src/parsers/smt2new/smt2newparser.yy | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 73cd2f56..7c0fe9ad 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -101,13 +101,29 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma osmttokens::smt2token tok; } -%destructor { delete $$; } -%destructor { delete $$; } -%destructor { for (CommandNode * n : *$$ ) { delete n; }; delete $$; } -%destructor { for (TermNode * n : *$$) { delete n; }; delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { for (CommandNode * n : *$$) { delete n; }; delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } %destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { for (SortNode * n : *$$) { delete n; }; delete $$; } +%destructor { delete $$; } %destructor { delete $$; } -%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { for (TermNode * n : *$$) { delete n; }; delete $$; } +%destructor { delete $$->term; delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { for (SExpr * n : *$$) { delete n; }; delete $$; } +%destructor { delete $$; } %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %token TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO From 2d6f827df31d1239acba67676d388e60a128436b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 17 Oct 2022 18:25:59 +0200 Subject: [PATCH 65/94] Interpret: fix memory leak on parse errors --- src/api/Interpret.cc | 13 ++++++------- src/parsers/smt2new/smt2newcontext.h | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index a47bee9d..29ddcfae 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -998,14 +998,13 @@ void Interpret::execute(ASTNode const & r) { int Interpret::interpFile(FILE* in) { Smt2newContext context(in); int rval = yyparse(&context); - - if (rval != 0) return rval; - - for (auto command : context.getRoot()) { -// execute(command); - delete command; + if (context.hasRoot()) { + for (auto command : context.getRoot()) { + // if (rval == 0) { execute(command); } + delete command; + } } - return 0; + return rval; } int Interpret::interpFile(char *content){ diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 4459ce6c..ab6c01c8 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -330,6 +330,7 @@ struct PopNode : public CommandNode { struct AssertNode : public CommandNode { std::unique_ptr term; AssertNode(std::unique_ptr && term) : term(std::move(term)) {} + ~AssertNode() override = default; }; struct GetInterpolants : public CommandNode { @@ -374,6 +375,7 @@ class Smt2newContext { FILE* is; char* ib; bool interactive; + bool hasRoot() const { return root != nullptr; } inline std::vector const & getRoot() { return *root; }; Smt2newContext(FILE* in) : From 554781f0fef52b21ae505e51ec6838a3588c1da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 24 Oct 2022 15:11:51 +0200 Subject: [PATCH 66/94] Interpret: refactor SetInfo [WiP] --- src/api/Interpret.cc | 130 ++++++++++++--------- src/api/Interpret.h | 26 ++++- src/options/SMTConfig.cc | 26 ++--- src/options/SMTConfig.h | 166 +++++++++++++++------------ src/parsers/smt2new/smt2newcontext.h | 29 ++++- 5 files changed, 228 insertions(+), 149 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index 29ddcfae..51b4b50d 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -46,19 +46,8 @@ Interpret::getParsedFormula() return root; } -void Interpret::setInfo(ASTNode const & n) { - assert(n.getType() == ASTType::UATTR_T || n.getType() == ASTType::PATTR_T); - - std::string name; - if (not n.hasValue()) { - ASTNode const & an = *(*n.children)[0]; - assert(an.getType() == ASTType::UATTR_T || an.getType() == ASTType::PATTR_T); - name = an.getValue(); - } - else // Normal option - name = n.getValue(); +void Interpret::setInfo(std::string const & name) { - config.setInfo(std::move(name), Info(n)); } void Interpret::getInfo(ASTNode const & n) { @@ -112,29 +101,81 @@ using opensmt::Logic_t; using opensmt::getLogicFromString; using namespace osmttokens; -void Interpret::interp(ASTNode const & n) { +void Interpret::interp(CommandNode const * n) { + if (auto setLogic = dynamic_cast(n)) { + return interp(*setLogic); + } else if (auto setInfo = dynamic_cast(n)) { + return interp(*setInfo); + } else if (auto setOption = dynamic_cast(n)) { + return interp(*setOption); + } else if (auto getInfo = dynamic_cast(n)) { + return interp(*getInfo); + } else if (auto getOption = dynamic_cast(n)) { + return interp(*getOption); + } else if (auto declareSort = dynamic_cast(n)) { + return interp(*declareSort); + } else if (auto declareFun = dynamic_cast(n)) { + return interp(*declareFun); + } else if (auto declareConst = dynamic_cast(n)) { + return interp(*declareConst); + } else if (auto assertNode = dynamic_cast(n)) { + return interp(*assertNode); + } else if (auto defineFun = dynamic_cast(n)) { + return interp(*defineFun); + } else if (auto simplify = dynamic_cast(n)) { + return interp(*simplify); + } else if (auto checkSatNode = dynamic_cast(n)) { + return interp(*checkSatNode); + } else if (auto getInterpolants = dynamic_cast(n)) { + return interp(*getInterpolants); + } else if (auto getAssignment = dynamic_cast(n)) { + return interp(*getAssignment); + } else if (auto getValue = dynamic_cast(n)) { + return interp(*getValue); + } else if (auto getModel = dynamic_cast(n)) { + return interp(*getModel); + } else if (auto echo = dynamic_cast(n)) { + return interp(*echo); + } else if (auto pushNode = dynamic_cast(n)) { + return interp(*pushNode); + } else if (auto popNode = dynamic_cast(n)) { + return interp(*popNode); + } else if (auto exit = dynamic_cast(n)) { + return interp(*exit); + } else { + notify_formatted(true, "Unimplemented command"); + } +} + +void Interpret::interp(SetLogic const & n) { + std::string const & logic_name = n.getLogicName(); + if (isInitialized()) { + notify_formatted(true, "logic has already been set to %s", main_solver->getLogic().getName().data()); + } else { + auto logic_type = getLogicFromString(logic_name); + if (logic_type == Logic_t::UNDEF) { + notify_formatted(true, "unknown logic %s", logic_name.c_str()); + return; + } + initializeLogic(logic_type); + main_solver = createMainSolver(logic_name); + main_solver->initialize(); + notify_success(); + } +} + +void Interpret::interp(SetInfo const & n) { + std::string name = n.getName(); + config.setInfo(n.getName(), ConfValue(n.getValue())); + notify_success(); +} + + /* +void Interpret::interp(CommandNode const & n) { assert(n.getType() == ASTType::CMD_T); const smt2token cmd = n.getToken(); try { - switch (cmd.x) { - case t_setlogic: { - ASTNode const & logic_n = *(*n.children)[0]; - std::string const & logic_name = logic_n.getValue(); - if (isInitialized()) { - notify_formatted(true, "logic has already been set to %s", main_solver->getLogic().getName().data()); - } else { - auto logic_type = getLogicFromString(logic_name); - if (logic_type == Logic_t::UNDEF) { - notify_formatted(true, "unknown logic %s", logic_name.c_str()); - break; - } - initializeLogic(logic_type); - main_solver = createMainSolver(logic_name); - main_solver->initialize(); - notify_success(); - } - break; - } + case t_setinfo: setInfo(*(*n.children)[0]); notify_success(); @@ -286,20 +327,7 @@ void Interpret::interp(ASTNode const & n) { break; } - case t_writestate: { - if (not isInitialized()) { - notify_formatted(true, "Illegal command before set-logic: write-state"); - } else { - if (main_solver->solverEmpty()) { - sstat status = main_solver->simplifyFormulas(); - if (status == s_Error) - notify_formatted(true, "write-state"); - } else { - writeState((*n.children)[0]->getValue()); - } - } - break; - } + case t_echo: { std::string const & str = (*n.children)[0]->getValue(); notify_formatted(false, "%s", str.c_str()); @@ -344,6 +372,7 @@ void Interpret::interp(ASTNode const & n) { notify_formatted(true, e.what()); } } +*/ bool Interpret::addLetFrame(std::vector> const & bindings, LetRecords& letRecords) { for (auto const & [arg, name] : bindings) { @@ -988,19 +1017,12 @@ void Interpret::notify_success() { } } -void Interpret::execute(ASTNode const & r) { - for (auto const & command : *r.children) { - if (f_exit) break; - interp(*command); - } -} - int Interpret::interpFile(FILE* in) { Smt2newContext context(in); int rval = yyparse(&context); if (context.hasRoot()) { for (auto command : context.getRoot()) { - // if (rval == 0) { execute(command); } + if (rval == 0 and not f_exit) { interp(command); } delete command; } } diff --git a/src/api/Interpret.h b/src/api/Interpret.h index 173be522..3ac72ec3 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -149,7 +149,7 @@ class Interpret { SRef sortFromASTNode(ASTNode const & n) const; static SortSymbol sortSymbolFromASTNode(ASTNode const & node); - void setInfo(ASTNode const & n); + void setInfo(std::string const & str); void getInfo(ASTNode const & n); void setOption(ASTNode const & n); void getOption(ASTNode const & n); @@ -171,8 +171,27 @@ class Interpret { virtual void exit(); void getInterpolants(const ASTNode& n); - void interp (ASTNode const & n); - + void interp(CommandNode const * n); + void interp(SetLogic const & n); + void interp(SetInfo const & n); + void interp(SetOption const & n); + void interp(GetInfo const & n); + void interp(GetOption const & n); + void interp(DeclareSort const & n); + void interp(DeclareFun const & n); + void interp(DeclareConst const & n); + void interp(AssertNode const & n); + void interp(DefineFun const & n); + void interp(Simplify const & n); + void interp(CheckSatNode const & n); + void interp(GetInterpolants const & n); + void interp(GetAssignment const & n); + void interp(GetValue const & n); + void interp(GetModel const & n); + void interp(Echo const & n); + void interp(PushNode const & n); + void interp(PopNode const & n); + void interp(Exit const & n); void notify_formatted(bool error, const char* s, ...); void notify_success(); void comment_formatted(const char* s, ...) const; @@ -194,7 +213,6 @@ class Interpret { int interpFile(char *content); int interpPipe(); - void execute(ASTNode const & n); bool gotExit() const { return f_exit; } ValPair getValue (PTRef tr) const; diff --git a/src/options/SMTConfig.cc b/src/options/SMTConfig.cc index 8bfabfa1..fd73d0b2 100644 --- a/src/options/SMTConfig.cc +++ b/src/options/SMTConfig.cc @@ -178,23 +178,17 @@ std::string ConfValue::toString() const { * Class defining the information, configured with set-info ***********************************************************/ -Info::Info(ASTNode const & n) { - assert(n.getType() == ASTType::UATTR_T or n.getType() == ASTType::PATTR_T); - if (not n.children or n.children->empty()) { - value.type = O_EMPTY; - return; +Info::Info(AttributeValueNode const & n) { + // child is attribute_value + if (auto specConst = std::get_if>(&n.value)) { + value = ConfValue(**specConst); + } else if (auto symbolNode = std::get_if>(&n.value)) { + value.strval = (**symbolNode).getString(); + value.type = (**symbolNode).getType(); + } else if (auto sexprList = std::get_if>>(&n.value)) { + value = ConfValue(**sexprList); } else { - // child is attribute_value - ASTNode const & child = *(*n.children)[0]; - - if (child.getType() == ASTType::SPECC_T or child.getType() == ASTType::SEXPRL_T) { - value = ConfValue(child); - } - else if (child.getType() == ASTType::SYM_T or child.getType() == ASTType::QSYM_T) { - value.strval = child.getValue(); - value.type = O_STR; - } - else assert(false); + assert(false); } } diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index 1bd28c8f..b8d34687 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -29,15 +29,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "SolverTypes.h" #include "StringMap.h" +#include "smt2newcontext.h" #include "smt2tokens.h" #include -#include +#include #include +#include #include -#include -#include #include +#include +#include enum class ASTType { CMD_T , CMDL_T @@ -81,79 +83,99 @@ enum class ASTType { , UNDEF_T }; -class ASTNode { - using ASTNode_up = std::unique_ptr; - using ASTVec = std::vector; - using ASTVec_up = std::unique_ptr; - using string_up = std::unique_ptr; - - private: - ASTType type = ASTType::UNDEF_T; - osmttokens::smt2token tok = {osmttokens::t_none}; - std::unique_ptr val; - public: - ASTVec_up children = nullptr; - - ASTNode(ASTType t, osmttokens::smt2token tok = {osmttokens::t_none}, string_up v = nullptr, ASTVec_up children = nullptr) - : type(t), tok(tok), val(std::move(v)), children(std::move(children)) {} -// ASTNode(ASTNode const &) = default; -// ASTNode(ASTNode &&) = default; -// ASTNode & operator=(ASTNode const &) = delete; -// ASTNode & operator=(ASTNode &&) = default; - - void print(std::ostream& o, int indent) const; - ASTType getType() const { return type; } - bool hasValue() const { return val != nullptr; } - std::string const & getValue() const { assert(hasValue()); return *val; } - osmttokens::smt2token getToken() const { return tok; } -}; - - -enum ConfType { O_EMPTY, O_STR, O_SYM, O_NUM, O_DEC, O_HEX, O_BIN, O_LIST, O_ATTR, O_BOOL }; - -class ConfValue { - public: - ConfType type = O_EMPTY; - std::string strval = ""; - int numval = 0; - double decval = 0; - uint32_t unumval = 0; - std::list configs; - ConfValue() = default; - ConfValue(const ASTNode& s_expr_n); - ConfValue(int i) : type(O_NUM), numval(i) {}; - ConfValue(double i) : type(O_DEC), decval(i) {}; - ConfValue(std::string && s) : strval(s) {} -// ConfValue(const ConfValue& other); -// ConfValue& operator=(const ConfValue& other); - std::string toString() const; - double getDoubleVal() const {if (type == O_NUM) return (double)numval; else if (type == O_DEC) return decval; else assert(false); return -1;} -}; - -class Info { - private: - ConfValue value; - public: - Info(ASTNode const & n); - Info() = default; -// Info(Info const & other); -// Info() {}; - bool isEmpty() const { return value.type == O_EMPTY; } - inline std::string toString() const { return value.toString(); } -}; class SMTOption { - private: - ConfValue value; - public: - SMTOption(ASTNode const & n); - SMTOption() {} + std::string sexprToString(SExpr * root) { + struct QEl { SExpr * sexpr; int count; }; + std::vector childStrings; + std::vector stack; + stack.push_back({root, 0}); + while (not stack.empty()) { + auto & [sexpr, count] = stack.back(); + if (auto vec_p = std::get_if>>(&(*sexpr).data)) { + assert(*vec_p); + auto & vec = **vec_p; + if (vec.size() < count) { + stack.push_back({ vec[count], 0 }); + ++count; + continue; + } + // Vector, all children processed + assert(not childStrings.empty()); + auto childStringStart = childStrings.end() - vec.size(); + auto myString = std::accumulate(childStringStart, childStrings.end(), std::string(), + [](const std::string & a, const std::string & b) { + return a + b; + }); + childStrings.erase(childStringStart, childStrings.end()); + childStrings.emplace_back(std::move(myString)); + } else if (auto constNode = std::get_if>(&(*sexpr).data)) { + assert(*constNode); + childStrings.push_back(*(**constNode).value); + } else if (auto symbolNode = std::get_if>(&(*sexpr).data)) { + assert(*symbolNode); + childStrings.push_back((**symbolNode).getString()); + } else if (auto string = std::get_if>(&(*sexpr).data)) { + assert(*string); + childStrings.push_back(**string); + } + stack.pop_back(); + } + assert(childStrings.size() == 1); + return childStrings[0]; + } +public: + struct ConfValue { + ConstType type = ConstType::empty; + std::variant value; + std::string toString() const; + double getDoubleVal() const { + if (type == ConstType::numeral) { + if (auto val = std::get_if(&value)) { + return static_cast(*val); + } else if (auto val = std::get_if(&value)) { + return static_cast(*val); + } + assert(false); + } else if (type == ConstType::decimal) { + auto val = std::get_if(&value); + assert(val); + return *val; + } else { + throw OsmtApiException("Attempted to obtain double value for non-numeric type"); + } + } + }; + + SMTOption(); + SMTOption(AttributeValueNode const & n) { + if (auto specConst_p = std::get_if>(&n.value)) { + auto const & specConst = (**specConst_p); + value.type = specConst.type; + value.value = *specConst.value; + } else if (auto symbol_p = std::get_if>(&n.value)) { + auto const & symbol = (**symbol_p); + value.type = symbol.getType(); + value.value = symbol.getString(); + } else if (auto sexprVec_p = std::get_if>>(&n.value)) { + assert(sexprVec_p); + value.type = ConstType::sexpr; + auto const & sexprVec = **sexprVec_p; + std::string s; + for (SExpr * sexpr_p : sexprVec) { + s += "(" + sexprToString(sexpr_p)+ ")"; + } + value.value = s; + } + } SMTOption(int i) : value(i) {} SMTOption(double i): value(i) {} SMTOption(std::string && s) : value(std::move(s)) {} inline bool isEmpty() const { return value.type == O_EMPTY; } inline std::string toString() const { return value.toString(); } inline const ConfValue& getValue() const { return value; } + private: + ConfValue value; }; // Type safe wrapper for split types @@ -317,11 +339,9 @@ struct SMTConfig static const char* s_err_unknown_split; static const char* s_err_unknown_units; - - Info info_Empty; SMTOption option_Empty; std::vector option_names; - std::unordered_map infoTable; + std::unordered_map infoTable; std::unordered_map optionTable; bool usedForInitialization = false; // Some options can be changed only before this config is used for initialization of MainSolver @@ -362,8 +382,8 @@ struct SMTConfig bool setOption(std::string const & name, const SMTOption& value, const char*& msg); const SMTOption& getOption(std::string const & name) const; - bool setInfo (std::string && name, Info && value); - Info getInfo (std::string const & name) const; + bool setInfo (std::string && name, ConfValue && value); + ConfValue getInfo (std::string const & name) const; void initializeConfig ( ); diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index ab6c01c8..0335a24e 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -29,14 +29,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "SMTConfig.h" +#include +#include +#include enum class ConstType { numeral, decimal, hexadecimal, binary, - string + string, + empty, + symbol, + boolean, + sexpr }; class GeneralNode {}; @@ -48,6 +54,23 @@ struct SpecConstNode : public GeneralNode { struct SymbolNode : public GeneralNode { std::variant,std::unique_ptr> name; + std::string getString() const { + if (auto str = std::get_if>(&name)) { + return {**str}; + } else if (auto specConstNode = std::get_if>(&name)) { + return {*(**specConstNode).value}; + } + assert(false); + } + ConstType getType() const { + if (std::get_if>(&name)) { + return ConstType::string; + } else { + auto specConstNode = std::get_if>(&name); + assert(specConstNode); + return (**specConstNode).type; + } + } bool quoted; }; @@ -154,6 +177,8 @@ struct SetOption : public CommandNode { struct SetInfo : public CommandNode { std::unique_ptr attribute; SetInfo(std::unique_ptr && attribute) : attribute(std::move(attribute)) {} + std::string getName() const { return {*attribute->name}; } + AttributeValueNode & getValue() const { return *attribute->value; } }; struct DeclareSort : public CommandNode { From d6660e5ff38fb47edb521471c17abaabb859e590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 24 Oct 2022 15:12:30 +0200 Subject: [PATCH 67/94] Parser: SetLogic convenience function [WiP?] --- src/parsers/smt2new/smt2newcontext.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 0335a24e..ee43be4d 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -167,6 +167,11 @@ struct Exit : public CommandNode { }; struct SetLogic : public CommandNode { std::unique_ptr logic; SetLogic(std::unique_ptr && logic) : logic(std::move(logic)) {} + std::string getLogicName() const { + auto s = std::get_if>(&logic->name); + assert(s); + return {**s}; + } }; struct SetOption : public CommandNode { From 58630c9c6487398bd8231e8791d72d9baaba930f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 24 Oct 2022 17:02:09 +0200 Subject: [PATCH 68/94] Options: make sexpr printing function static --- src/options/SMTConfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index b8d34687..b1425247 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -85,7 +85,7 @@ enum class ASTType { class SMTOption { - std::string sexprToString(SExpr * root) { + static std::string sexprToString(SExpr * root) { struct QEl { SExpr * sexpr; int count; }; std::vector childStrings; std::vector stack; From 1da5ff1ab83e52456e5f2579ff2829500db722b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 24 Oct 2022 17:02:37 +0200 Subject: [PATCH 69/94] Interpret: refactor SMTOption [WiP] --- src/options/SMTConfig.h | 47 +++++++++++++++++++--------- src/parsers/smt2new/smt2newcontext.h | 1 + 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index b1425247..ab2586df 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -127,8 +127,12 @@ class SMTOption { public: struct ConfValue { ConstType type = ConstType::empty; - std::variant value; - std::string toString() const; + std::variant value = 0; + ConfValue() = default; + ConfValue(int i) : type(ConstType::numeral), value(i) {} + ConfValue(double i) : type(ConstType::decimal), value(i) {} + ConfValue(std::string && s) : type(ConstType::string), value(std::move(s)) {} + std::string getStringValue() const; double getDoubleVal() const { if (type == ConstType::numeral) { if (auto val = std::get_if(&value)) { @@ -145,6 +149,21 @@ class SMTOption { throw OsmtApiException("Attempted to obtain double value for non-numeric type"); } } + uint32_t getUint32Value() const { + if (type == ConstType::uint32) { + auto val = std::get_if(&value); + assert(val); + return *val; + } else { + throw OsmtApiException("Attempted to obtain uint32 value for non-uint32 type"); + } + } + bool getBoolVal() const { + if (type == ConstType::boolean) { + auto val = std::get_if(&value); + + } + } }; SMTOption(); @@ -171,7 +190,7 @@ class SMTOption { SMTOption(int i) : value(i) {} SMTOption(double i): value(i) {} SMTOption(std::string && s) : value(std::move(s)) {} - inline bool isEmpty() const { return value.type == O_EMPTY; } + inline bool isEmpty() const { return value.type == ConstType::empty; } inline std::string toString() const { return value.toString(); } inline const ConfValue& getValue() const { return value; } private: @@ -341,7 +360,7 @@ struct SMTConfig SMTOption option_Empty; std::vector option_names; - std::unordered_map infoTable; + std::unordered_map infoTable; std::unordered_map optionTable; bool usedForInitialization = false; // Some options can be changed only before this config is used for initialization of MainSolver @@ -382,8 +401,8 @@ struct SMTConfig bool setOption(std::string const & name, const SMTOption& value, const char*& msg); const SMTOption& getOption(std::string const & name) const; - bool setInfo (std::string && name, ConfValue && value); - ConfValue getInfo (std::string const & name) const; + bool setInfo (std::string && name, SMTOption::ConfValue && value); + SMTOption::ConfValue getInfo (std::string const & name) const; void initializeConfig ( ); @@ -392,18 +411,18 @@ struct SMTConfig void printHelp ( ); void printConfig ( std::ostream & out ); - inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed).getValue().numval : 91648253; } + inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed).getValue().getUint32Value(): 91648253; } inline void setProduceModels( ) { insertOption(o_produce_models, SMTOption(1)); } inline bool setRandomSeed(int seed) { insertOption(o_random_seed, SMTOption(seed)); return true; } void setUsedForInitiliazation() { usedForInitialization = true; } inline bool produceProof( ) { - return optionTable.find(o_produce_proofs) != optionTable.end() ? optionTable[o_produce_proofs].getValue().numval > 0 : false; + return optionTable.find(o_produce_proofs) != optionTable.end() ? optionTable[o_produce_proofs].getValue().getBoolVal() : false; } void setTimeQueries() { insertOption(o_time_queries, SMTOption(1)); } - bool timeQueries() { return optionTable.find(o_time_queries) != optionTable.end() ? optionTable[o_time_queries].getValue().numval : false; } + bool timeQueries() { return optionTable.find(o_time_queries) != optionTable.end() ? optionTable[o_time_queries].getValue().getBoolVal() : false; } // Set reduction params inline void setReduction(int r) { insertOption(o_proof_reduce, SMTOption(r)); } @@ -425,27 +444,27 @@ struct SMTConfig // Get interpolation algorithms inline ItpAlgorithm getBooleanInterpolationAlgorithm() const { - return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg).getValue().numval) + return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg).getValue().getUint32Value()) : ItpAlgorithm::itp_alg_mcmillan; } inline ItpAlgorithm getEUFInterpolationAlgorithm() const { - return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg).getValue().numval) + return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg).getValue().getUint32Value()) : ItpAlgorithm::itp_euf_alg_strong; } inline ItpAlgorithm getLRAInterpolationAlgorithm() const { - return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg).getValue().numval) + return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg).getValue().getUint32Value()) : ItpAlgorithm::itp_lra_alg_strong; } inline std::string getLRAStrengthFactor() const { return optionTable.find(o_itp_lra_factor) != optionTable.end() ? optionTable.at( - o_itp_lra_factor).getValue().strval : itp_lra_factor_0; + o_itp_lra_factor).getValue().getStringValue() : itp_lra_factor_0; } inline std::string getInstanceName() const { - return optionTable.find(o_inst_name) != optionTable.end() ? optionTable.at(o_inst_name).getValue().strval : "unknown"; + return optionTable.find(o_inst_name) != optionTable.end() ? optionTable.at(o_inst_name).getValue().getStringValue() : "unknown"; } lbool status; // Status of the benchmark diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index ee43be4d..64c6749a 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -37,6 +37,7 @@ enum class ConstType { numeral, decimal, hexadecimal, + uint32, binary, string, empty, From 74b041af96ba7a0dda08cba86345e11ac16d4d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 24 Oct 2022 18:54:48 +0200 Subject: [PATCH 70/94] SMTOptions: some refactoring --- src/api/Interpret.h | 22 +- src/options/SMTConfig.cc | 278 ++------------- src/options/SMTConfig.h | 482 +++++++++++++++------------ src/parsers/smt2new/smt2newcontext.h | 1 + 4 files changed, 305 insertions(+), 478 deletions(-) diff --git a/src/api/Interpret.h b/src/api/Interpret.h index 3ac72ec3..c290cc8f 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -146,31 +146,29 @@ class Interpret { void initializeLogic(opensmt::Logic_t logicType); bool isInitialized() const { return logic != nullptr; } - SRef sortFromASTNode(ASTNode const & n) const; - static SortSymbol sortSymbolFromASTNode(ASTNode const & node); void setInfo(std::string const & str); - void getInfo(ASTNode const & n); - void setOption(ASTNode const & n); - void getOption(ASTNode const & n); + void getInfo(AttributeNode const & n); + void setOption(AttributeNode const & n); + void getOption(AttributeNode const & n); void writeState(std::string const & fname); - bool declareFun(ASTNode const & n); //(const char* fname, const vec& args); - bool declareConst(ASTNode const & n); //(const char* fname, const SRef ret_sort); - bool defineFun(ASTNode const & n); + bool declareFun(DeclareFun const & n); //(const char* fname, const vec& args); + bool declareConst(DeclareConst const & n); //(const char* fname, const SRef ret_sort); + bool defineFun(DefineFun const & n); virtual sstat checkSat(); - void getValue(std::vector> const & term); + void getValue(std::vector> const & term); void getModel(); std::string printDefinitionSmtlib(PTRef tr, PTRef val); std::string printDefinitionSmtlib(const TemplateFunction &templateFun) const; void push(int); void pop(int); - PTRef parseTerm(const ASTNode& term, LetRecords& letRecords); + PTRef parseTerm(TermNode const & term, LetRecords& letRecords); PTRef resolveTerm(const char* s, vec&& args, SRef sortRef = SRef_Undef, SymbolMatcher symbolMatcher = SymbolMatcher::Any); bool storeDefinedFun(std::string const & fname, const vec& args, SRef ret_sort, const PTRef tr); virtual void exit(); - void getInterpolants(const ASTNode& n); + void getInterpolants(TermNode const & n); void interp(CommandNode const * n); void interp(SetLogic const & n); void interp(SetInfo const & n); @@ -198,7 +196,7 @@ class Interpret { bool addLetFrame(std::vector> const & bindings, LetRecords& letRecords); PTRef letNameResolve(const char* s, const LetRecords& letRecords) const; - PTRef resolveQualifiedIdentifier(const char * name, ASTNode const & sort, bool isQuoted); + PTRef resolveQualifiedIdentifier(const char * name, SortNode const & sort, bool isQuoted); virtual std::unique_ptr createMainSolver(std::string const & logic_name); diff --git a/src/options/SMTConfig.cc b/src/options/SMTConfig.cc index fd73d0b2..ac772e39 100644 --- a/src/options/SMTConfig.cc +++ b/src/options/SMTConfig.cc @@ -30,232 +30,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -/********************************************************************* - * Generic configuration class, used for both set-info and set-option - *********************************************************************/ - -ConfValue::ConfValue(const ASTNode& s_expr_n) { - if (s_expr_n.getType() == ASTType::SEXPRL_T) { - type = O_LIST; - for (auto const & i : (*s_expr_n.children)) { - configs.push_back(ConfValue(*i)); - } - } else if (s_expr_n.getType() == ASTType::SYM_T) { - type = O_SYM; - strval = s_expr_n.getValue(); - } else if (s_expr_n.getType() == ASTType::SPECC_T) { - assert(s_expr_n.children->size() > 0); - ASTNode const & spn = *(*s_expr_n.children)[0]; - if (spn.getType() == ASTType::NUM_T) { - type = O_NUM; - numval = std::stoi(spn.getValue()); - } else if (spn.getType() == ASTType::DEC_T) { - type = O_DEC; - decval = std::stod(spn.getValue()); - } else if (spn.getType() == ASTType::HEX_T) { - type = O_HEX; - std::string tmp(spn.getValue()); - tmp.erase(0,2); - char* end; - unumval = strtoul(tmp.c_str(), &end, 16); - assert(end); - } - else if (spn.getType() == ASTType::BIN_T) { - type = O_BIN; - std::string tmp(spn.getValue()); - tmp.erase(0,2); - char* end; - unumval = strtoul(tmp.c_str(), &end, 2); - assert(end); - } - else if (spn.getType() == ASTType::STR_T) { - type = O_STR; - strval = spn.getValue(); - } - else { - assert(false); - } - } else if (s_expr_n.getType() == ASTType::UATTR_T) { - type = O_ATTR; - strval = s_expr_n.getValue(); - } - else { - assert(false); //Not implemented - } -} - -//ConfValue::ConfValue(const ConfValue& other) { -// type = other.type; -// if (type == O_NUM) numval = other.numval; -// else if (type == O_STR) strval = other.strval; -// else if (type == O_DEC) decval = other.decval; -// else if (type == O_LIST) { -// configs = new std::list; -// for (ConfValue * value : *other.configs) -// configs->push_back(new ConfValue(*value)); -// } -// else if (type == O_SYM) -// strval = other.strval; -// else if (type == O_HEX) -// unumval = other.unumval; -// else if (type == O_BIN) -// unumval = other.unumval; -// else if (type == O_ATTR) -// strval = other.strval; -// else if (type == O_BOOL) -// numval = other.numval; -// else if (type == O_EMPTY) -// strval = strdup(""); -// else assert(false); -//} - -//ConfValue& ConfValue::operator=(const ConfValue& other) -//{ -// type = other.type; -// if (type == O_NUM) numval = other.numval; -// else if (type == O_STR) strval = other.strval; -// else if (type == O_DEC) decval = other.decval; -// else if (type == O_LIST) { -// configs = new std::list; -// for (ConfValue * value : *other.configs) -// configs->push_back(new ConfValue(*value)); -// } -// else if (type == O_SYM) -// strval = other.strval; -// else if (type == O_HEX) -// unumval = other.unumval; -// else if (type == O_BIN) -// unumval = other.unumval; -// else if (type == O_ATTR) -// strval = other.strval; -// else if (type == O_BOOL) -// numval = other.numval; -// else if (type == O_EMPTY) -// strval = strdup(""); -// else assert(false); -// return *this; -//} - -std::string ConfValue::toString() const { - if (type == O_BOOL) - return numval == 1 ? "true" : "false"; - if (type == O_STR) - return strval; - if (type == O_NUM) { - return std::to_string(numval); - } - if (type == O_EMPTY) { - return ""; - } - if (type == O_ATTR) { - return strval; - } - if (type == O_DEC) { - std::stringstream ss; - ss << decval; - return ss.str(); - } - if (type == O_HEX or type == O_BIN) { - return std::to_string(unumval); - } - if (type == O_SYM) { - return strval; - } - if (type == O_LIST) { - std::stringstream ss; - ss << "( "; - for (ConfValue const & val : configs) { - ss << val.toString() << " "; - } - ss << ")"; - return ss.str(); - } - throw OsmtInternalException("Not implemented"); -} - - -/*********************************************************** - * Class defining the information, configured with set-info - ***********************************************************/ - -Info::Info(AttributeValueNode const & n) { - // child is attribute_value - if (auto specConst = std::get_if>(&n.value)) { - value = ConfValue(**specConst); - } else if (auto symbolNode = std::get_if>(&n.value)) { - value.strval = (**symbolNode).getString(); - value.type = (**symbolNode).getType(); - } else if (auto sexprList = std::get_if>>(&n.value)) { - value = ConfValue(**sexprList); - } else { - assert(false); - } -} - -//Info::Info(const Info& other) -//{ -// value = other.value; -//} - -/*********************************************************** - * Class defining the options, configured with set-config - ***********************************************************/ - -SMTOption::SMTOption(ASTNode const & n) { - assert(not n.children->empty()); - - ASTNode const & child = *(*n.children)[0]; - - if (child.getType() == ASTType::BOOL_T) { - value.type = O_BOOL; - value.numval = child.getValue() == "true" ? 1 : 0; - return; - } - if (child.getType() == ASTType::STR_T) { - value.type = O_STR; - value.strval = child.getValue(); - return; - } - if (child.getType() == ASTType::NUM_T) { - value.type = O_NUM; - value.numval = std::stoi(child.getValue()); - return; - } - - if (child.getType() == ASTType::DEC_T) { - value.type = O_DEC; - value.decval = std::stod(child.getValue()); - } - assert(child.getType() == ASTType::UATTR_T or child.getType() == ASTType::PATTR_T); - // The option is an attribute - - if (not child.children or child.children->empty()) { - value.type = O_EMPTY; - return; - } else { - // n is now attribute_value - ASTNode const & attributeValue = *(*child.children)[0]; - - if (attributeValue.getType() == ASTType::SPECC_T or attributeValue.getType() == ASTType::SEXPRL_T) { - value = ConfValue(attributeValue); - } - else if (attributeValue.getType() == ASTType::SYM_T) { - if (attributeValue.getValue() == "true") { - value.type = O_BOOL; - value.numval = 1; - } else if (attributeValue.getValue() == "false") { - value.type = O_BOOL; - value.numval = 0; - } else { - value.strval = attributeValue.getValue(); - value.type = O_STR; - } - return; - } - else assert(false); - } -} - //--------------------------------------------------------------------------------- // SMTConfig @@ -268,13 +42,13 @@ bool SMTConfig::setOption(std::string const & name, const SMTOption& value, cons // Special options: // stats_out if (name == o_stats_out) { - if (value.getValue().type != O_STR) { msg = s_err_not_str; return false; } + if (value.getValue().type != ConstType::string) { msg = s_err_not_str; return false; } if (optionTable.find(name) == optionTable.end()) - stats_out.open(value.getValue().strval, std::ios_base::out); - else if (optionTable[name].getValue().strval != value.getValue().strval) { + stats_out.open(value.getValue().getStringVal(), std::ios_base::out); + else if (optionTable[name].getValue().getStringVal() != value.getValue().getStringVal()) { if (stats_out.is_open()) { stats_out.close(); - stats_out.open(value.getValue().strval, std::ios_base::out); + stats_out.open(value.getValue().getStringVal(), std::ios_base::out); } } else {} @@ -282,50 +56,50 @@ bool SMTConfig::setOption(std::string const & name, const SMTOption& value, cons // produce stats if (name == o_produce_stats) { - if (value.getValue().type != O_BOOL) { msg = s_err_not_bool; return false; } - if (value.getValue().numval == 1) { + if (value.getValue().type != ConstType::boolean) { + throw OsmtApiException(s_err_not_bool); + } else if (value.getValue().getBoolVal()) { // Gets set to true if (optionTable.find(o_stats_out) == optionTable.end()) { - if (optionTable.find(o_produce_stats) == optionTable.end() || optionTable[o_produce_stats].getValue().numval == 0) { + if (optionTable.find(o_produce_stats) == optionTable.end() || not optionTable[o_produce_stats].getValue().getBoolVal()) { // Insert the default value insertOption(o_stats_out, SMTOption("/dev/stdout")); - } else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats].getValue().numval == 1) { + } else if (optionTable.find(o_produce_stats) != optionTable.end() and optionTable[o_produce_stats].getValue().getBoolVal()) { assert(false); } } else { } // No action required - if (!stats_out.is_open()) stats_out.open(optionTable[o_stats_out].getValue().strval, std::ios_base::out); + if (!stats_out.is_open()) stats_out.open(optionTable[o_stats_out].getValue().getStringVal(), std::ios_base::out); } - else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats].getValue().numval == 1) { + else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats].getValue().getBoolVal()) { // gets set to false and was previously true if (optionTable.find(o_stats_out) != optionTable.end()) { - if (optionTable.at(o_stats_out).getValue().numval == 0) assert(false); - else if (stats_out.is_open()) stats_out.close(); + stats_out.close(); } } } if (name == o_random_seed) { - if (value.getValue().type != O_NUM) { msg = s_err_not_num; return false; } - int seed = value.getValue().numval; - if (seed == 0) { msg = s_err_seed_zero; return false; } + if (value.getValue().type != ConstType::numeral) { + throw OsmtApiException(s_err_not_num); + } + uint32_t seed = value.getValue().getUint32Val(); + if (seed == 0) { throw OsmtApiException(s_err_seed_zero); } } if (name == o_sat_split_type) { - if (value.getValue().type != O_STR) { msg = s_err_not_str; return false; } - std::string val = value.getValue().strval; + if (value.getValue().type != ConstType::string) { throw OsmtApiException(s_err_not_str); } + std::string val = value.getValue().getStringVal(); if (val != spts_lookahead && val != spts_scatter && val != spts_none) { - msg = s_err_unknown_split; - return false; + throw OsmtApiException(s_err_unknown_split); } } if (name == o_sat_split_units) { - if (value.getValue().type != O_STR) { msg = s_err_not_str; return false; } - std::string val = value.getValue().strval; + if (value.getValue().type != ConstType::string) { throw OsmtApiException(s_err_not_str); } + std::string val = value.getValue().getStringVal(); if (val != spts_time && val != spts_search_counter) { - msg = s_err_unknown_units; - return false; + throw OsmtApiException(s_err_unknown_units); } } auto itr = optionTable.find(name); @@ -344,18 +118,18 @@ const SMTOption& SMTConfig::getOption(std::string const & name) const { return option_Empty; } -bool SMTConfig::setInfo(std::string && name_, Info && value) { +bool SMTConfig::setInfo(std::string && name_, SMTOption::ConfValue && value) { if (infoTable.find(name_) != infoTable.end()) infoTable.erase(infoTable.find(name_)); infoTable.insert({name_, value}); return true; } -Info SMTConfig::getInfo(std::string const & name) const { +SMTOption::ConfValue SMTConfig::getInfo(std::string const & name) const { if (infoTable.find(name) != infoTable.end()) return infoTable.at(name); else - return info_Empty; + return {}; } const char* SMTConfig::o_produce_models = ":produce-models"; diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index ab2586df..a6178a56 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -31,6 +31,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "StringMap.h" #include "smt2newcontext.h" #include "smt2tokens.h" +#include "OsmtApiException.h" +#include "OsmtInternalException.h" #include #include @@ -132,15 +134,25 @@ class SMTOption { ConfValue(int i) : type(ConstType::numeral), value(i) {} ConfValue(double i) : type(ConstType::decimal), value(i) {} ConfValue(std::string && s) : type(ConstType::string), value(std::move(s)) {} - std::string getStringValue() const; + std::string getStringVal() const { + if (type == ConstType::string) { + auto val = std::get_if(&value); + assert(val); + return *val; + } + else { + throw OsmtApiException("Attempt to get string value of a non-string type"); + } + } double getDoubleVal() const { if (type == ConstType::numeral) { if (auto val = std::get_if(&value)) { return static_cast(*val); } else if (auto val = std::get_if(&value)) { return static_cast(*val); + } else { + throw OsmtInternalException("Inconsistent value for option"); } - assert(false); } else if (type == ConstType::decimal) { auto val = std::get_if(&value); assert(val); @@ -149,7 +161,16 @@ class SMTOption { throw OsmtApiException("Attempted to obtain double value for non-numeric type"); } } - uint32_t getUint32Value() const { + int getIntVal() const { + if (type == ConstType::numeral) { + auto val = std::get_if(&value); + assert(val); + return *val; + } else { + throw OsmtApiException("Attempted to obtain int value for non-int type"); + } + } + uint32_t getUint32Val() const { if (type == ConstType::uint32) { auto val = std::get_if(&value); assert(val); @@ -161,7 +182,11 @@ class SMTOption { bool getBoolVal() const { if (type == ConstType::boolean) { auto val = std::get_if(&value); - + assert(val); + return *val; + } + else { + throw OsmtApiException("Attempt to obtain boolean value for non-boolean type"); } } }; @@ -191,7 +216,7 @@ class SMTOption { SMTOption(double i): value(i) {} SMTOption(std::string && s) : value(std::move(s)) {} inline bool isEmpty() const { return value.type == ConstType::empty; } - inline std::string toString() const { return value.toString(); } +// inline std::string toString() const { return value.toString(); } inline const ConfValue& getValue() const { return value; } private: ConfValue value; @@ -411,7 +436,7 @@ struct SMTConfig void printHelp ( ); void printConfig ( std::ostream & out ); - inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed).getValue().getUint32Value(): 91648253; } + inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed).getValue().getUint32Val(): 91648253; } inline void setProduceModels( ) { insertOption(o_produce_models, SMTOption(1)); } inline bool setRandomSeed(int seed) { insertOption(o_random_seed, SMTOption(seed)); return true; } @@ -444,161 +469,185 @@ struct SMTConfig // Get interpolation algorithms inline ItpAlgorithm getBooleanInterpolationAlgorithm() const { - return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg).getValue().getUint32Value()) + return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg).getValue().getUint32Val()) : ItpAlgorithm::itp_alg_mcmillan; } inline ItpAlgorithm getEUFInterpolationAlgorithm() const { - return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg).getValue().getUint32Value()) + return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg).getValue().getUint32Val()) : ItpAlgorithm::itp_euf_alg_strong; } inline ItpAlgorithm getLRAInterpolationAlgorithm() const { - return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg).getValue().getUint32Value()) + return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg).getValue().getUint32Val()) : ItpAlgorithm::itp_lra_alg_strong; } inline std::string getLRAStrengthFactor() const { return optionTable.find(o_itp_lra_factor) != optionTable.end() ? optionTable.at( - o_itp_lra_factor).getValue().getStringValue() : itp_lra_factor_0; + o_itp_lra_factor).getValue().getStringVal() : itp_lra_factor_0; } inline std::string getInstanceName() const { - return optionTable.find(o_inst_name) != optionTable.end() ? optionTable.at(o_inst_name).getValue().getStringValue() : "unknown"; + return optionTable.find(o_inst_name) != optionTable.end() ? optionTable.at(o_inst_name).getValue().getStringVal() : "unknown"; } lbool status; // Status of the benchmark // int incremental; // Incremental solving - int isIncremental() const - { return optionTable.find(o_incremental) != optionTable.end() ? - optionTable.at(o_incremental).getValue().numval == 1: true; } - int produce_models() const { + bool isIncremental() const { + return optionTable.find(o_incremental) != optionTable.end() ? + optionTable.at(o_incremental).getValue().getBoolVal() : true; + } + bool produce_models() const { return optionTable.find(o_produce_models) != optionTable.end() ? - optionTable.at(o_produce_models).getValue().numval : - 1; } - int produceStats() const - { return optionTable.find(o_produce_stats) != optionTable.end() ? - optionTable.at(o_produce_stats).getValue().numval == 1: false; } + optionTable.at(o_produce_models).getValue().getBoolVal() : true; + } + bool produceStats() const { + return optionTable.find(o_produce_stats) != optionTable.end() && + optionTable.at(o_produce_stats).getValue().getBoolVal(); } std::string getStatsOut() const { - return optionTable.find(o_stats_out) != optionTable.end() ? optionTable.at(o_stats_out).getValue().strval : "/dev/stdout"; + return optionTable.find(o_stats_out) != optionTable.end() ? optionTable.at(o_stats_out).getValue().getStringVal() : "/dev/stdout"; } int sat_grow() const { return optionTable.find(o_grow) != optionTable.end() ? - optionTable.at(o_grow).getValue().numval : 0; } + optionTable.at(o_grow).getValue().getBoolVal() : 0; } int sat_clause_lim() const { return optionTable.find(o_clause_lim) != optionTable.end() ? - optionTable.at(o_clause_lim).getValue().numval : 20; } + optionTable.at(o_clause_lim).getValue().getUint32Val() : 20; } int sat_subsumption_lim() const { return optionTable.find(o_subsumption_lim) != optionTable.end() ? - optionTable.at(o_subsumption_lim).getValue().numval : 1000; } + optionTable.at(o_subsumption_lim).getValue().getUint32Val() : 1000; } double sat_simp_garbage_frac() const { return optionTable.find(o_simp_garbage_frac) != optionTable.end() ? - optionTable.at(o_simp_garbage_frac).getValue().decval : 0.5; } + optionTable.at(o_simp_garbage_frac).getValue().getDoubleVal() : 0.5; } int sat_use_asymm() const { return optionTable.find(o_use_asymm) != optionTable.end() ? - optionTable.at(o_use_asymm).getValue().numval == 1: false; } - int sat_use_rcheck() const - { return optionTable.find(o_use_rcheck) != optionTable.end() ? - optionTable.at(o_use_rcheck).getValue().numval == 1: false; } - int sat_use_elim() const - { return optionTable.find(o_use_elim) != optionTable.end() ? - optionTable.at(o_use_elim).getValue().numval == 1: true; } - double sat_var_decay() const - { return optionTable.find(o_var_decay) != optionTable.end() ? - optionTable.at(o_var_decay).getValue().decval : 1 / 0.95; } - double sat_clause_decay() const - { return optionTable.find(o_clause_decay) != optionTable.end() ? - optionTable.at(o_clause_decay).getValue().decval : 1 / 0.999; } - double sat_random_var_freq() const - { return optionTable.find(o_random_var_freq) != optionTable.end() ? - optionTable.at(o_random_var_freq).getValue().decval : 0.02; } - int sat_random_seed() const - { return optionTable.find(o_random_seed) != optionTable.end() ? - optionTable.at(o_random_seed).getValue().decval : 91648253; } - int sat_luby_restart() const - { return optionTable.find(o_luby_restart) != optionTable.end() ? - optionTable.at(o_luby_restart).getValue().numval > 0 : 1; } - int sat_ccmin_mode() const - { return optionTable.find(o_ccmin_mode) != optionTable.end() ? - optionTable.at(o_ccmin_mode).getValue().numval : 2; } - int sat_rnd_pol() const - { return optionTable.find(o_rnd_pol) != optionTable.end() ? - optionTable.at(o_rnd_pol).getValue().numval > 0 : 0; } - int sat_rnd_init_act() const - { return optionTable.find(o_rnd_init_act) != optionTable.end() ? - optionTable.at(o_rnd_init_act).getValue().numval > 0 : 0; } - double sat_garbage_frac() const - { return optionTable.find(o_garbage_frac) != optionTable.end() ? - optionTable.at(o_garbage_frac).getValue().decval : 0.20; } - int sat_restart_first() const - { return optionTable.find(o_restart_first) != optionTable.end() ? - optionTable.at(o_restart_first).getValue().numval : 100; } - double sat_restart_inc() const - { return optionTable.find(o_restart_inc) != optionTable.end() ? - optionTable.at(o_restart_inc).getValue().numval : 1.1; } - int proof_interpolant_cnf() const - { return optionTable.find(o_interpolant_cnf) != optionTable.end() ? - optionTable.at(o_interpolant_cnf).getValue().numval : 0; } - int certify_inter() const - { return optionTable.find(o_certify_inter) != optionTable.end() ? - optionTable.at(o_certify_inter).getValue().numval : 0; } - bool produce_inter() const - { return optionTable.find(o_produce_inter) != optionTable.end() ? - optionTable.at(o_produce_inter).getValue().numval > 0 : false; } - int simplify_inter() const - { return optionTable.find(o_simplify_inter) != optionTable.end() ? - optionTable.at(o_simplify_inter).getValue().numval : 0; } - int proof_struct_hash() const - { return optionTable.find(o_proof_struct_hash) != optionTable.end() ? - optionTable.at(o_proof_struct_hash).getValue().numval : 1; } - int proof_num_graph_traversals() const - { return optionTable.find(o_proof_num_graph_traversals) != optionTable.end() ? - optionTable.at(o_proof_num_graph_traversals).getValue().numval : 3; } - int proof_red_trans() const - { return optionTable.find(o_proof_red_trans) != optionTable.end() ? - optionTable.at(o_proof_red_trans).getValue().numval : 2; } - int proof_rec_piv() const - { return optionTable.find(o_proof_rec_piv) != optionTable.end() ? - optionTable.at(o_proof_rec_piv).getValue().numval : 1; } - int proof_push_units() const - { return optionTable.find(o_proof_push_units) != optionTable.end() ? - optionTable.at(o_proof_push_units).getValue().numval : 1; } - int proof_transf_trav() const - { return optionTable.find(o_proof_transf_trav) != optionTable.end() ? - optionTable.at(o_proof_transf_trav).getValue().numval : 1; } - int proof_check() const - { return optionTable.find(o_proof_check) != optionTable.end() ? - optionTable.at(o_proof_check).getValue().numval : 0; } - int proof_multiple_inter() const - { return optionTable.find(o_proof_multiple_inter) != optionTable.end() ? - optionTable.at(o_proof_multiple_inter).getValue().numval : 0; } - int proof_alternative_inter() const - { return optionTable.find(o_proof_alternative_inter) != optionTable.end() ? - optionTable.at(o_proof_alternative_inter).getValue().numval : 0; } - int proof_reduce() const - { return optionTable.find(o_proof_reduce) != optionTable.end() ? - optionTable.at(o_proof_reduce).getValue().numval : 0; } - int itp_bool_alg() const - { return optionTable.find(o_itp_bool_alg) != optionTable.end() ? - optionTable.at(o_itp_bool_alg).getValue().numval : 0; } - int itp_euf_alg() const + optionTable.at(o_use_asymm).getValue().getBoolVal() : false; } + int sat_use_rcheck() const { + return optionTable.find(o_use_rcheck) != optionTable.end() ? + optionTable.at(o_use_rcheck).getValue().getBoolVal() : false; + } + int sat_use_elim() const { + return optionTable.find(o_use_elim) != optionTable.end() ? + optionTable.at(o_use_elim).getValue().getBoolVal() : true; + } + double sat_var_decay() const { + return optionTable.find(o_var_decay) != optionTable.end() ? + optionTable.at(o_var_decay).getValue().getDoubleVal() : 1 / 0.95; } + double sat_clause_decay() const { + return optionTable.find(o_clause_decay) != optionTable.end() ? + optionTable.at(o_clause_decay).getValue().getDoubleVal() : 1 / 0.999; } + double sat_random_var_freq() const { + return optionTable.find(o_random_var_freq) != optionTable.end() ? + optionTable.at(o_random_var_freq).getValue().getDoubleVal() : 0.02; } + uint32_t sat_random_seed() const { + return optionTable.find(o_random_seed) != optionTable.end() ? + optionTable.at(o_random_seed).getValue().getUint32Val() : 91648253; } + bool sat_luby_restart() const { + return optionTable.find(o_luby_restart) != optionTable.end() ? + optionTable.at(o_luby_restart).getValue().getBoolVal() : true; + } + uint32_t sat_ccmin_mode() const { + return optionTable.find(o_ccmin_mode) != optionTable.end() ? + optionTable.at(o_ccmin_mode).getValue().getUint32Val() : 2; + } + bool sat_rnd_pol() const { + return optionTable.find(o_rnd_pol) != optionTable.end() ? + optionTable.at(o_rnd_pol).getValue().getBoolVal() : false; + } + bool sat_rnd_init_act() const { + return optionTable.find(o_rnd_init_act) != optionTable.end() ? + optionTable.at(o_rnd_init_act).getValue().getBoolVal() : false; } + double sat_garbage_frac() const { + return optionTable.find(o_garbage_frac) != optionTable.end() ? + optionTable.at(o_garbage_frac).getValue().getDoubleVal() : 0.20; + } + uint32_t sat_restart_first() const { + return optionTable.find(o_restart_first) != optionTable.end() ? + optionTable.at(o_restart_first).getValue().getUint32Val() : 100; } + double sat_restart_inc() const { + return optionTable.find(o_restart_inc) != optionTable.end() ? + optionTable.at(o_restart_inc).getValue().getDoubleVal() : 1.1; + } + int proof_interpolant_cnf() const { + return optionTable.find(o_interpolant_cnf) != optionTable.end() ? + optionTable.at(o_interpolant_cnf).getValue().getBoolVal() : false; + } + int certify_inter() const { + return optionTable.find(o_certify_inter) != optionTable.end() ? + optionTable.at(o_certify_inter).getValue().getBoolVal(): false; + } + bool produce_inter() const { + return optionTable.find(o_produce_inter) != optionTable.end() ? + optionTable.at(o_produce_inter).getValue().getBoolVal() : false; + } + uint32_t simplify_inter() const { + return optionTable.find(o_simplify_inter) != optionTable.end() ? + optionTable.at(o_simplify_inter).getValue().getUint32Val() : false; + } + bool proof_struct_hash() const { + return optionTable.find(o_proof_struct_hash) != optionTable.end() ? + optionTable.at(o_proof_struct_hash).getValue().getBoolVal() : true; + } + uint32_t proof_num_graph_traversals() const { + return optionTable.find(o_proof_num_graph_traversals) != optionTable.end() ? + optionTable.at(o_proof_num_graph_traversals).getValue().getUint32Val() : 3; } + uint32_t proof_red_trans() const { + return optionTable.find(o_proof_red_trans) != optionTable.end() ? + optionTable.at(o_proof_red_trans).getValue().getUint32Val() : 2; + } + bool proof_rec_piv() const { + return optionTable.find(o_proof_rec_piv) != optionTable.end() ? + optionTable.at(o_proof_rec_piv).getValue().getBoolVal() : true; + } + bool proof_push_units() const { + return optionTable.find(o_proof_push_units) != optionTable.end() ? + optionTable.at(o_proof_push_units).getValue().getBoolVal() : true; + } + bool proof_transf_trav() const { + return optionTable.find(o_proof_transf_trav) != optionTable.end() ? + optionTable.at(o_proof_transf_trav).getValue().getBoolVal() : true; + } + bool proof_check() const { + return optionTable.find(o_proof_check) != optionTable.end() ? + optionTable.at(o_proof_check).getValue().getBoolVal() : true; + } + bool proof_multiple_inter() const { + return optionTable.find(o_proof_multiple_inter) != optionTable.end() ? + optionTable.at(o_proof_multiple_inter).getValue().getBoolVal() : true; + } + bool proof_alternative_inter() const { + return optionTable.find(o_proof_alternative_inter) != optionTable.end() ? + optionTable.at(o_proof_alternative_inter).getValue().getBoolVal() : false; + } + bool proof_reduce() const { + return optionTable.find(o_proof_reduce) != optionTable.end() ? + optionTable.at(o_proof_reduce).getValue().getBoolVal() : false; + } + uint32_t itp_bool_alg() const { + return optionTable.find(o_itp_bool_alg) != optionTable.end() ? + optionTable.at(o_itp_bool_alg).getValue().getUint32Val() : 0; + } + uint32_t itp_euf_alg() const { return optionTable.find(o_itp_euf_alg) != optionTable.end() ? - optionTable.at(o_itp_euf_alg).getValue().numval : 0; } - int itp_lra_alg() const - { return optionTable.find(o_itp_lra_alg) != optionTable.end() ? - optionTable.at(o_itp_lra_alg).getValue().numval : 0; } - int sat_dump_rnd_inter() const - { return optionTable.find(o_sat_dump_rnd_inter) != optionTable.end() ? - optionTable.at(o_sat_dump_rnd_inter).getValue().numval : 2; } + optionTable.at(o_itp_euf_alg).getValue().getUint32Val() : 0; + } + uint32_t itp_lra_alg() const { + return optionTable.find(o_itp_lra_alg) != optionTable.end() ? + optionTable.at(o_itp_lra_alg).getValue().getUint32Val() : 0; } + uint32_t sat_dump_rnd_inter() const { + return optionTable.find(o_sat_dump_rnd_inter) != optionTable.end() ? + optionTable.at(o_sat_dump_rnd_inter).getValue().getUint32Val() : 2; } bool declarations_are_global() const { - return optionTable.find(o_global_declarations) != optionTable.end() ? optionTable.at(o_global_declarations).getValue().numval > 0 : false; + return optionTable.find(o_global_declarations) != optionTable.end() ? + optionTable.at(o_global_declarations).getValue().getBoolVal() : false; } SpUnit sat_resource_units() const { if (optionTable.find(o_sat_resource_units) != optionTable.end()) { - std::string type = optionTable.at(o_sat_resource_units).getValue().strval; + std::string type = optionTable.at(o_sat_resource_units).getValue().getStringVal(); if (type == spts_search_counter) { return SpUnit::search_counter; } else if (type == spts_time) { @@ -608,50 +657,55 @@ struct SMTConfig return SpUnit::search_counter; } - bool respect_logic_partitioning_hints() const - { return optionTable.find(o_respect_logic_partitioning_hints) != optionTable.end() ? - optionTable.at(o_respect_logic_partitioning_hints).getValue().numval : 0; } - double sat_resource_limit() const - { return optionTable.find(o_sat_resource_limit) != optionTable.end() ? - optionTable.at(o_sat_resource_limit).getValue().getDoubleVal() : -1; } + bool respect_logic_partitioning_hints() const { + return optionTable.find(o_respect_logic_partitioning_hints) != optionTable.end() ? + optionTable.at(o_respect_logic_partitioning_hints).getValue().getBoolVal() : false; + } + double sat_resource_limit() const { + return optionTable.find(o_sat_resource_limit) != optionTable.end() ? + optionTable.at(o_sat_resource_limit).getValue().getDoubleVal() : -1; + } std::string dump_state() const { if (optionTable.find(o_dump_state) != optionTable.end()) { - return append_output_dir(optionTable.at(o_dump_state).getValue().strval); + return append_output_dir(optionTable.at(o_dump_state).getValue().getStringVal()); } else { std::string name = getInstanceName(); return name.substr(0, name.size() - strlen(".smt2")); } } std::string output_dir() const { - return optionTable.find(o_output_dir) != optionTable.end() ? optionTable.at(o_output_dir).getValue().strval : ""; + return optionTable.find(o_output_dir) != optionTable.end() ? optionTable.at(o_output_dir).getValue().getStringVal() : ""; + } + bool dump_only() const { + return optionTable.find(o_dump_only) != optionTable.end() ? optionTable.at(o_dump_only).getValue().getBoolVal(): false; + } + bool dump_query() const { + return optionTable.find(o_dump_query) != optionTable.end() ? optionTable.at(o_dump_query).getValue().getBoolVal() : false; } - int dump_only() const - { return optionTable.find(o_dump_only) != optionTable.end() ? optionTable.at(o_dump_only).getValue().numval : 0; } - bool dump_query() const - { return optionTable.find(o_dump_query) != optionTable.end() ? optionTable.at(o_dump_query).getValue().numval : 0; } - void set_dump_query_name(std::string && dump_query_name) - { + void set_dump_query_name(std::string && dump_query_name) { if (optionTable.find(o_dump_query_name) != optionTable.end()) { optionTable.insert({o_dump_query_name, SMTOption(std::move(dump_query_name))}); - } - else + } else { insertOption(o_dump_query_name, SMTOption(std::move(dump_query_name))); - } + } + } std::string dump_query_name() const { - return optionTable.find(o_dump_query_name) != optionTable.end() ? append_output_dir(optionTable.at(o_dump_query_name).getValue().strval) : ""; + return optionTable.find(o_dump_query_name) != optionTable.end() ? + append_output_dir(optionTable.at(o_dump_query_name).getValue().getStringVal()) : ""; } - int sat_dump_learnts() const - { return optionTable.find(o_sat_dump_learnts) != optionTable.end() ? - optionTable.at(o_sat_dump_learnts).getValue().numval : 0; } + bool sat_dump_learnts() const { + return optionTable.find(o_sat_dump_learnts) != optionTable.end() ? + optionTable.at(o_sat_dump_learnts).getValue().getBoolVal() : false; } - bool sat_split_test_cube_and_conquer() const - { return optionTable.find(o_sat_split_test_cube_and_conquer) != optionTable.end() ? - optionTable.at(o_sat_split_test_cube_and_conquer).getValue().numval : 0; } + bool sat_split_test_cube_and_conquer() const { + return optionTable.find(o_sat_split_test_cube_and_conquer) != optionTable.end() ? + optionTable.at(o_sat_split_test_cube_and_conquer).getValue().getBoolVal() : false; + } SpType sat_split_type() const { if (sat_lookahead_split()) { @@ -665,7 +719,7 @@ struct SMTConfig SpUnit sat_split_units() const { if (optionTable.find(o_sat_split_units) != optionTable.end()) { - std::string type = optionTable.at(o_sat_split_units).getValue().strval; + std::string type = optionTable.at(o_sat_split_units).getValue().getStringVal(); if (type == spts_search_counter) { return SpUnit::search_counter; } else if (type == spts_time) { @@ -677,64 +731,74 @@ struct SMTConfig double sat_split_inittune() const { return optionTable.find(o_sat_split_inittune) != optionTable.end() ? - optionTable.at(o_sat_split_inittune).getValue().getDoubleVal() : - -1; } + optionTable.at(o_sat_split_inittune).getValue().getDoubleVal() : + -1; + } double sat_split_midtune() const { return optionTable.find(o_sat_split_midtune) != optionTable.end() ? optionTable.at(o_sat_split_midtune).getValue().getDoubleVal() : - -1; } - int sat_split_num() const { + -1; + } + uint32_t sat_split_num() const { return optionTable.find(o_sat_split_num) != optionTable.end() ? - optionTable.at(o_sat_split_num).getValue().numval : - 2; } + optionTable.at(o_sat_split_num).getValue().getUint32Val() : + 2; + } int sat_split_fixvars() const { return optionTable.find(o_sat_split_fix_vars) != optionTable.end() ? - optionTable.at(o_sat_split_fix_vars).getValue().numval : - -1; } - int sat_split_asap() const { + optionTable.at(o_sat_split_fix_vars).getValue().getIntVal() : + -1; + } + bool sat_split_asap() const { return optionTable.find(o_sat_split_asap) != optionTable.end() ? - optionTable.at(o_sat_split_asap).getValue().numval : - 0; } - int sat_lookahead_split() const { + optionTable.at(o_sat_split_asap).getValue().getBoolVal(): + false; + } + bool sat_lookahead_split() const { return optionTable.find(o_sat_lookahead_split) != optionTable.end() ? - optionTable.at(o_sat_lookahead_split).getValue().numval : - 0; } - int sat_scatter_split() const { + optionTable.at(o_sat_lookahead_split).getValue().getBoolVal(): + false; + } + bool sat_scatter_split() const { return optionTable.find(o_sat_scatter_split) != optionTable.end() ? - optionTable.at(o_sat_scatter_split).getValue().numval : - 0; } - int sat_pure_lookahead() const { + optionTable.at(o_sat_scatter_split).getValue().getBoolVal() : + false; + } + bool sat_pure_lookahead() const { return optionTable.find(o_sat_pure_lookahead) != optionTable.end() ? - optionTable.at(o_sat_pure_lookahead).getValue().numval : - 0; } - int lookahead_score_deep() const { + optionTable.at(o_sat_pure_lookahead).getValue().getBoolVal() : + false; + } + bool lookahead_score_deep() const { return optionTable.find(o_lookahead_score_deep) != optionTable.end() ? - optionTable.at(o_lookahead_score_deep).getValue().numval : - 0; } - int randomize_lookahead() const { + optionTable.at(o_lookahead_score_deep).getValue().getBoolVal() : + false; + } + bool randomize_lookahead() const { return optionTable.find(o_sat_split_randomize_lookahead) != optionTable.end() ? - optionTable.at(o_sat_split_randomize_lookahead).getValue().numval : - 0; } + optionTable.at(o_sat_split_randomize_lookahead).getValue().getBoolVal() : + false; + } - int randomize_lookahead_bufsz() const { + uint32_t randomize_lookahead_bufsz() const { return optionTable.find(o_sat_split_randomize_lookahead_buf) != optionTable.end() ? - optionTable.at(o_sat_split_randomize_lookahead_buf).getValue().numval : - 1; } + optionTable.at(o_sat_split_randomize_lookahead_buf).getValue().getUint32Val() : + true; + } - int remove_symmetries() const - { return optionTable.find(o_sat_remove_symmetries) != optionTable.end() ? - optionTable.at(o_sat_remove_symmetries).getValue().numval : 0; } + bool remove_symmetries() const { + return optionTable.find(o_sat_remove_symmetries) != optionTable.end() ? + optionTable.at(o_sat_remove_symmetries).getValue().getBoolVal() : false; } - int dryrun() const - { return optionTable.find(o_dryrun) != optionTable.end() ? - optionTable.at(o_dryrun).getValue().numval : 0; } + bool dryrun() const { + return optionTable.find(o_dryrun) != optionTable.end() ? + optionTable.at(o_dryrun).getValue().getBoolVal() : false; } - void set_dryrun(bool b) - { insertOption(o_dryrun, SMTOption(b)); } + void set_dryrun(bool b) { insertOption(o_dryrun, SMTOption(b)); } SpPref sat_split_preference() const { if (optionTable.find(o_sat_split_preference) != optionTable.end()) { - std::string type = optionTable.at(o_sat_split_preference).getValue().strval; + std::string type = optionTable.at(o_sat_split_preference).getValue().getStringVal(); if (type == spprefs_tterm) return sppref_tterm; if (type == spprefs_blind) return sppref_blind; if (type == spprefs_bterm) return sppref_bterm; @@ -747,29 +811,26 @@ struct SMTConfig } bool use_ghost_vars() const { - if (optionTable.find(o_ghost_vars) != optionTable.end()) { - return optionTable.at(o_ghost_vars).getValue().numval != 0; - } - return false; + return optionTable.find(o_ghost_vars) != optionTable.end() ? + optionTable.at(o_ghost_vars).getValue().getBoolVal() : + false; } - int do_substitutions() const - { return optionTable.find(o_do_substitutions) != optionTable.end()? - optionTable.at(o_do_substitutions).getValue().numval : 1; } + bool do_substitutions() const { + return optionTable.find(o_do_substitutions) != optionTable.end()? + optionTable.at(o_do_substitutions).getValue().getBoolVal() : true; } - bool use_theory_polarity_suggestion() const - { return sat_theory_polarity_suggestion != 0; } + bool use_theory_polarity_suggestion() const { return sat_theory_polarity_suggestion != 0; } - int sat_solver_limit() const - { return optionTable.find(o_sat_solver_limit) != optionTable.end() ? - optionTable.at(o_sat_solver_limit).getValue().numval : 0; } + uint32_t sat_solver_limit() const { + return optionTable.find(o_sat_solver_limit) != optionTable.end() ? + optionTable.at(o_sat_solver_limit).getValue().getUint32Val() : 0; } bool sat_split_mode() const { - if (optionTable.find(o_sat_split_mode) != optionTable.end()) { - return optionTable.at(o_sat_split_mode).getValue().numval != 0; - } - return false; + return optionTable.find(o_sat_split_mode) != optionTable.end() ? + optionTable.at(o_sat_split_mode).getValue().getBoolVal() : + false; } // int produce_stats; // Should print statistics ? @@ -779,21 +840,14 @@ struct SMTConfig bool rocset; // Regular Output Channel set ? bool docset; // Diagnostic Output Channel set ? int dump_formula; // Dump input formula - int verbosity() const // Verbosity level -// TODO: remove MACROS from header file -#ifdef PEDANTIC_DEBUG - { return optionTable.has(o_verbosity) ? - optionTable[o_verbosity]->getValue().numval : 2; } -#elif GC_DEBUG - { return optionTable.has(o_verbosity) ? - optionTable[o_verbosity]->getValue().numval : 2; } -#else - { return optionTable.find(o_verbosity) != optionTable.end() ? - optionTable.at(o_verbosity).getValue().numval : 0; } -#endif - int printSuccess() const - { return optionTable.find(":print-success") != optionTable.end() ? - optionTable.at(":print-success").getValue().numval == 1: false; } + bool verbosity() const { // Verbosity level + return optionTable.find(o_verbosity) != optionTable.end() ? + optionTable.at(o_verbosity).getValue().getBoolVal() : false; + } + bool printSuccess() const { + return optionTable.find(":print-success") != optionTable.end() ? + optionTable.at(":print-success").getValue().getBoolVal() : false; + } int certification_level; // Level of certification char certifying_solver[256]; // Executable used for certification diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index 64c6749a..edb73a28 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -62,6 +62,7 @@ struct SymbolNode : public GeneralNode { return {*(**specConstNode).value}; } assert(false); + return {}; } ConstType getType() const { if (std::get_if>(&name)) { From b942c7c7603313458e955a9953a3a20914bbcd9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Thu, 27 Oct 2022 18:52:47 +0200 Subject: [PATCH 71/94] Interpret: update to new parser output --- src/api/Interpret.cc | 1081 ++++++++++++-------------- src/api/Interpret.h | 24 +- src/bin/opensmt.cc | 12 +- src/options/SMTConfig.cc | 43 +- src/options/SMTConfig.h | 362 ++++----- src/parsers/smt2new/smt2newcontext.h | 50 +- src/parsers/smt2new/smt2newparser.yy | 29 +- 7 files changed, 738 insertions(+), 863 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index 51b4b50d..2ae142c3 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -29,6 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "ArithLogic.h" #include "LogicFactory.h" #include "Substitutor.h" +#include "ParseNodePrinter.h" #include #include @@ -46,47 +47,118 @@ Interpret::getParsedFormula() return root; } -void Interpret::setInfo(std::string const & name) { - +void Interpret::interp(SetInfo const & n) { + std::string name = n.getName(); + config.setInfo(n.getName(), n.getValue()); + notify_success(); } -void Interpret::getInfo(ASTNode const & n) { - assert(n.getType() == ASTType::INFO_T); - assert(n.hasValue() or n.children->size() == 1); - std::string const & name = n.hasValue() ? n.getValue() : (*(*n.children)[0]).getValue(); +void Interpret::interp(GetInfo const & n) { + assert(n.key); + std::string const & name = *n.key; - const Info& value = config.getInfo(name); + auto const & value = config.getInfo(name); - if (value.isEmpty()) + if (value.type == ConstType::empty) notify_formatted(true, "no value for info %s", name.c_str()); else { - auto val_str = value.toString(); + auto val_str = value.getStringVal(); notify_formatted(false, "%s %s", name.c_str(), val_str.c_str()); } } -void Interpret::setOption(ASTNode const & n) { - assert(n.getType() == ASTType::OPTION_T); - assert(not n.hasValue() or not n.children->empty()); - std::string const & name = not n.hasValue() ? (*n.children)[0]->getValue() : n.getValue(); - - SMTOption value(n); - const char* msg = "ok"; - bool rval = config.setOption(name, value, msg); - if (rval == false) - notify_formatted(true, "set-option failed for %s: %s", name.c_str(), msg); +void Interpret::interp(SetOption const & n) { + assert(n.option); + switch (n.option->type) { + case OptionNode::OptionType::Attribute: { + auto val = std::get_if>(&n.option->value); + assert(val); + assert(*val); + config.setOption(*(**val).name, *(**val).value); + break; + } + case OptionNode::OptionType::DiagnosticOutputChannel: { + auto val = std::get_if>(&n.option->value); + assert(val); + assert(*val); + config.setOption("diagnostic-output-channel", std::move(**val)); + break; + } + case OptionNode::OptionType::ExpandDefinitions: { + auto val = std::get_if(&n.option->value); + assert(val); + config.setOption("expand-definitions", *val); + break; + } + case OptionNode::OptionType::InteractiveMode: { + auto val = std::get_if(&n.option->value); + assert(val); + config.setOption("interactive-mode", *val); + break; + } + case OptionNode::OptionType::PrintSuccess: { + auto val = std::get_if(&n.option->value); + assert(val); + config.setOption("print-success", *val); + break; + } + case OptionNode::OptionType::ProduceAssignments: { + auto val = std::get_if(&n.option->value); + assert(val); + config.setOption("produce-assignments", *val); + break; + } + case OptionNode::OptionType::ProduceModels: { + auto val = std::get_if(&n.option->value); + assert(val); + config.setOption("produce-models", *val); + break; + } + case OptionNode::OptionType::ProduceProofs: { + auto val = std::get_if(&n.option->value); + assert(val); + config.setOption("produce-proofs", *val); + break; + } + case OptionNode::OptionType::ProduceUnsatCores: { + auto val = std::get_if(&n.option->value); + assert(val); + config.setOption("produce-unsat-cores", *val); + break; + } + case OptionNode::OptionType::RandomSeed: { + auto val = std::get_if(&n.option->value); + assert(val); + config.setOption("random-seed", *val); + break; + } + case OptionNode::OptionType::RegularOutputChannel: { + auto val = std::get_if>(&n.option->value); + assert(val); + assert(*val); + config.setOption("regular-output-channel", std::move(**val)); + break; + } + case OptionNode::OptionType::Verbosity: { + auto val = std::get_if(&n.option->value); + assert(val); + config.setOption("verbosity", *val); + break; + } + default: + notify_formatted(true, "unknown option"); + break; + } } -void Interpret::getOption(ASTNode const & n) { - assert(n.getType() == ASTType::UATTR_T || n.getType() == ASTType::PATTR_T ); - - assert(n.hasValue()); - std::string const & name = n.getValue(); +void Interpret::interp(GetOption const & n) { + assert(n.key); + std::string const & name = *n.key; const SMTOption& value = config.getOption(name); if (value.isEmpty()) - notify_formatted(true, "No value for attr %s", name.c_str()); + notify_formatted(true, "No value for option %s", name.c_str()); else { auto str_val = value.toString(); notify_formatted(false, "%s",str_val.c_str()); @@ -164,215 +236,23 @@ void Interpret::interp(SetLogic const & n) { } } -void Interpret::interp(SetInfo const & n) { - std::string name = n.getName(); - config.setInfo(n.getName(), ConfValue(n.getValue())); - notify_success(); -} - - /* -void Interpret::interp(CommandNode const & n) { - assert(n.getType() == ASTType::CMD_T); - const smt2token cmd = n.getToken(); - try { - - case t_setinfo: - setInfo(*(*n.children)[0]); - notify_success(); - break; - case t_setoption : { - setOption(*(*n.children)[0]); - notify_success(); - break; - } - case t_getinfo: { - getInfo(*(*n.children)[0]); - break; - } - case t_getoption: { - getOption(*(*n.children)[0]); - break; - } - case t_declaresort: { - if (isInitialized()) { - assert(n.children->size() == 2); - ASTNode const & symbolNode = *(*n.children)[0]; - assert(symbolNode.getType() == ASTType::SYM_T or symbolNode.getType() == ASTType::QSYM_T); - ASTNode const & numNode = *(*n.children)[1]; - assert(numNode.getType() == ASTType::NUM_T); - int arity = std::stoi(numNode.getValue()); // MB: TODO: take care of out-of-range input - SortSymbol symbol(symbolNode.getValue(), arity); - SSymRef ssref; - if (logic->peekSortSymbol(symbol, ssref)) { - notify_formatted(true, "sort %s already declared", symbolNode.getValue().c_str()); - } else { - logic->declareSortSymbol(std::move(symbol)); - notify_success(); - } - } else - notify_formatted(true, "illegal command before set-logic: declare-sort"); - break; - } - case t_declarefun: { - if (isInitialized()) { - if (declareFun(n)) - notify_success(); - } else - notify_formatted(true, "Illegal command before set-logic: declare-fun"); - break; - } - case t_declareconst: { - if (isInitialized()) { - declareConst(n); - } else - notify_formatted(true, "Illegal command before set-logic: declare-const"); - break; - } - case t_assert: { - if (isInitialized()) { - sstat status; - ASTNode const &asrt = *(*n.children)[0]; - LetRecords letRecords; - PTRef tr = parseTerm(asrt, letRecords); - if (tr == PTRef_Undef) - notify_formatted(true, "assertion returns an unknown sort"); - else { - assertions.push(tr); - char *err_msg = NULL; - status = main_solver->insertFormula(tr, &err_msg); - - if (status == s_Error) - notify_formatted(true, "Error"); - else if (status == s_Undef) - notify_success(); - else if (status == s_False) - notify_success(); - - if (err_msg != NULL && status == s_Error) - notify_formatted(true, err_msg); - if (err_msg != NULL && status != s_Error) - comment_formatted(err_msg); - free(err_msg); - } - } else { - notify_formatted(true, "Illegal command before set-logic: assert"); - } - break; - } - case t_definefun: { - if (isInitialized()) { - defineFun(n); - } else { - notify_formatted(true, "Illegal command before set-logic: define-fun"); - } - break; - } - case t_simplify: { - if (isInitialized()) { - sstat status = main_solver->simplifyFormulas(); - if (status == s_Error) - notify_formatted(true, "Simplify"); - } else { - notify_formatted(true, "Illegal command before set-logic: simplify"); - } - break; - } - case t_checksat: { - if (isInitialized()) { - checkSat(); - } else { - notify_formatted(true, "Illegal command before set-logic: check-sat"); - } - break; - } - case t_getinterpolants: { - if (config.produce_inter()) { - if (isInitialized()) { - getInterpolants(n); - } else { - notify_formatted(true, "Illegal command before set-logic: get-interpolants"); - } - } else { - notify_formatted(true, - "Option to produce interpolants has not been set, skipping this command ..."); - } - break; - } - case t_getassignment: { - if (isInitialized()) { - getAssignment(); - } else { - notify_formatted(true, "Illegal command before set-logic: get-assignment"); - } - break; - } - case t_getvalue: { - if (not isInitialized()) { - notify_formatted(true, "Illegal command before set-logic: get-value"); - } else if (main_solver->getStatus() != s_True) { - notify_formatted(true, "Command get-value called, but solver is not in SAT state"); - } else { - getValue(*n.children); - } - break; - } - case t_getmodel: { - if (not isInitialized()) { - notify_formatted(true, "Illegal command before set-logic: get-model"); - } else if (main_solver->getStatus() != s_True) { - notify_formatted(true, "Command get-model called, but solver is not in SAT state"); - } else { - getModel(); - } - break; - } - - - case t_echo: { - std::string const & str = (*n.children)[0]->getValue(); - notify_formatted(false, "%s", str.c_str()); - break; - } - case t_push: { - if (not isInitialized()) { - notify_formatted(true, "Illegal command before set-logic: push"); - } else { - try { - int num = std::stoi((*n.children)[0]->getValue()); - push(num); - } catch (std::out_of_range const & e) { - notify_formatted(true, "Illegal push command: %s", e.what()); - } - } - break; - } - case t_pop: { - if (not isInitialized()) { - notify_formatted(true, "Illegal command before set-logic: pop"); - } else { - try { - int num = std::stoi((*n.children)[0]->getValue()); - pop(num); - } catch (std::out_of_range const &ex) { - notify_formatted(true, "Illegal pop command: %s", ex.what()); - } - } - break; - } - case t_exit: { - exit(); - notify_success(); - break; - } - default: { - notify_formatted(true, "Unknown command encountered: %s", tokenToName.at(cmd.x).c_str()); - } - } - } catch (OsmtApiException const &e) { - notify_formatted(true, e.what()); +void Interpret::interp(DeclareSort const & declareSort) { + if (not isInitialized()) { + notify_formatted(true, "illegal command before set-logic: declare-sort"); + return; + } + SymbolNode const & symbolNode = *declareSort.symbol; + std::string const & numNode = *declareSort.num; + int arity = std::stoi(numNode); // MB: TODO: take care of out-of-range input + SortSymbol symbol(opensmt::nodeToString()(symbolNode), arity); + SSymRef ssref; + if (logic->peekSortSymbol(symbol, ssref)) { + notify_formatted(true, "sort %s already declared", opensmt::nodeToString()(symbolNode).c_str()); + } else { + logic->declareSortSymbol(std::move(symbol)); + notify_success(); } } -*/ bool Interpret::addLetFrame(std::vector> const & bindings, LetRecords& letRecords) { for (auto const & [arg, name] : bindings) { @@ -385,166 +265,54 @@ bool Interpret::addLetFrame(std::vector> const return true; } -// -// Determine whether the term refers to some let definition -// -PTRef Interpret::letNameResolve(const char* s, const LetRecords& letRecords) const { - return letRecords.getOrUndef(s); -} - -PTRef Interpret::resolveQualifiedIdentifier(const char * name, ASTNode const & sort, bool isQuoted) { - SRef sr = sortFromASTNode(sort); - PTRef tr = PTRef_Undef; - try { - tr = resolveTerm(name, {}, sr, isQuoted ? SymbolMatcher::Uninterpreted : SymbolMatcher::Any); - } catch (OsmtApiException & e) { - reportError(e.what()); - } - return tr; -} - -PTRef Interpret::resolveTerm(const char* s, vec&& args, SRef sortRef, SymbolMatcher symbolMatcher) { - if (defined_functions.has(s)) { - auto const & tpl = defined_functions[s]; - return logic->instantiateFunctionTemplate(tpl, std::move(args)); - } - return logic->resolveTerm(s, std::move(args), sortRef, symbolMatcher); -} - -PTRef Interpret::parseTerm(const ASTNode& term, LetRecords& letRecords) { - ASTType t = term.getType(); - if (t == ASTType::TERM_T) { - std::string const & name = (*term.children)[0]->getValue(); -// comment_formatted("Processing term %s", name); - PTRef tr = PTRef_Undef; - try { - tr = logic->mkConst(name.c_str()); - } catch (OsmtApiException const & e) { - comment_formatted("While processing %s: %s", name.c_str(), e.what()); - } - return tr; - } - - else if (t == ASTType::QID_T) { - if ((*term.children)[0]->getType() == ASTType::AS_T) { - ASTNode const & as_node = *(*term.children)[0]; - ASTNode const & symbolNode = *(*as_node.children)[0]; - bool isQuoted = symbolNode.getType() == ASTType::QSYM_T; - std::string const & name = (*as_node.children)[0]->getValue(); - ASTNode const & sortNode = *(*as_node.children)[1]; - assert(not name.empty()); - PTRef tr = resolveQualifiedIdentifier(name.c_str(), sortNode, isQuoted); - return tr; - } else { - ASTNode const & symbolNode = *(*term.children)[0]; - std::string const & name = symbolNode.getValue(); - bool isQuoted = symbolNode.getType() == ASTType::QSYM_T; - PTRef tr = letNameResolve(name.c_str(), letRecords); - if (tr != PTRef_Undef) { - return tr; - } try { - tr = resolveTerm(name.c_str(), {}, SRef_Undef, isQuoted ? SymbolMatcher::Uninterpreted : SymbolMatcher::Any); - } catch (OsmtApiException & e) { - reportError(e.what()); - } - return tr; - } +void Interpret::interp(AssertNode const & n) { + if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic: assert"); + return; } - else if ( t == ASTType::LQID_T ) { - // Multi-argument term - assert(term.children->size() > 1); - auto const & astArgs = opensmt::span(&(*term.children)[1], term.children->size()-1); - std::string const & name = (*term.children)[0]->getValue(); - vec args; - for (auto const & arg : astArgs) { - PTRef arg_tr = parseTerm(*arg, letRecords); - if (arg_tr == PTRef_Undef) { - return PTRef_Undef; - } else { - args.push(arg_tr); - } - } - - assert(args.size() > 0); + sstat status; + TermNode const & asrt = *n.term; + LetRecords letRecords; + PTRef tr = parseTerm(asrt, letRecords); + if (tr == PTRef_Undef) { + notify_formatted(true, "assertion returns an unknown sort"); + } else { + assertions.push(tr); + char *err_msg = nullptr; + status = main_solver->insertFormula(tr, &err_msg); - PTRef tr = PTRef_Undef; - try { - tr = resolveTerm(name.c_str(), std::move(args)); - } catch (ArithDivisionByZeroException &ex) { - reportError(ex.what()); - } catch (OsmtApiException &e) { - reportError(e.what()); - } - return tr; - } else if (t == ASTType::LET_T) { - assert(term.children->size() == 2); - std::vector> const & varList = *(*term.children)[0]->children; - ASTNode const & letBoundedTerm = *(*term.children)[1]; - - // use RAII idiom to guard the scope of new LetFrame (and ensure the cleaup of names) - class Guard { - LetRecords& rec; - public: - Guard(LetRecords& rec): rec(rec) { rec.pushFrame(); } - ~Guard() { rec.popFrame(); } - } scopeGuard(letRecords); - - std::vector> bindings; - // First read the term declarations in the let statement - for (auto const & varListEl : varList) { - PTRef let_tr = parseTerm(*(*(*varListEl).children)[0], letRecords); - if (let_tr == PTRef_Undef) return PTRef_Undef; - bindings.push_back({let_tr, varListEl->getValue()}); - } + if (status == s_Error) + notify_formatted(true, "Error"); + else if (status == s_Undef) + notify_success(); + else if (status == s_False) + notify_success(); - // Only then insert them to the table - bool success = addLetFrame(bindings, letRecords); - if (not success) { - comment_formatted("Let name addition failed"); - return PTRef_Undef; - } - // This is now constructed with the let declarations context in let_branch - PTRef tr = parseTerm(letBoundedTerm, letRecords); - if (tr == PTRef_Undef) { - comment_formatted("Failed in parsing the let scoped term"); - return PTRef_Undef; - } - return tr; + if (err_msg != nullptr && status == s_Error) + notify_formatted(true, err_msg); + if (err_msg != nullptr && status != s_Error) + comment_formatted(err_msg); + free(err_msg); } +} - else if (t == ASTType::BANG_T) { - assert(term.children->size() == 2); - - ASTNode const & named_term = *(*term.children)[0]; - ASTNode const & attr_l = *(*term.children)[1]; - assert(attr_l.getType() == ASTType::GATTRL_T); - assert(attr_l.children->size() == 1); - ASTNode const & name_attr = *(*attr_l.children)[0]; - - PTRef tr = parseTerm(named_term, letRecords); - if (tr == PTRef_Undef) return tr; - - if (name_attr.getValue() == ":named") { - ASTNode const & sym = *(*name_attr.children)[0]; - assert(sym.getType() == ASTType::SYM_T or sym.getType() == ASTType::QSYM_T); - if (nameToTerm.find(sym.getValue()) != nameToTerm.end()) { - notify_formatted(true, "name %s already exists", sym.getValue().c_str()); - return PTRef_Undef; - } - std::string name = sym.getValue(); - // MB: term_names becomes the owner of the string and is responsible for deleting - term_names.push_back(name); - nameToTerm.insert({name, tr}); - } - return tr; +void Interpret::interp(Simplify const & n) { + if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic: simplify"); + return; } - else - comment_formatted("Unknown term type"); - return PTRef_Undef; + sstat status = main_solver->simplifyFormulas(); + if (status == s_Error) + notify_formatted(true, "Simplify"); } -sstat Interpret::checkSat() { +void Interpret::interp(CheckSatNode const & n) { + if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic: check-sat"); + return; + } + sstat res; res = main_solver->check(); @@ -556,14 +324,13 @@ sstat Interpret::checkSat() { else notify_formatted(false, "unknown"); - const Info& status = config.getInfo(":status"); + auto const & status = config.getInfo(":status"); if (!status.isEmpty()) { std::string statusString = status.toString(); - if ((statusString.compare("sat") == 0) && (res == s_False)) { + if (statusString == "sat" && (res == s_False)) { notify_formatted(false, "(error \"check status which says sat\")"); - } - else if ((statusString.compare("unsat") == 0) && (res == s_True)) { + else if (statusString == "unsat" && (res == s_True)) { notify_formatted(false, "(error \"check status which says unsat\")"); } } @@ -575,93 +342,6 @@ sstat Interpret::checkSat() { if (!o_dump_state.isEmpty() && o_split == spt_none) writeState(name); } - - return res; -} - -void Interpret::push(int n) { - if (not config.isIncremental()) { - notify_formatted(true, "push encountered but solver not in incremental mode"); - } else { - if (n < 0) { - notify_formatted(true, "Incorrect push command, value is negative."); - } else { - while (n--) { - defined_functions.pushScope(); - main_solver->push(); - } - notify_success(); - } - } -} - -void Interpret::pop(int n) { - if (config.isIncremental()) { - if (n < 0) { - notify_formatted(true, "Incorrect pop command, value is negative."); - } else { - bool success = true; - while (n-- and success) { - success = main_solver->pop(); - if (success) { defined_functions.popScope(); } - } - if (success) { - notify_success(); - } else { - notify_formatted(true, "Attempt to pop beyond the top of the stack"); - } - } - } else { - notify_formatted(true, "pop encountered but solver not in incremental mode"); - } -} - -bool Interpret::getAssignment() { - if (not isInitialized()) { - notify_formatted(true, "Illegal command before set-logic"); - return false; - } - if (main_solver->getStatus() != s_True) { - notify_formatted(true, "Last solver call not satisfiable"); - return false; - } - std::stringstream ss; - ss << '('; - for (unsigned int i = 0; i < term_names.size(); i++) { - std::string const & name = term_names[i]; - PTRef tr = nameToTerm[name.c_str()]; - lbool val = main_solver->getTermValue(tr); - ss << '(' << name << ' ' << (val == l_True ? "true" : (val == l_False ? "false" : "unknown")) - << ')' << (i < term_names.size() - 1 ? " " : ""); - } - ss << ')'; - const std::string& out = ss.str(); - notify_formatted(false, out.c_str()); - return true; -} - -void Interpret::getValue(std::vector> const & terms) -{ - auto model = main_solver->getModel(); - Logic& logic = main_solver->getLogic(); - std::vector> values; - for (auto const & term : terms) { - LetRecords tmp; - PTRef tr = parseTerm(*term, tmp); - if (tr != PTRef_Undef) { - values.emplace_back(opensmt::pair{tr, model->evaluate(tr)}); - auto pt_str = logic.printTerm(tr); - comment_formatted("Found the term %s", pt_str.c_str()); - } else - comment_formatted("Error parsing the term %s", (*term->children)[0]->getValue().c_str()); - } - printf("("); - for (auto const & valPair : values) { - auto name = logic.printTerm(valPair.first); - auto value = logic.printTerm(valPair.second); - printf("(%s %s)", name.c_str(), value.c_str()); - } - printf(")\n"); } namespace { @@ -729,7 +409,14 @@ class NameClashResolver { }; } -void Interpret::getModel() { +void Interpret::interp(GetModel const & n) { + if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic: get-model"); + return; + } else if (main_solver->getStatus() != s_True) { + notify_formatted(true, "Command get-model called, but solver is not in SAT state"); + return; + } auto model = main_solver->getModel(); NameClashResolver resolver(*logic); @@ -757,6 +444,282 @@ void Interpret::getModel() { std::cout << ss.str() << std::endl; } +void Interpret::interp(Echo const & n) { + std::string const & str = *n.text; + notify_formatted(false, "%s", str.c_str()); +} + +void Interpret::interp(PushNode const & n) { + if (not config.isIncremental()) { + notify_formatted(true, "push encountered but solver not in incremental mode"); + return; + } else if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic: push"); + return; + } + int num = n.num; + while (num --) { + defined_functions.pushScope(); + main_solver->push(); + } + notify_success(); +} + +void Interpret::interp(PopNode const & n) { + if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic: pop"); + return; + } else if (not config.isIncremental()) { + notify_formatted(true, "pop encountered but solver not in incremental mode"); + return; + } else if (n.num < 0) { + notify_formatted(true, "Incorrect pop command, value is negative."); + return; + } + bool success = true; + int num = n.num; + while (num -- and success) { + success = main_solver->pop(); + if (success) { defined_functions.popScope(); } + } + if (success) { + notify_success(); + } else { + notify_formatted(true, "Attempt to pop beyond the top of the stack"); + } +} + +void Interpret::interp(Exit const & n) { + exit(); + notify_success(); +} + +// +// Determine whether the term refers to some let definition +// +PTRef Interpret::letNameResolve(const char* s, const LetRecords& letRecords) const { + return letRecords.getOrUndef(s); +} + +PTRef Interpret::resolveQualifiedIdentifier(std::string const & name, SortNode const & sort, bool isQuoted) { + SRef sr = sortFromSortNode(sort); + PTRef tr = PTRef_Undef; + try { + tr = resolveTerm(name.c_str(), {}, sr, isQuoted ? SymbolMatcher::Uninterpreted : SymbolMatcher::Any); + } catch (OsmtApiException & e) { + reportError(e.what()); + } + return tr; +} + +PTRef Interpret::resolveTerm(const char* s, vec&& args, SRef sortRef, SymbolMatcher symbolMatcher) { + if (defined_functions.has(s)) { + auto const & tpl = defined_functions[s]; + return logic->instantiateFunctionTemplate(tpl, std::move(args)); + } + return logic->resolveTerm(s, std::move(args), sortRef, symbolMatcher); +} + +PTRef Interpret::parseTerm(LetTermNode const * letTerm, LetRecords & letRecords) { + assert(letTerm->arguments->size() == 1); + auto const & varList = *letTerm->bindings; + auto const & letBoundedTerm = (*letTerm->arguments)[0]; + + // use RAII idiom to guard the scope of new LetFrame (and ensure the cleaup of names) + class Guard { + LetRecords& rec; + public: + Guard(LetRecords& rec): rec(rec) { rec.pushFrame(); } + ~Guard() { rec.popFrame(); } + } scopeGuard(letRecords); + + std::vector> bindings; + // First read the term declarations in the let statement + for (auto const & varListEl : varList) { + PTRef let_tr = parseTerm(*varListEl->term, letRecords); + if (let_tr == PTRef_Undef) return PTRef_Undef; + bindings.push_back({let_tr, opensmt::nodeToString()(*varListEl->symbol)}); + } + // Only then insert them to the table + bool success = addLetFrame(bindings, letRecords); + if (not success) { + comment_formatted("Let name addition failed"); + return PTRef_Undef; + } + // This is now constructed with the let declarations context in let_branch + PTRef tr = parseTerm(*letBoundedTerm, letRecords); + if (tr == PTRef_Undef) { + comment_formatted("Failed in parsing the let scoped term"); + return PTRef_Undef; + } + return tr; +} + +PTRef Interpret::parseTerm(AnnotationNode const * term, LetRecords & letRecords) { + TermNode const & named_term = *(*term->arguments)[0]; + PTRef tr = parseTerm(named_term, letRecords); + if (tr == PTRef_Undef) return tr; + + auto const & attr_l = *term->attributes; + + for (auto const & attribute : attr_l) { + std::string const & name_attr = *attribute->name; + + if (name_attr == ":named") { + auto name = opensmt::nodeToString()(*attribute->value); + if (nameToTerm.find(name) != nameToTerm.end()) { + notify_formatted(true, "name %s already exists", name.c_str()); + return PTRef_Undef; + } + // MB: term_names becomes the owner of the string and is responsible for deleting + term_names.push_back(name); + nameToTerm.insert({name, tr}); + } + } + return tr; +} + +PTRef Interpret::parseTerm(TermNode const & term, LetRecords& letRecords) { + if (auto const regularTerm = dynamic_cast(&term)) { + return parseTerm(regularTerm, letRecords); + } else if (auto const letTerm = dynamic_cast(&term)) { + return parseTerm(letTerm, letRecords); + } else if (auto const annotatedTerm = dynamic_cast(&term)) { + return parseTerm(annotatedTerm, letRecords); + } else if (auto const forallTerm = dynamic_cast(&term)) { + return parseTerm(forallTerm, letRecords); + } else if (auto const existsTerm = dynamic_cast(&term)) { + return parseTerm(existsTerm, letRecords); + } + comment_formatted("Unknown term type"); + return PTRef_Undef; +} + +PTRef Interpret::parseTerm(NormalTermNode const * term, LetRecords & letRecords) { + if (auto constName = std::get_if>(&term->head)) { + auto const & name = *(*constName)->value; + try { + PTRef tr = logic->mkConst(name.c_str()); + return tr; + } catch (OsmtApiException const & e) { + comment_formatted("While processing %s: %s", name.c_str(), e.what()); + return PTRef_Undef; + } + } + auto identifier = std::get_if>(&term->head); + assert(identifier); + auto name = opensmt::nodeToString()(*(*identifier)->symbol); + bool isQuoted = (*identifier)->symbol->quoted; + if (term->returnSort) { + return resolveQualifiedIdentifier(name, *term->returnSort, isQuoted); + } else { + if (term->arguments->empty()) { + PTRef tr = letNameResolve(name.c_str(), letRecords); + if (tr != PTRef_Undef) { + return tr; + } try { + tr = resolveTerm(name.c_str(), {}, SRef_Undef, isQuoted ? SymbolMatcher::Uninterpreted : SymbolMatcher::Any); + } catch (OsmtApiException & e) { + reportError(e.what()); + } + return tr; + } else { + vec args; + for (auto const & arg : *term->arguments) { + PTRef arg_tr = parseTerm(*arg, letRecords); + if (arg_tr == PTRef_Undef) { + return PTRef_Undef; + } else { + args.push(arg_tr); + } + } + assert(args.size() > 0); + + PTRef tr = PTRef_Undef; + try { + tr = resolveTerm(name.c_str(), std::move(args)); + } catch (ArithDivisionByZeroException &ex) { + reportError(ex.what()); + } catch (OsmtApiException &e) { + reportError(e.what()); + } + return tr; + } + } +} + +PTRef Interpret::parseTerm(ForallNode const * term, LetRecords & letRecords) { + return PTRef_Undef; +} +PTRef Interpret::parseTerm(ExistsNode const * term, LetRecords & letRecords) { + return PTRef_Undef; +} + + + + + +void Interpret::interp(GetAssignment const & getAssignment) { + if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic"); + } + if (main_solver->getStatus() != s_True) { + notify_formatted(true, "Last solver call not satisfiable"); + } + std::stringstream ss; + ss << '('; + for (unsigned int i = 0; i < term_names.size(); i++) { + std::string const & name = term_names[i]; + PTRef tr = nameToTerm[name.c_str()]; + lbool val = main_solver->getTermValue(tr); + ss << '(' << name << ' ' << (val == l_True ? "true" : (val == l_False ? "false" : "unknown")) + << ')' << (i < term_names.size() - 1 ? " " : ""); + } + ss << ')'; + const std::string& out = ss.str(); + notify_formatted(false, out.c_str()); +} + +namespace { +// Todo: implement all cases +std::string printTermNode(TermNode const & term) { + auto term_p = dynamic_cast(&term); + assert(term_p); + if (auto const_p = std::get_if>(&term_p->head)) { + return *(*const_p)->value; + } else { + auto head_p = std::get_if>(&term_p->head); + assert(head_p); + return opensmt::nodeToString()(*(*head_p)->symbol); + } +} +} + +void Interpret::interp(GetValue const & getValue) +{ + auto model = main_solver->getModel(); + Logic & logic = *(this->logic); + std::vector> values; + for (auto const term : *getValue.terms) { + LetRecords tmp; + PTRef tr = parseTerm(*term, tmp); + if (tr != PTRef_Undef) { + values.emplace_back(opensmt::pair{tr, model->evaluate(tr)}); + auto pt_str = logic.printTerm(tr); + comment_formatted("Found the term %s", pt_str.c_str()); + } else + comment_formatted("Error parsing the term %s", printTermNode(*term).c_str()); + } + printf("("); + for (auto const & valPair : values) { + auto name = logic.printTerm(valPair.first); + auto value = logic.printTerm(valPair.second); + printf("(%s %s)", name.c_str(), value.c_str()); + } + printf(")\n"); +} + + /** * * @param tr the term to print @@ -808,32 +771,33 @@ void Interpret::writeState(std::string const & filename) } } -bool Interpret::declareFun(ASTNode const & n) // (const char* fname, const vec& args) + + +void Interpret::interp(DeclareFun const & n) // (const char* fname, const vec& args) { - assert(n.children->size() == 3); - ASTNode const & name_node = *(*n.children)[0]; - ASTNode const & args_node = *(*n.children)[1]; - ASTNode const & ret_node = *(*n.children)[2]; + SymbolNode const & name_node = *n.name; + auto const & args_vec = *n.argumentSorts; + SortNode const & ret_sort = *n.returnSort; - std::string const & fname = name_node.getValue(); + std::string const & fname = opensmt::nodeToString()(name_node); vec args; - SRef retSort = sortFromASTNode(ret_node); + SRef retSort = sortFromSortNode(ret_sort); if (retSort != SRef_Undef) { args.push(retSort); } else { - notify_formatted(true, "Unknown return sort %s of %s", sortSymbolFromASTNode(ret_node).name.c_str(), fname.c_str()); - return false; + notify_formatted(true, "Unknown return sort %s of %s", opensmt::nodeToString()(*ret_sort.identifier).c_str(), fname.c_str()); + return; } - for (auto const & childNode : *(args_node.children)) { - SRef argSort = sortFromASTNode(*childNode); + for (auto const childNode : args_vec) { + SRef argSort = sortFromSortNode(*childNode); if (argSort != SRef_Undef) { args.push(argSort); } else { - notify_formatted(true, "Undefined sort %s in function %s", sortSymbolFromASTNode(*childNode).name.c_str(), fname.c_str()); - return false; + notify_formatted(true, "Undefined sort %s in function %s", opensmt::nodeToString()(*childNode->identifier).c_str(), fname.c_str()); + return; } } @@ -847,59 +811,55 @@ bool Interpret::declareFun(ASTNode const & n) // (const char* fname, const vecsize() == 3); - ASTNode const & name_node = *(*n.children)[0]; - // n.children[1] is the args node, which is empty - ASTNode const & ret_node = *(*n.children)[2]; + auto const & name_node = *n.name; + auto const & ret_node = *n.sort; - std::string const & fname = name_node.getValue(); - SRef ret_sort = sortFromASTNode(ret_node); + std::string const & fname = opensmt::nodeToString()(name_node); + SRef ret_sort = sortFromSortNode(ret_node); if (ret_sort == SRef_Undef) { notify_formatted(true, "Failed to declare constant %s", fname.c_str()); - notify_formatted(true, "Unknown return sort %s of %s", sortSymbolFromASTNode(ret_node).name.c_str(), fname.c_str()); - return false; + notify_formatted(true, "Unknown return sort %s of %s", opensmt::nodeToString()(ret_node).c_str(), fname.c_str()); + return; } SymRef rval = logic->declareFun(fname, ret_sort, {}); if (rval == SymRef_Undef) { comment_formatted("Error while declare-const %s", fname.c_str()); - return false; + return; } user_declarations.push(rval); notify_success(); - return true; } -bool Interpret::defineFun(const ASTNode& n) -{ - assert(n.children->size() == 4); - - ASTNode const & name_node = *(*n.children)[0]; - ASTNode const & args_node = *(*n.children)[1]; - ASTNode const & ret_node = *(*n.children)[2]; - ASTNode const & term_node = *(*n.children)[3]; +void Interpret::interp(DefineFun const & n) { + if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic: define-fun"); + } + SymbolNode const & nameNode = *n.name; + auto const & argumentVector = *n.args; + SortNode const & returnSort = *n.returnSort; + TermNode const & termNode = *n.term; - std::string const & fname = name_node.getValue(); + std::string const & fname = opensmt::nodeToString()(nameNode); // Get the argument sorts vec arg_sorts; vec arg_trs; - for (auto const & childNode : *(args_node.children)) { - assert(childNode->children->size() == 1); - std::string varName = childNode->getValue(); - ASTNode const & sortNode = *(*childNode->children)[0]; - SRef sortRef = sortFromASTNode(sortNode); + for (auto const & sortedVar_p : argumentVector) { + std::string const & varName = opensmt::nodeToString()(*sortedVar_p->symbol); + SortNode const & sortNode = *sortedVar_p->sort; + SRef sortRef = sortFromSortNode(sortNode); if (sortRef == SRef_Undef) { - notify_formatted(true, "Undefined sort %s in function %s", sortSymbolFromASTNode(sortNode).name.c_str(), fname.c_str()); - return false; + notify_formatted(true, "Undefined sort %s in function %s", opensmt::nodeToString()(sortNode).c_str(), fname.c_str()); + return; } arg_sorts.push(sortRef); PTRef pvar = logic->mkVar(arg_sorts.last(), varName.c_str()); @@ -907,30 +867,29 @@ bool Interpret::defineFun(const ASTNode& n) } // The return sort - SRef ret_sort = sortFromASTNode(ret_node); + SRef ret_sort = sortFromSortNode(returnSort); if (ret_sort == SRef_Undef) { - notify_formatted(true, "Unknown return sort %s of %s", sortSymbolFromASTNode(ret_node).name.c_str(), fname.c_str()); - return false; + notify_formatted(true, "Unknown return sort %s of %s", opensmt::nodeToString()(returnSort).c_str(), fname.c_str()); + return; } sstat status; LetRecords letRecords; - PTRef tr = parseTerm(term_node, letRecords); + PTRef tr = parseTerm(termNode, letRecords); if (tr == PTRef_Undef) { notify_formatted(true, "define-fun returns an unknown sort"); - return false; + return; } else if (logic->getSortRef(tr) != ret_sort) { notify_formatted(true, "define-fun term and return sort do not match: %s and %s\n", logic->printSort(logic->getSortRef(tr)).c_str(), logic->printSort(ret_sort).c_str()); - return false; + return; } bool rval = storeDefinedFun(fname, arg_trs, ret_sort, tr); - if (rval) notify_success(); - else { + if (rval) { + notify_success(); + } else { notify_formatted(true, "define-fun failed"); - return false; + return; } - - return rval; } bool Interpret::storeDefinedFun(std::string const & fname, const vec & args, SRef ret_sort, const PTRef tr) { @@ -1137,9 +1096,10 @@ int Interpret::interpPipe() { if (rval != 0) notify_formatted(true, "scanner"); else { -// ASTNode const & r = context.getRoot(); -// execute(r); - done = f_exit; + for (auto command : context.getRoot()) { + if (rval == 0 and not f_exit) { interp(command); } + delete command; + } } free(buf_out); } @@ -1154,60 +1114,29 @@ int Interpret::interpPipe() { return 0; } -SortSymbol Interpret::sortSymbolFromASTNode(ASTNode const & node) { - auto type = node.getType(); - if (type == ASTType::SYM_T or type == ASTType::QSYM_T) { - return {node.getValue(), 0}; - } else { - assert(type == ASTType::LID_T and not node.children->empty()); - ASTNode const & name = *(*node.children)[0]; - return {name.getValue(), static_cast(node.children->size() - 1)}; - } -} - -SRef Interpret::sortFromASTNode(ASTNode const & node) const { - auto type = node.getType(); - if (type == ASTType::SYM_T or type == ASTType::QSYM_T) { - SortSymbol symbol(node.getValue(), 0); - SSymRef symRef; - bool known = logic->peekSortSymbol(symbol, symRef); - if (not known) { return SRef_Undef; } - return logic->getSort(symRef, {}); - } else { - assert(type == ASTType::LID_T and not node.children->empty()); - ASTNode const & name = *(*node.children)[0]; - SortSymbol symbol(name.getValue(), node.children->size() - 1); - SSymRef symRef; - bool known = logic->peekSortSymbol(symbol, symRef); - if (not known) { return SRef_Undef; } - vec args; - auto astArgs = opensmt::span(&(*node.children)[1], node.children->size()-1); - for (auto const & astArg : astArgs) { - SRef argSortRef = sortFromASTNode(*astArg); - if (argSortRef == SRef_Undef) { return SRef_Undef; } - args.push(argSortRef); - } - return logic->getSort(symRef, std::move(args)); - } - assert(type == ASTType::LID_T and not node.children->empty()); - ASTNode const & name = *(*node.children)[0]; - SortSymbol symbol(name.getValue(), node.children->size() - 1); +SRef Interpret::sortFromSortNode(SortNode const & node) const { + SortSymbol symbol(opensmt::nodeToString()(*node.identifier->symbol), node.sortList->size()); SSymRef symRef; bool known = logic->peekSortSymbol(symbol, symRef); if (not known) { return SRef_Undef; } vec args; - auto astSortArgs = opensmt::span(&(*node.children)[1], node.children->size()-1); - for (auto const & astSortArg : astSortArgs) { - SRef argSortRef = sortFromASTNode(*astSortArg); + for (auto const arg : *node.sortList) { + SRef argSortRef = sortFromSortNode(*arg); if (argSortRef == SRef_Undef) { return SRef_Undef; } args.push(argSortRef); } return logic->getSort(symRef, std::move(args)); } -void Interpret::getInterpolants(const ASTNode& n) -{ - auto const & exps = n.children; +void Interpret::interp(GetInterpolants const & n) { + if (not config.produce_inter()) { + notify_formatted(true, "Option to produce interpolants has not been set, skipping this command ..."); + return; + } else if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic: get-interpolants"); + return; + } + auto const & exps = n.configuration; vec grouping; // Consists of PTRefs that we want to group LetRecords letRecords; letRecords.pushFrame(); @@ -1222,7 +1151,7 @@ void Interpret::getInterpolants(const ASTNode& n) } letRecords.popFrame(); - if (!(config.produce_inter() > 0)) + if (not config.produce_inter()) throw OsmtApiException("Cannot interpolate"); assert(grouping.size() >= 2); diff --git a/src/api/Interpret.h b/src/api/Interpret.h index c290cc8f..d801873e 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -147,28 +147,20 @@ class Interpret { void initializeLogic(opensmt::Logic_t logicType); bool isInitialized() const { return logic != nullptr; } - void setInfo(std::string const & str); - void getInfo(AttributeNode const & n); - void setOption(AttributeNode const & n); - void getOption(AttributeNode const & n); void writeState(std::string const & fname); - bool declareFun(DeclareFun const & n); //(const char* fname, const vec& args); - bool declareConst(DeclareConst const & n); //(const char* fname, const SRef ret_sort); - bool defineFun(DefineFun const & n); - virtual sstat checkSat(); - void getValue(std::vector> const & term); - void getModel(); std::string printDefinitionSmtlib(PTRef tr, PTRef val); std::string printDefinitionSmtlib(const TemplateFunction &templateFun) const; - void push(int); - void pop(int); PTRef parseTerm(TermNode const & term, LetRecords& letRecords); + PTRef parseTerm(NormalTermNode const * term, LetRecords & letRecords); + PTRef parseTerm(LetTermNode const * term, LetRecords & letRecords); + PTRef parseTerm(ForallNode const * term, LetRecords & letRecords); + PTRef parseTerm(ExistsNode const * term, LetRecords & letRecords); + PTRef parseTerm(AnnotationNode const * term, LetRecords & letRecords); PTRef resolveTerm(const char* s, vec&& args, SRef sortRef = SRef_Undef, SymbolMatcher symbolMatcher = SymbolMatcher::Any); bool storeDefinedFun(std::string const & fname, const vec& args, SRef ret_sort, const PTRef tr); virtual void exit(); - void getInterpolants(TermNode const & n); void interp(CommandNode const * n); void interp(SetLogic const & n); void interp(SetInfo const & n); @@ -196,7 +188,8 @@ class Interpret { bool addLetFrame(std::vector> const & bindings, LetRecords& letRecords); PTRef letNameResolve(const char* s, const LetRecords& letRecords) const; - PTRef resolveQualifiedIdentifier(const char * name, SortNode const & sort, bool isQuoted); + PTRef resolveQualifiedIdentifier(std::string const & name, SortNode const & sort, bool isQuoted); + SRef sortFromSortNode(SortNode const & node) const; virtual std::unique_ptr createMainSolver(std::string const & logic_name); @@ -213,9 +206,6 @@ class Interpret { bool gotExit() const { return f_exit; } - ValPair getValue (PTRef tr) const; - bool getAssignment (); - void reportError(char const * msg) { notify_formatted(true, msg); } PTRef getParsedFormula(); diff --git a/src/bin/opensmt.cc b/src/bin/opensmt.cc index 5c4567b9..32e179bf 100644 --- a/src/bin/opensmt.cc +++ b/src/bin/opensmt.cc @@ -93,19 +93,17 @@ int main( int argc, char * argv[] ) break; case 'd': const char* msg; - c.setOption(SMTConfig::o_dryrun, SMTOption(true), msg); + c.setOption(SMTConfig::o_dryrun, SMTOption(true)); break; case 'r': - if (!c.setOption(SMTConfig::o_random_seed, SMTOption(atoi(optarg)), msg)) - fprintf(stderr, "Error setting random seed: %s\n", msg); - else - fprintf(stderr, "; Using random seed %d\n", atoi(optarg)); + c.setOption(SMTConfig::o_random_seed, SMTOption(atoi(optarg))); + fprintf(stderr, "; Using random seed %d\n", atoi(optarg)); break; case 'i': - c.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + c.setOption(SMTConfig::o_produce_inter, SMTOption(true)); break; case 'v': - c.setOption(SMTConfig::o_verbosity, SMTOption(true), msg); + c.setOption(SMTConfig::o_verbosity, SMTOption(true)); break; case 'p': pipe = true; diff --git a/src/options/SMTConfig.cc b/src/options/SMTConfig.cc index ac772e39..f5d04af8 100644 --- a/src/options/SMTConfig.cc +++ b/src/options/SMTConfig.cc @@ -33,22 +33,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //--------------------------------------------------------------------------------- // SMTConfig -bool SMTConfig::setOption(std::string const & name, const SMTOption& value, const char*& msg) { - msg = "ok"; +void SMTConfig::setOption(std::string const & name, const SMTOption& value) { if (usedForInitialization && isPreInitializationOption(name)) { - msg = "Option cannot be changed at this point"; - return false; + throw OsmtApiException("Option cannot be changed at this point"); } // Special options: // stats_out if (name == o_stats_out) { - if (value.getValue().type != ConstType::string) { msg = s_err_not_str; return false; } + if (value.type != ConstType::string) { throw OsmtApiException(s_err_not_str); } if (optionTable.find(name) == optionTable.end()) - stats_out.open(value.getValue().getStringVal(), std::ios_base::out); - else if (optionTable[name].getValue().getStringVal() != value.getValue().getStringVal()) { + stats_out.open(value.getStringVal(), std::ios_base::out); + else if (optionTable[name].getStringVal() != value.getStringVal()) { if (stats_out.is_open()) { stats_out.close(); - stats_out.open(value.getValue().getStringVal(), std::ios_base::out); + stats_out.open(value.getStringVal(), std::ios_base::out); } } else {} @@ -56,23 +54,23 @@ bool SMTConfig::setOption(std::string const & name, const SMTOption& value, cons // produce stats if (name == o_produce_stats) { - if (value.getValue().type != ConstType::boolean) { + if (value.type != ConstType::boolean) { throw OsmtApiException(s_err_not_bool); - } else if (value.getValue().getBoolVal()) { + } else if (value.getBoolVal()) { // Gets set to true if (optionTable.find(o_stats_out) == optionTable.end()) { - if (optionTable.find(o_produce_stats) == optionTable.end() || not optionTable[o_produce_stats].getValue().getBoolVal()) { + if (optionTable.find(o_produce_stats) == optionTable.end() || not optionTable[o_produce_stats].getBoolVal()) { // Insert the default value insertOption(o_stats_out, SMTOption("/dev/stdout")); - } else if (optionTable.find(o_produce_stats) != optionTable.end() and optionTable[o_produce_stats].getValue().getBoolVal()) { + } else if (optionTable.find(o_produce_stats) != optionTable.end() and optionTable[o_produce_stats].getBoolVal()) { assert(false); } } else { } // No action required - if (!stats_out.is_open()) stats_out.open(optionTable[o_stats_out].getValue().getStringVal(), std::ios_base::out); + if (!stats_out.is_open()) stats_out.open(optionTable[o_stats_out].getStringVal(), std::ios_base::out); } - else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats].getValue().getBoolVal()) { + else if (optionTable.find(o_produce_stats) != optionTable.end() && optionTable[o_produce_stats].getBoolVal()) { // gets set to false and was previously true if (optionTable.find(o_stats_out) != optionTable.end()) { stats_out.close(); @@ -81,23 +79,23 @@ bool SMTConfig::setOption(std::string const & name, const SMTOption& value, cons } if (name == o_random_seed) { - if (value.getValue().type != ConstType::numeral) { + if (value.type != ConstType::numeral) { throw OsmtApiException(s_err_not_num); } - uint32_t seed = value.getValue().getUint32Val(); + uint32_t seed = value.getUint32Val(); if (seed == 0) { throw OsmtApiException(s_err_seed_zero); } } if (name == o_sat_split_type) { - if (value.getValue().type != ConstType::string) { throw OsmtApiException(s_err_not_str); } - std::string val = value.getValue().getStringVal(); + if (value.type != ConstType::string) { throw OsmtApiException(s_err_not_str); } + std::string val = value.getStringVal(); if (val != spts_lookahead && val != spts_scatter && val != spts_none) { throw OsmtApiException(s_err_unknown_split); } } if (name == o_sat_split_units) { - if (value.getValue().type != ConstType::string) { throw OsmtApiException(s_err_not_str); } - std::string val = value.getValue().getStringVal(); + if (value.type != ConstType::string) { throw OsmtApiException(s_err_not_str); } + std::string val = value.getStringVal(); if (val != spts_time && val != spts_search_counter) { throw OsmtApiException(s_err_unknown_units); } @@ -107,7 +105,6 @@ bool SMTConfig::setOption(std::string const & name, const SMTOption& value, cons optionTable.erase(itr); } insertOption(name, SMTOption(value)); - return true; } const SMTOption& SMTConfig::getOption(std::string const & name) const { @@ -118,14 +115,14 @@ const SMTOption& SMTConfig::getOption(std::string const & name) const { return option_Empty; } -bool SMTConfig::setInfo(std::string && name_, SMTOption::ConfValue && value) { +bool SMTConfig::setInfo(std::string && name_, SMTOption && value) { if (infoTable.find(name_) != infoTable.end()) infoTable.erase(infoTable.find(name_)); infoTable.insert({name_, value}); return true; } -SMTOption::ConfValue SMTConfig::getInfo(std::string const & name) const { +SMTOption SMTConfig::getInfo(std::string const & name) const { if (infoTable.find(name) != infoTable.end()) return infoTable.at(name); else diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index a6178a56..4305508e 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -33,6 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "smt2tokens.h" #include "OsmtApiException.h" #include "OsmtInternalException.h" +#include "ParseNodePrinter.h" #include #include @@ -41,7 +42,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#include enum class ASTType { CMD_T , CMDL_T @@ -87,139 +87,107 @@ enum class ASTType { class SMTOption { - static std::string sexprToString(SExpr * root) { - struct QEl { SExpr * sexpr; int count; }; - std::vector childStrings; - std::vector stack; - stack.push_back({root, 0}); - while (not stack.empty()) { - auto & [sexpr, count] = stack.back(); - if (auto vec_p = std::get_if>>(&(*sexpr).data)) { - assert(*vec_p); - auto & vec = **vec_p; - if (vec.size() < count) { - stack.push_back({ vec[count], 0 }); - ++count; - continue; - } - // Vector, all children processed - assert(not childStrings.empty()); - auto childStringStart = childStrings.end() - vec.size(); - auto myString = std::accumulate(childStringStart, childStrings.end(), std::string(), - [](const std::string & a, const std::string & b) { - return a + b; - }); - childStrings.erase(childStringStart, childStrings.end()); - childStrings.emplace_back(std::move(myString)); - } else if (auto constNode = std::get_if>(&(*sexpr).data)) { - assert(*constNode); - childStrings.push_back(*(**constNode).value); - } else if (auto symbolNode = std::get_if>(&(*sexpr).data)) { - assert(*symbolNode); - childStrings.push_back((**symbolNode).getString()); - } else if (auto string = std::get_if>(&(*sexpr).data)) { - assert(*string); - childStrings.push_back(**string); - } - stack.pop_back(); + +public: + ConstType type = ConstType::empty; + std::variant value = 0; + + std::string toString() const { + if (auto val = std::get_if(&value)) { + return *val; + } else if (auto val = std::get_if(&value)) { + return std::to_string(*val); + } else if (auto val = std::get_if(&value)) { + return std::to_string(*val); + } else if (auto val = std::get_if(&value)) { + return std::to_string(*val); + } else if (auto val = std::get_if(&value)) { + return *val ? "true" : "false"; } - assert(childStrings.size() == 1); - return childStrings[0]; + assert(false); + return {}; } -public: - struct ConfValue { - ConstType type = ConstType::empty; - std::variant value = 0; - ConfValue() = default; - ConfValue(int i) : type(ConstType::numeral), value(i) {} - ConfValue(double i) : type(ConstType::decimal), value(i) {} - ConfValue(std::string && s) : type(ConstType::string), value(std::move(s)) {} - std::string getStringVal() const { - if (type == ConstType::string) { - auto val = std::get_if(&value); - assert(val); - return *val; - } - else { - throw OsmtApiException("Attempt to get string value of a non-string type"); - } + std::string getStringVal() const { + if (type == ConstType::string) { + auto val = std::get_if(&value); + assert(val); + return *val; } - double getDoubleVal() const { - if (type == ConstType::numeral) { - if (auto val = std::get_if(&value)) { - return static_cast(*val); - } else if (auto val = std::get_if(&value)) { - return static_cast(*val); - } else { - throw OsmtInternalException("Inconsistent value for option"); - } - } else if (type == ConstType::decimal) { - auto val = std::get_if(&value); - assert(val); - return *val; - } else { - throw OsmtApiException("Attempted to obtain double value for non-numeric type"); - } + else { + throw OsmtApiException("Attempt to get string value of a non-string type"); } - int getIntVal() const { - if (type == ConstType::numeral) { - auto val = std::get_if(&value); - assert(val); - return *val; + } + double getDoubleVal() const { + if (type == ConstType::numeral) { + if (auto val = std::get_if(&value)) { + return static_cast(*val); + } else if (auto val = std::get_if(&value)) { + return static_cast(*val); } else { - throw OsmtApiException("Attempted to obtain int value for non-int type"); + throw OsmtInternalException("Inconsistent value for option"); } + } else if (type == ConstType::decimal) { + auto val = std::get_if(&value); + assert(val); + return *val; + } else { + throw OsmtApiException("Attempted to obtain double value for non-numeric type"); } - uint32_t getUint32Val() const { - if (type == ConstType::uint32) { - auto val = std::get_if(&value); - assert(val); - return *val; - } else { - throw OsmtApiException("Attempted to obtain uint32 value for non-uint32 type"); - } + } + int getIntVal() const { + if (type == ConstType::numeral) { + auto val = std::get_if(&value); + assert(val); + return *val; + } else { + throw OsmtApiException("Attempted to obtain int value for non-int type"); } - bool getBoolVal() const { - if (type == ConstType::boolean) { - auto val = std::get_if(&value); - assert(val); - return *val; - } - else { - throw OsmtApiException("Attempt to obtain boolean value for non-boolean type"); - } + } + uint32_t getUint32Val() const { + if (type == ConstType::uint32) { + auto val = std::get_if(&value); + assert(val); + return *val; + } else { + throw OsmtApiException("Attempted to obtain uint32 value for non-uint32 type"); } - }; - - SMTOption(); + } + bool getBoolVal() const { + if (type == ConstType::boolean) { + auto val = std::get_if(&value); + assert(val); + return *val; + } + else { + throw OsmtApiException("Attempt to obtain boolean value for non-boolean type"); + } + } + SMTOption() = default; + SMTOption(int i) : type(ConstType::numeral), value(i) {} + SMTOption(uint32_t i) : type(ConstType::uint32), value(i) {} + SMTOption(double i) : type(ConstType::decimal), value(i) {} + SMTOption(std::string && s) : type(ConstType::string), value(std::move(s)) {} SMTOption(AttributeValueNode const & n) { if (auto specConst_p = std::get_if>(&n.value)) { auto const & specConst = (**specConst_p); - value.type = specConst.type; - value.value = *specConst.value; + type = specConst.type; + value = *specConst.value; } else if (auto symbol_p = std::get_if>(&n.value)) { auto const & symbol = (**symbol_p); - value.type = symbol.getType(); - value.value = symbol.getString(); + type = symbol.getType(); + value = opensmt::nodeToString()(symbol); } else if (auto sexprVec_p = std::get_if>>(&n.value)) { assert(sexprVec_p); - value.type = ConstType::sexpr; + type = ConstType::sexpr; auto const & sexprVec = **sexprVec_p; std::string s; for (SExpr * sexpr_p : sexprVec) { - s += "(" + sexprToString(sexpr_p)+ ")"; + s += "(" + opensmt::nodeToString()(sexpr_p) + ")"; } - value.value = s; + value = s; } } - SMTOption(int i) : value(i) {} - SMTOption(double i): value(i) {} - SMTOption(std::string && s) : value(std::move(s)) {} - inline bool isEmpty() const { return value.type == ConstType::empty; } -// inline std::string toString() const { return value.toString(); } - inline const ConfValue& getValue() const { return value; } - private: - ConfValue value; + inline bool isEmpty() const { return type == ConstType::empty; } }; // Type safe wrapper for split types @@ -385,7 +353,7 @@ struct SMTConfig SMTOption option_Empty; std::vector option_names; - std::unordered_map infoTable; + std::unordered_map infoTable; std::unordered_map optionTable; bool usedForInitialization = false; // Some options can be changed only before this config is used for initialization of MainSolver @@ -423,11 +391,11 @@ struct SMTConfig initializeConfig( ); } - bool setOption(std::string const & name, const SMTOption& value, const char*& msg); + void setOption(std::string const & name, SMTOption const & value); const SMTOption& getOption(std::string const & name) const; - bool setInfo (std::string && name, SMTOption::ConfValue && value); - SMTOption::ConfValue getInfo (std::string const & name) const; + bool setInfo(std::string && name, SMTOption && value); + SMTOption getInfo(std::string const & name) const; void initializeConfig ( ); @@ -436,18 +404,18 @@ struct SMTConfig void printHelp ( ); void printConfig ( std::ostream & out ); - inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed).getValue().getUint32Val(): 91648253; } + inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed).getUint32Val(): 91648253; } inline void setProduceModels( ) { insertOption(o_produce_models, SMTOption(1)); } inline bool setRandomSeed(int seed) { insertOption(o_random_seed, SMTOption(seed)); return true; } void setUsedForInitiliazation() { usedForInitialization = true; } inline bool produceProof( ) { - return optionTable.find(o_produce_proofs) != optionTable.end() ? optionTable[o_produce_proofs].getValue().getBoolVal() : false; + return optionTable.find(o_produce_proofs) != optionTable.end() ? optionTable[o_produce_proofs].getBoolVal() : false; } void setTimeQueries() { insertOption(o_time_queries, SMTOption(1)); } - bool timeQueries() { return optionTable.find(o_time_queries) != optionTable.end() ? optionTable[o_time_queries].getValue().getBoolVal() : false; } + bool timeQueries() { return optionTable.find(o_time_queries) != optionTable.end() ? optionTable[o_time_queries].getBoolVal() : false; } // Set reduction params inline void setReduction(int r) { insertOption(o_proof_reduce, SMTOption(r)); } @@ -469,185 +437,185 @@ struct SMTConfig // Get interpolation algorithms inline ItpAlgorithm getBooleanInterpolationAlgorithm() const { - return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg).getValue().getUint32Val()) + return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg).getUint32Val()) : ItpAlgorithm::itp_alg_mcmillan; } inline ItpAlgorithm getEUFInterpolationAlgorithm() const { - return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg).getValue().getUint32Val()) + return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg).getUint32Val()) : ItpAlgorithm::itp_euf_alg_strong; } inline ItpAlgorithm getLRAInterpolationAlgorithm() const { - return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg).getValue().getUint32Val()) + return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg).getUint32Val()) : ItpAlgorithm::itp_lra_alg_strong; } inline std::string getLRAStrengthFactor() const { return optionTable.find(o_itp_lra_factor) != optionTable.end() ? optionTable.at( - o_itp_lra_factor).getValue().getStringVal() : itp_lra_factor_0; + o_itp_lra_factor).getStringVal() : itp_lra_factor_0; } inline std::string getInstanceName() const { - return optionTable.find(o_inst_name) != optionTable.end() ? optionTable.at(o_inst_name).getValue().getStringVal() : "unknown"; + return optionTable.find(o_inst_name) != optionTable.end() ? optionTable.at(o_inst_name).getStringVal() : "unknown"; } lbool status; // Status of the benchmark // int incremental; // Incremental solving bool isIncremental() const { return optionTable.find(o_incremental) != optionTable.end() ? - optionTable.at(o_incremental).getValue().getBoolVal() : true; + optionTable.at(o_incremental).getBoolVal() : true; } bool produce_models() const { return optionTable.find(o_produce_models) != optionTable.end() ? - optionTable.at(o_produce_models).getValue().getBoolVal() : true; + optionTable.at(o_produce_models).getBoolVal() : true; } bool produceStats() const { return optionTable.find(o_produce_stats) != optionTable.end() && - optionTable.at(o_produce_stats).getValue().getBoolVal(); } + optionTable.at(o_produce_stats).getBoolVal(); } std::string getStatsOut() const { - return optionTable.find(o_stats_out) != optionTable.end() ? optionTable.at(o_stats_out).getValue().getStringVal() : "/dev/stdout"; + return optionTable.find(o_stats_out) != optionTable.end() ? optionTable.at(o_stats_out).getStringVal() : "/dev/stdout"; } int sat_grow() const { return optionTable.find(o_grow) != optionTable.end() ? - optionTable.at(o_grow).getValue().getBoolVal() : 0; } + optionTable.at(o_grow).getBoolVal() : 0; } int sat_clause_lim() const { return optionTable.find(o_clause_lim) != optionTable.end() ? - optionTable.at(o_clause_lim).getValue().getUint32Val() : 20; } + optionTable.at(o_clause_lim).getUint32Val() : 20; } int sat_subsumption_lim() const { return optionTable.find(o_subsumption_lim) != optionTable.end() ? - optionTable.at(o_subsumption_lim).getValue().getUint32Val() : 1000; } + optionTable.at(o_subsumption_lim).getUint32Val() : 1000; } double sat_simp_garbage_frac() const { return optionTable.find(o_simp_garbage_frac) != optionTable.end() ? - optionTable.at(o_simp_garbage_frac).getValue().getDoubleVal() : 0.5; } + optionTable.at(o_simp_garbage_frac).getDoubleVal() : 0.5; } int sat_use_asymm() const { return optionTable.find(o_use_asymm) != optionTable.end() ? - optionTable.at(o_use_asymm).getValue().getBoolVal() : false; } + optionTable.at(o_use_asymm).getBoolVal() : false; } int sat_use_rcheck() const { return optionTable.find(o_use_rcheck) != optionTable.end() ? - optionTable.at(o_use_rcheck).getValue().getBoolVal() : false; + optionTable.at(o_use_rcheck).getBoolVal() : false; } int sat_use_elim() const { return optionTable.find(o_use_elim) != optionTable.end() ? - optionTable.at(o_use_elim).getValue().getBoolVal() : true; + optionTable.at(o_use_elim).getBoolVal() : true; } double sat_var_decay() const { return optionTable.find(o_var_decay) != optionTable.end() ? - optionTable.at(o_var_decay).getValue().getDoubleVal() : 1 / 0.95; } + optionTable.at(o_var_decay).getDoubleVal() : 1 / 0.95; } double sat_clause_decay() const { return optionTable.find(o_clause_decay) != optionTable.end() ? - optionTable.at(o_clause_decay).getValue().getDoubleVal() : 1 / 0.999; } + optionTable.at(o_clause_decay).getDoubleVal() : 1 / 0.999; } double sat_random_var_freq() const { return optionTable.find(o_random_var_freq) != optionTable.end() ? - optionTable.at(o_random_var_freq).getValue().getDoubleVal() : 0.02; } + optionTable.at(o_random_var_freq).getDoubleVal() : 0.02; } uint32_t sat_random_seed() const { return optionTable.find(o_random_seed) != optionTable.end() ? - optionTable.at(o_random_seed).getValue().getUint32Val() : 91648253; } + optionTable.at(o_random_seed).getUint32Val() : 91648253; } bool sat_luby_restart() const { return optionTable.find(o_luby_restart) != optionTable.end() ? - optionTable.at(o_luby_restart).getValue().getBoolVal() : true; + optionTable.at(o_luby_restart).getBoolVal() : true; } uint32_t sat_ccmin_mode() const { return optionTable.find(o_ccmin_mode) != optionTable.end() ? - optionTable.at(o_ccmin_mode).getValue().getUint32Val() : 2; + optionTable.at(o_ccmin_mode).getUint32Val() : 2; } bool sat_rnd_pol() const { return optionTable.find(o_rnd_pol) != optionTable.end() ? - optionTable.at(o_rnd_pol).getValue().getBoolVal() : false; + optionTable.at(o_rnd_pol).getBoolVal() : false; } bool sat_rnd_init_act() const { return optionTable.find(o_rnd_init_act) != optionTable.end() ? - optionTable.at(o_rnd_init_act).getValue().getBoolVal() : false; } + optionTable.at(o_rnd_init_act).getBoolVal() : false; } double sat_garbage_frac() const { return optionTable.find(o_garbage_frac) != optionTable.end() ? - optionTable.at(o_garbage_frac).getValue().getDoubleVal() : 0.20; + optionTable.at(o_garbage_frac).getDoubleVal() : 0.20; } uint32_t sat_restart_first() const { return optionTable.find(o_restart_first) != optionTable.end() ? - optionTable.at(o_restart_first).getValue().getUint32Val() : 100; } + optionTable.at(o_restart_first).getUint32Val() : 100; } double sat_restart_inc() const { return optionTable.find(o_restart_inc) != optionTable.end() ? - optionTable.at(o_restart_inc).getValue().getDoubleVal() : 1.1; + optionTable.at(o_restart_inc).getDoubleVal() : 1.1; } int proof_interpolant_cnf() const { return optionTable.find(o_interpolant_cnf) != optionTable.end() ? - optionTable.at(o_interpolant_cnf).getValue().getBoolVal() : false; + optionTable.at(o_interpolant_cnf).getBoolVal() : false; } int certify_inter() const { return optionTable.find(o_certify_inter) != optionTable.end() ? - optionTable.at(o_certify_inter).getValue().getBoolVal(): false; + optionTable.at(o_certify_inter).getBoolVal(): false; } bool produce_inter() const { return optionTable.find(o_produce_inter) != optionTable.end() ? - optionTable.at(o_produce_inter).getValue().getBoolVal() : false; + optionTable.at(o_produce_inter).getBoolVal() : false; } uint32_t simplify_inter() const { return optionTable.find(o_simplify_inter) != optionTable.end() ? - optionTable.at(o_simplify_inter).getValue().getUint32Val() : false; + optionTable.at(o_simplify_inter).getUint32Val() : false; } bool proof_struct_hash() const { return optionTable.find(o_proof_struct_hash) != optionTable.end() ? - optionTable.at(o_proof_struct_hash).getValue().getBoolVal() : true; + optionTable.at(o_proof_struct_hash).getBoolVal() : true; } uint32_t proof_num_graph_traversals() const { return optionTable.find(o_proof_num_graph_traversals) != optionTable.end() ? - optionTable.at(o_proof_num_graph_traversals).getValue().getUint32Val() : 3; } + optionTable.at(o_proof_num_graph_traversals).getUint32Val() : 3; } uint32_t proof_red_trans() const { return optionTable.find(o_proof_red_trans) != optionTable.end() ? - optionTable.at(o_proof_red_trans).getValue().getUint32Val() : 2; + optionTable.at(o_proof_red_trans).getUint32Val() : 2; } bool proof_rec_piv() const { return optionTable.find(o_proof_rec_piv) != optionTable.end() ? - optionTable.at(o_proof_rec_piv).getValue().getBoolVal() : true; + optionTable.at(o_proof_rec_piv).getBoolVal() : true; } bool proof_push_units() const { return optionTable.find(o_proof_push_units) != optionTable.end() ? - optionTable.at(o_proof_push_units).getValue().getBoolVal() : true; + optionTable.at(o_proof_push_units).getBoolVal() : true; } bool proof_transf_trav() const { return optionTable.find(o_proof_transf_trav) != optionTable.end() ? - optionTable.at(o_proof_transf_trav).getValue().getBoolVal() : true; + optionTable.at(o_proof_transf_trav).getBoolVal() : true; } bool proof_check() const { return optionTable.find(o_proof_check) != optionTable.end() ? - optionTable.at(o_proof_check).getValue().getBoolVal() : true; + optionTable.at(o_proof_check).getBoolVal() : true; } bool proof_multiple_inter() const { return optionTable.find(o_proof_multiple_inter) != optionTable.end() ? - optionTable.at(o_proof_multiple_inter).getValue().getBoolVal() : true; + optionTable.at(o_proof_multiple_inter).getBoolVal() : true; } bool proof_alternative_inter() const { return optionTable.find(o_proof_alternative_inter) != optionTable.end() ? - optionTable.at(o_proof_alternative_inter).getValue().getBoolVal() : false; + optionTable.at(o_proof_alternative_inter).getBoolVal() : false; } bool proof_reduce() const { return optionTable.find(o_proof_reduce) != optionTable.end() ? - optionTable.at(o_proof_reduce).getValue().getBoolVal() : false; + optionTable.at(o_proof_reduce).getBoolVal() : false; } uint32_t itp_bool_alg() const { return optionTable.find(o_itp_bool_alg) != optionTable.end() ? - optionTable.at(o_itp_bool_alg).getValue().getUint32Val() : 0; + optionTable.at(o_itp_bool_alg).getUint32Val() : 0; } uint32_t itp_euf_alg() const { return optionTable.find(o_itp_euf_alg) != optionTable.end() ? - optionTable.at(o_itp_euf_alg).getValue().getUint32Val() : 0; + optionTable.at(o_itp_euf_alg).getUint32Val() : 0; } uint32_t itp_lra_alg() const { return optionTable.find(o_itp_lra_alg) != optionTable.end() ? - optionTable.at(o_itp_lra_alg).getValue().getUint32Val() : 0; } + optionTable.at(o_itp_lra_alg).getUint32Val() : 0; } uint32_t sat_dump_rnd_inter() const { return optionTable.find(o_sat_dump_rnd_inter) != optionTable.end() ? - optionTable.at(o_sat_dump_rnd_inter).getValue().getUint32Val() : 2; } + optionTable.at(o_sat_dump_rnd_inter).getUint32Val() : 2; } bool declarations_are_global() const { return optionTable.find(o_global_declarations) != optionTable.end() ? - optionTable.at(o_global_declarations).getValue().getBoolVal() : false; + optionTable.at(o_global_declarations).getBoolVal() : false; } SpUnit sat_resource_units() const { if (optionTable.find(o_sat_resource_units) != optionTable.end()) { - std::string type = optionTable.at(o_sat_resource_units).getValue().getStringVal(); + std::string type = optionTable.at(o_sat_resource_units).getStringVal(); if (type == spts_search_counter) { return SpUnit::search_counter; } else if (type == spts_time) { @@ -659,29 +627,29 @@ struct SMTConfig bool respect_logic_partitioning_hints() const { return optionTable.find(o_respect_logic_partitioning_hints) != optionTable.end() ? - optionTable.at(o_respect_logic_partitioning_hints).getValue().getBoolVal() : false; + optionTable.at(o_respect_logic_partitioning_hints).getBoolVal() : false; } double sat_resource_limit() const { return optionTable.find(o_sat_resource_limit) != optionTable.end() ? - optionTable.at(o_sat_resource_limit).getValue().getDoubleVal() : -1; + optionTable.at(o_sat_resource_limit).getDoubleVal() : -1; } std::string dump_state() const { if (optionTable.find(o_dump_state) != optionTable.end()) { - return append_output_dir(optionTable.at(o_dump_state).getValue().getStringVal()); + return append_output_dir(optionTable.at(o_dump_state).getStringVal()); } else { std::string name = getInstanceName(); return name.substr(0, name.size() - strlen(".smt2")); } } std::string output_dir() const { - return optionTable.find(o_output_dir) != optionTable.end() ? optionTable.at(o_output_dir).getValue().getStringVal() : ""; + return optionTable.find(o_output_dir) != optionTable.end() ? optionTable.at(o_output_dir).getStringVal() : ""; } bool dump_only() const { - return optionTable.find(o_dump_only) != optionTable.end() ? optionTable.at(o_dump_only).getValue().getBoolVal(): false; + return optionTable.find(o_dump_only) != optionTable.end() ? optionTable.at(o_dump_only).getBoolVal(): false; } bool dump_query() const { - return optionTable.find(o_dump_query) != optionTable.end() ? optionTable.at(o_dump_query).getValue().getBoolVal() : false; + return optionTable.find(o_dump_query) != optionTable.end() ? optionTable.at(o_dump_query).getBoolVal() : false; } void set_dump_query_name(std::string && dump_query_name) { @@ -695,16 +663,16 @@ struct SMTConfig std::string dump_query_name() const { return optionTable.find(o_dump_query_name) != optionTable.end() ? - append_output_dir(optionTable.at(o_dump_query_name).getValue().getStringVal()) : ""; + append_output_dir(optionTable.at(o_dump_query_name).getStringVal()) : ""; } bool sat_dump_learnts() const { return optionTable.find(o_sat_dump_learnts) != optionTable.end() ? - optionTable.at(o_sat_dump_learnts).getValue().getBoolVal() : false; } + optionTable.at(o_sat_dump_learnts).getBoolVal() : false; } bool sat_split_test_cube_and_conquer() const { return optionTable.find(o_sat_split_test_cube_and_conquer) != optionTable.end() ? - optionTable.at(o_sat_split_test_cube_and_conquer).getValue().getBoolVal() : false; + optionTable.at(o_sat_split_test_cube_and_conquer).getBoolVal() : false; } SpType sat_split_type() const { @@ -719,7 +687,7 @@ struct SMTConfig SpUnit sat_split_units() const { if (optionTable.find(o_sat_split_units) != optionTable.end()) { - std::string type = optionTable.at(o_sat_split_units).getValue().getStringVal(); + std::string type = optionTable.at(o_sat_split_units).getStringVal(); if (type == spts_search_counter) { return SpUnit::search_counter; } else if (type == spts_time) { @@ -731,74 +699,74 @@ struct SMTConfig double sat_split_inittune() const { return optionTable.find(o_sat_split_inittune) != optionTable.end() ? - optionTable.at(o_sat_split_inittune).getValue().getDoubleVal() : + optionTable.at(o_sat_split_inittune).getDoubleVal() : -1; } double sat_split_midtune() const { return optionTable.find(o_sat_split_midtune) != optionTable.end() ? - optionTable.at(o_sat_split_midtune).getValue().getDoubleVal() : + optionTable.at(o_sat_split_midtune).getDoubleVal() : -1; } uint32_t sat_split_num() const { return optionTable.find(o_sat_split_num) != optionTable.end() ? - optionTable.at(o_sat_split_num).getValue().getUint32Val() : + optionTable.at(o_sat_split_num).getUint32Val() : 2; } int sat_split_fixvars() const { return optionTable.find(o_sat_split_fix_vars) != optionTable.end() ? - optionTable.at(o_sat_split_fix_vars).getValue().getIntVal() : + optionTable.at(o_sat_split_fix_vars).getIntVal() : -1; } bool sat_split_asap() const { return optionTable.find(o_sat_split_asap) != optionTable.end() ? - optionTable.at(o_sat_split_asap).getValue().getBoolVal(): + optionTable.at(o_sat_split_asap).getBoolVal(): false; } bool sat_lookahead_split() const { return optionTable.find(o_sat_lookahead_split) != optionTable.end() ? - optionTable.at(o_sat_lookahead_split).getValue().getBoolVal(): + optionTable.at(o_sat_lookahead_split).getBoolVal(): false; } bool sat_scatter_split() const { return optionTable.find(o_sat_scatter_split) != optionTable.end() ? - optionTable.at(o_sat_scatter_split).getValue().getBoolVal() : + optionTable.at(o_sat_scatter_split).getBoolVal() : false; } bool sat_pure_lookahead() const { return optionTable.find(o_sat_pure_lookahead) != optionTable.end() ? - optionTable.at(o_sat_pure_lookahead).getValue().getBoolVal() : + optionTable.at(o_sat_pure_lookahead).getBoolVal() : false; } bool lookahead_score_deep() const { return optionTable.find(o_lookahead_score_deep) != optionTable.end() ? - optionTable.at(o_lookahead_score_deep).getValue().getBoolVal() : + optionTable.at(o_lookahead_score_deep).getBoolVal() : false; } bool randomize_lookahead() const { return optionTable.find(o_sat_split_randomize_lookahead) != optionTable.end() ? - optionTable.at(o_sat_split_randomize_lookahead).getValue().getBoolVal() : + optionTable.at(o_sat_split_randomize_lookahead).getBoolVal() : false; } uint32_t randomize_lookahead_bufsz() const { return optionTable.find(o_sat_split_randomize_lookahead_buf) != optionTable.end() ? - optionTable.at(o_sat_split_randomize_lookahead_buf).getValue().getUint32Val() : + optionTable.at(o_sat_split_randomize_lookahead_buf).getUint32Val() : true; } bool remove_symmetries() const { return optionTable.find(o_sat_remove_symmetries) != optionTable.end() ? - optionTable.at(o_sat_remove_symmetries).getValue().getBoolVal() : false; } + optionTable.at(o_sat_remove_symmetries).getBoolVal() : false; } bool dryrun() const { return optionTable.find(o_dryrun) != optionTable.end() ? - optionTable.at(o_dryrun).getValue().getBoolVal() : false; } + optionTable.at(o_dryrun).getBoolVal() : false; } void set_dryrun(bool b) { insertOption(o_dryrun, SMTOption(b)); } SpPref sat_split_preference() const { if (optionTable.find(o_sat_split_preference) != optionTable.end()) { - std::string type = optionTable.at(o_sat_split_preference).getValue().getStringVal(); + std::string type = optionTable.at(o_sat_split_preference).getStringVal(); if (type == spprefs_tterm) return sppref_tterm; if (type == spprefs_blind) return sppref_blind; if (type == spprefs_bterm) return sppref_bterm; @@ -812,24 +780,24 @@ struct SMTConfig bool use_ghost_vars() const { return optionTable.find(o_ghost_vars) != optionTable.end() ? - optionTable.at(o_ghost_vars).getValue().getBoolVal() : + optionTable.at(o_ghost_vars).getBoolVal() : false; } bool do_substitutions() const { return optionTable.find(o_do_substitutions) != optionTable.end()? - optionTable.at(o_do_substitutions).getValue().getBoolVal() : true; } + optionTable.at(o_do_substitutions).getBoolVal() : true; } bool use_theory_polarity_suggestion() const { return sat_theory_polarity_suggestion != 0; } uint32_t sat_solver_limit() const { return optionTable.find(o_sat_solver_limit) != optionTable.end() ? - optionTable.at(o_sat_solver_limit).getValue().getUint32Val() : 0; } + optionTable.at(o_sat_solver_limit).getUint32Val() : 0; } bool sat_split_mode() const { return optionTable.find(o_sat_split_mode) != optionTable.end() ? - optionTable.at(o_sat_split_mode).getValue().getBoolVal() : + optionTable.at(o_sat_split_mode).getBoolVal() : false; } @@ -842,11 +810,11 @@ struct SMTConfig int dump_formula; // Dump input formula bool verbosity() const { // Verbosity level return optionTable.find(o_verbosity) != optionTable.end() ? - optionTable.at(o_verbosity).getValue().getBoolVal() : false; + optionTable.at(o_verbosity).getBoolVal() : false; } bool printSuccess() const { return optionTable.find(":print-success") != optionTable.end() ? - optionTable.at(":print-success").getValue().getBoolVal() : false; + optionTable.at(":print-success").getBoolVal() : false; } int certification_level; // Level of certification char certifying_solver[256]; // Executable used for certification @@ -918,7 +886,7 @@ struct SMTConfig void setSimplifyInterpolant(int val) { const char* msg; - setOption(o_simplify_inter, SMTOption(val), msg); + setOption(o_simplify_inter, SMTOption(val)); } int getSimplifyInterpolant() const { diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index edb73a28..d919bd95 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -55,15 +55,7 @@ struct SpecConstNode : public GeneralNode { struct SymbolNode : public GeneralNode { std::variant,std::unique_ptr> name; - std::string getString() const { - if (auto str = std::get_if>(&name)) { - return {**str}; - } else if (auto specConstNode = std::get_if>(&name)) { - return {*(**specConstNode).value}; - } - assert(false); - return {}; - } + ConstType getType() const { if (std::get_if>(&name)) { return ConstType::string; @@ -107,6 +99,7 @@ struct SExpr : public GeneralNode { }; struct AttributeValueNode : public GeneralNode { + // Todo: Why do we need SpecConstNode if we have SymbolNode that can also be SpecConstNode? std::variant, std::unique_ptr, std::unique_ptr>> value; AttributeValueNode(std::unique_ptr && node) : value(std::move(node)) {} AttributeValueNode(std::unique_ptr && node) : value(std::move(node)) {} @@ -134,21 +127,27 @@ struct IdentifierNode : public GeneralNode { class OptionNode : public GeneralNode { public: - virtual ~OptionNode() = default; -}; - -struct PrintSuccess : public OptionNode { bool value; PrintSuccess(bool value) : value(value) {} }; -struct ExpandDefinitions : public OptionNode { bool value; ExpandDefinitions(bool value) : value(value) {} }; -struct InteractiveMode : public OptionNode { bool value; InteractiveMode(bool value) : value(value) {} }; -struct ProduceProofs : public OptionNode { bool value; ProduceProofs(bool value) : value(value) {} }; -struct ProduceUnsatCores : public OptionNode { bool value; ProduceUnsatCores(bool value) : value(value) {} }; -struct ProduceModels : public OptionNode { bool value; ProduceModels(bool value) : value(value) {} }; -struct ProduceAssignments : public OptionNode { bool value; ProduceAssignments(bool value): value(value) {} }; -struct RegularOutputChannel : public OptionNode { std::unique_ptr value; RegularOutputChannel(std::unique_ptr && value) : value(std::move(value)) {} }; -struct DiagnosticOutputChannel : public OptionNode { std::unique_ptr value; DiagnosticOutputChannel(std::unique_ptr && value) : value(std::move(value)) {} }; -struct RandomSeed : public OptionNode { int value; RandomSeed(int value) : value(value) {} }; -struct Verbosity : public OptionNode { int value; Verbosity(int value) : value(value) {} }; -struct Attribute : public OptionNode { std::unique_ptr value; Attribute(std::unique_ptr && value) : value(std::move(value)) {} }; + enum class OptionType { + Attribute, + DiagnosticOutputChannel, + ExpandDefinitions, + InteractiveMode, + PrintSuccess, + ProduceAssignments, + ProduceModels, + ProduceProofs, + ProduceUnsatCores, + RandomSeed, + RegularOutputChannel, + Verbosity, + }; + std::variant,std::unique_ptr> value; + OptionType type; + OptionNode(OptionType type, bool value) : type(type), value(value) {} + OptionNode(OptionType type, uint32_t value) : type(type), value(value) {} + OptionNode(OptionType type, std::unique_ptr && value) : type(type), value(std::move(value)) {} + OptionNode(OptionType type, std::unique_ptr && value) : type(type), value(std::move(value)) {} +}; // Note: classes derived from CommandNodes need to have a constructor because they need to be destructible as CommandNodes. // In particular, CommandNode needs to have a virtual member function (destructor), which forbids aggregate initialization. @@ -262,10 +261,9 @@ struct DeclareFun : public CommandNode { }; struct DeclareConst : public CommandNode { - std::variant,std::unique_ptr> name; + std::unique_ptr name; std::unique_ptr sort; DeclareConst(std::unique_ptr && name, std::unique_ptr && sort) : name(std::move(name)), sort(std::move(sort)) {} - DeclareConst(std::unique_ptr && name, std::unique_ptr && sort) : name(std::move(name)), sort(std::move(sort)) {} }; struct SortedVarNode : public GeneralNode { diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index 7c0fe9ad..d11f3c3f 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -60,11 +60,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "smt2newcontext.h" #include "smt2tokens.h" -using ASTNode_up = std::unique_ptr; -using ASTVec = std::vector; -using ASTVec_up = std::unique_ptr; -using string_up = std::unique_ptr; - std::unique_ptr mkUniqueStr(std::string const & s) { return std::make_unique(s); } @@ -400,29 +395,29 @@ b_value: symbol ; option: KW_PRINTSUCCESS b_value - { $$ = new PrintSuccess {$2}; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::PrintSuccess, $2}; delete $1; } | KW_EXPANDDEFINITIONS b_value - { $$ = new ExpandDefinitions {$2}; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::ExpandDefinitions, $2}; delete $1; } | KW_INTERACTIVEMODE b_value - { $$ = new InteractiveMode {$2}; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::InteractiveMode, $2}; delete $1; } | KW_PRODUCEPROOFS b_value - { $$ = new ProduceProofs {$2}; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::ProduceProofs, $2}; delete $1; } | KW_PRODUCEUNSATCORES b_value - { $$ = new ProduceUnsatCores {$2}; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::ProduceUnsatCores, $2}; delete $1; } | KW_PRODUCEMODELS b_value - { $$ = new ProduceModels {$2}; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::ProduceModels, $2}; delete $1; } | KW_PRODUCEASSIGNMENTS b_value - { $$ = new ProduceAssignments {$2}; delete $1;} + { $$ = new OptionNode {OptionNode::OptionType::ProduceAssignments, $2}; delete $1;} | KW_REGULAROUTPUTCHANNEL TK_STR - { $$ = new RegularOutputChannel {std::unique_ptr($2)}; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::RegularOutputChannel, std::unique_ptr($2)}; delete $1; } | KW_DIAGNOSTICOUTPUTCHANNEL TK_STR - { $$ = new DiagnosticOutputChannel {std::unique_ptr($2)}; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::DiagnosticOutputChannel, std::unique_ptr($2)}; delete $1; } | KW_RANDOMSEED TK_NUM - { $$ = new RandomSeed { std::stoi(*$2) }; delete $2; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::RandomSeed, static_cast(std::stoi(*$2)) }; delete $2; delete $1; } | KW_VERBOSITY TK_NUM - { $$ = new Verbosity { std::stoi(*$2) }; delete $2; delete $1; } + { $$ = new OptionNode {OptionNode::OptionType::Verbosity, static_cast(std::stoi(*$2)) }; delete $2; delete $1; } | attribute - { $$ = new Attribute { std::unique_ptr($1) }; } + { $$ = new OptionNode {OptionNode::OptionType::Attribute, std::unique_ptr($1) }; } ; predef_key: KW_SORTS From 5c3882a66b06dc517e81b357c1423cdbd3f477dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 11:35:40 +0100 Subject: [PATCH 72/94] Itp-regression: Use boolean valued flags --- ...ocksynchro_3clocks.worst_case_skew.induct_delta_1.smt2 | 2 +- regression_itp/LIA/lia_itp_split.smt2 | 2 +- regression_itp/LIA/lia_itp_test.smt2 | 2 +- regression_itp/LIA/lia_itp_test2.smt2 | 2 +- regression_itp/LIA/lia_itp_test3.smt2 | 2 +- regression_itp/bug_mask_ite.smt2 | 4 ++-- regression_itp/bug_mask_ite_nested.smt2 | 4 ++-- regression_itp/dec-far1.smt2 | 2 +- regression_itp/dec-far2.smt2 | 2 +- regression_itp/distinct_unsat.smt2 | 4 ++-- regression_itp/incremental/inc_itp_theory_prop.smt2 | 2 +- regression_itp/incremental/incremental_itp.smt2 | 2 +- regression_itp/incremental/incremental_itp2.smt2 | 2 +- regression_itp/incremental/incremental_itp3.smt2 | 2 +- regression_itp/incremental/incremental_itp4.smt2 | 2 +- regression_itp/incremental/incremental_itp5.smt2 | 2 +- regression_itp/incremental/issue152_itp.smt2 | 2 +- regression_itp/incremental/lia_splits.smt2 | 2 +- regression_itp/incremental/lia_splits2.smt2 | 2 +- regression_itp/itp_bug.smt2 | 4 ++-- regression_itp/itp_bug_small.smt2 | 4 ++-- regression_itp/part_bug.smt2 | 4 ++-- regression_itp/preint-options.smt2 | 2 +- regression_itp/proof_duplicate_literals.smt2 | 8 ++++---- regression_itp/trivial-proof-A.smt2 | 4 ++-- regression_itp/trivial-proof-B.smt2 | 4 ++-- regression_itp/uf-itp-edge-split.smt2 | 4 ++-- regression_itp/uf_bug.smt2 | 4 ++-- regression_itp/uf_duplicates.smt2 | 4 ++-- regression_itp/uf_itp_problem.smt2 | 2 +- regression_itp/uf_local_colors_insufficient.smt2 | 4 ++-- 31 files changed, 46 insertions(+), 46 deletions(-) diff --git a/regression/QF_LRA/clocksynchro_3clocks.worst_case_skew.induct_delta_1.smt2 b/regression/QF_LRA/clocksynchro_3clocks.worst_case_skew.induct_delta_1.smt2 index 94f3c0ea..e684be3f 100644 --- a/regression/QF_LRA/clocksynchro_3clocks.worst_case_skew.induct_delta_1.smt2 +++ b/regression/QF_LRA/clocksynchro_3clocks.worst_case_skew.induct_delta_1.smt2 @@ -1,4 +1,4 @@ -(set-option :ghost-vars 1) +(set-option :ghost-vars true) (set-logic QF_LRA) (declare-fun v17 () Real) (declare-fun v23 () Real) diff --git a/regression_itp/LIA/lia_itp_split.smt2 b/regression_itp/LIA/lia_itp_split.smt2 index ac4b8f0b..1600b6b4 100644 --- a/regression_itp/LIA/lia_itp_split.smt2 +++ b/regression_itp/LIA/lia_itp_split.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LIA) (declare-fun x () Int) (declare-fun y () Int) diff --git a/regression_itp/LIA/lia_itp_test.smt2 b/regression_itp/LIA/lia_itp_test.smt2 index 33e76b9b..d5042862 100644 --- a/regression_itp/LIA/lia_itp_test.smt2 +++ b/regression_itp/LIA/lia_itp_test.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LIA) (declare-fun x () Int) (declare-fun y () Int) diff --git a/regression_itp/LIA/lia_itp_test2.smt2 b/regression_itp/LIA/lia_itp_test2.smt2 index ca7eafc4..c3fa422d 100644 --- a/regression_itp/LIA/lia_itp_test2.smt2 +++ b/regression_itp/LIA/lia_itp_test2.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LIA) (declare-fun x () Int) (declare-fun y () Int) diff --git a/regression_itp/LIA/lia_itp_test3.smt2 b/regression_itp/LIA/lia_itp_test3.smt2 index 791783c1..c30aab9a 100644 --- a/regression_itp/LIA/lia_itp_test3.smt2 +++ b/regression_itp/LIA/lia_itp_test3.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LIA) (declare-fun x () Int) (declare-fun y () Int) diff --git a/regression_itp/bug_mask_ite.smt2 b/regression_itp/bug_mask_ite.smt2 index a0cda071..d7f5f7b8 100644 --- a/regression_itp/bug_mask_ite.smt2 +++ b/regression_itp/bug_mask_ite.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_LRA) (declare-fun x () Real) diff --git a/regression_itp/bug_mask_ite_nested.smt2 b/regression_itp/bug_mask_ite_nested.smt2 index 98ec3e86..968bbe93 100644 --- a/regression_itp/bug_mask_ite_nested.smt2 +++ b/regression_itp/bug_mask_ite_nested.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_LRA) (declare-fun |state::state.pc| () Real) (declare-fun |state::state.old| () Real) diff --git a/regression_itp/dec-far1.smt2 b/regression_itp/dec-far1.smt2 index 6f39ed34..64f89f4b 100644 --- a/regression_itp/dec-far1.smt2 +++ b/regression_itp/dec-far1.smt2 @@ -1,5 +1,5 @@ (set-option :produce-interpolants true) -(set-option :certify-interpolants 1) +(set-option :certify-interpolants true) (set-logic QF_LRA) (set-option :interpolation-lra-algorithm 11) ; decomposed Farkas (declare-fun x1 () Real) diff --git a/regression_itp/dec-far2.smt2 b/regression_itp/dec-far2.smt2 index 1aa35fd6..8d94ae6e 100644 --- a/regression_itp/dec-far2.smt2 +++ b/regression_itp/dec-far2.smt2 @@ -1,5 +1,5 @@ (set-option :produce-interpolants true) -(set-option :certify-interpolants 1) +(set-option :certify-interpolants true) (set-logic QF_LRA) (set-option :interpolation-lra-algorithm 11) ; decomposed Farkas (declare-fun x1 () Real) diff --git a/regression_itp/distinct_unsat.smt2 b/regression_itp/distinct_unsat.smt2 index 11f55748..cf08be50 100644 --- a/regression_itp/distinct_unsat.smt2 +++ b/regression_itp/distinct_unsat.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_LRA) (set-info :status unsat) (declare-fun a () Real) diff --git a/regression_itp/incremental/inc_itp_theory_prop.smt2 b/regression_itp/incremental/inc_itp_theory_prop.smt2 index 283023fc..c257b813 100644 --- a/regression_itp/incremental/inc_itp_theory_prop.smt2 +++ b/regression_itp/incremental/inc_itp_theory_prop.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LRA) (declare-fun x () Real) (push 1) diff --git a/regression_itp/incremental/incremental_itp.smt2 b/regression_itp/incremental/incremental_itp.smt2 index bfd69f60..94a7a424 100644 --- a/regression_itp/incremental/incremental_itp.smt2 +++ b/regression_itp/incremental/incremental_itp.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LRA) (declare-fun b () Bool) (assert (! diff --git a/regression_itp/incremental/incremental_itp2.smt2 b/regression_itp/incremental/incremental_itp2.smt2 index 672093f7..a53e3c6b 100644 --- a/regression_itp/incremental/incremental_itp2.smt2 +++ b/regression_itp/incremental/incremental_itp2.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LRA) (declare-fun a () Real) (assert (! diff --git a/regression_itp/incremental/incremental_itp3.smt2 b/regression_itp/incremental/incremental_itp3.smt2 index 18a5bb60..a0fb3d46 100644 --- a/regression_itp/incremental/incremental_itp3.smt2 +++ b/regression_itp/incremental/incremental_itp3.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LRA) (declare-fun a () Bool) (declare-fun b () Bool) diff --git a/regression_itp/incremental/incremental_itp4.smt2 b/regression_itp/incremental/incremental_itp4.smt2 index abc43f7d..432418db 100644 --- a/regression_itp/incremental/incremental_itp4.smt2 +++ b/regression_itp/incremental/incremental_itp4.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_UF) (declare-fun a () Bool) (declare-fun b () Bool) diff --git a/regression_itp/incremental/incremental_itp5.smt2 b/regression_itp/incremental/incremental_itp5.smt2 index 4bbd05d9..5772a1d3 100644 --- a/regression_itp/incremental/incremental_itp5.smt2 +++ b/regression_itp/incremental/incremental_itp5.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_UF) (declare-fun a () Bool) (declare-fun b () Bool) diff --git a/regression_itp/incremental/issue152_itp.smt2 b/regression_itp/incremental/issue152_itp.smt2 index f2d2e4bd..ccb3db1a 100644 --- a/regression_itp/incremental/issue152_itp.smt2 +++ b/regression_itp/incremental/issue152_itp.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LRA) (declare-fun r11 () Real) (check-sat) diff --git a/regression_itp/incremental/lia_splits.smt2 b/regression_itp/incremental/lia_splits.smt2 index 88f831b7..99ecc745 100644 --- a/regression_itp/incremental/lia_splits.smt2 +++ b/regression_itp/incremental/lia_splits.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LIA) (declare-fun x () Int) (declare-fun y () Int) diff --git a/regression_itp/incremental/lia_splits2.smt2 b/regression_itp/incremental/lia_splits2.smt2 index 020b13b6..e28bdada 100644 --- a/regression_itp/incremental/lia_splits2.smt2 +++ b/regression_itp/incremental/lia_splits2.smt2 @@ -1,4 +1,4 @@ -(set-option :produce-interpolants 1) +(set-option :produce-interpolants true) (set-logic QF_LIA) (declare-fun x () Int) (declare-fun y () Int) diff --git a/regression_itp/itp_bug.smt2 b/regression_itp/itp_bug.smt2 index a1e19bc8..32ca267d 100644 --- a/regression_itp/itp_bug.smt2 +++ b/regression_itp/itp_bug.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_LRA) (declare-fun |state_type::state.delta| () Real) (declare-fun |state_type::state.v!0| () Real) diff --git a/regression_itp/itp_bug_small.smt2 b/regression_itp/itp_bug_small.smt2 index e81d5119..86cd49fc 100644 --- a/regression_itp/itp_bug_small.smt2 +++ b/regression_itp/itp_bug_small.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_LRA) (declare-fun x () Bool) diff --git a/regression_itp/part_bug.smt2 b/regression_itp/part_bug.smt2 index 056c957d..d27b4b02 100644 --- a/regression_itp/part_bug.smt2 +++ b/regression_itp/part_bug.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_LRA) (declare-fun |hifrog::fun_start!0#3| () Bool) (declare-fun |hifrog::fun_end!0#3| () Bool) diff --git a/regression_itp/preint-options.smt2 b/regression_itp/preint-options.smt2 index 41a778b1..3cdd28b4 100644 --- a/regression_itp/preint-options.smt2 +++ b/regression_itp/preint-options.smt2 @@ -1,4 +1,4 @@ (set-logic QF_LRA) (set-option :produce-interpolants true) -(set-option :certify-interpolants 1) +(set-option :certify-interpolants true) (check-sat) diff --git a/regression_itp/proof_duplicate_literals.smt2 b/regression_itp/proof_duplicate_literals.smt2 index a8b6a671..1f0e2c7e 100644 --- a/regression_itp/proof_duplicate_literals.smt2 +++ b/regression_itp/proof_duplicate_literals.smt2 @@ -1,8 +1,8 @@ -(set-option :produce-interpolants 1) -(set-option :proof-reduce 1) -;(set-option :proof-check 1) +(set-option :produce-interpolants true) +(set-option :proof-reduce true) +;(set-option :proof-check true) ;(set-option :verbosity 2) -(set-option :certify-interpolants 1) +(set-option :certify-interpolants true) (set-logic QF_UF) (declare-fun a () Bool) (declare-fun b () Bool) diff --git a/regression_itp/trivial-proof-A.smt2 b/regression_itp/trivial-proof-A.smt2 index 170c5ced..ba3fac41 100644 --- a/regression_itp/trivial-proof-A.smt2 +++ b/regression_itp/trivial-proof-A.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_UF) (declare-fun x () Bool) (assert (! false :named A)) diff --git a/regression_itp/trivial-proof-B.smt2 b/regression_itp/trivial-proof-B.smt2 index 36555372..9c6477f7 100644 --- a/regression_itp/trivial-proof-B.smt2 +++ b/regression_itp/trivial-proof-B.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_UF) (declare-fun x () Bool) (assert (! x :named A)) diff --git a/regression_itp/uf-itp-edge-split.smt2 b/regression_itp/uf-itp-edge-split.smt2 index a999c1af..0ed3f5a6 100644 --- a/regression_itp/uf-itp-edge-split.smt2 +++ b/regression_itp/uf-itp-edge-split.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_UF) (declare-sort U 0) (declare-fun p () Bool) diff --git a/regression_itp/uf_bug.smt2 b/regression_itp/uf_bug.smt2 index 8458e405..d04084cb 100644 --- a/regression_itp/uf_bug.smt2 +++ b/regression_itp/uf_bug.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_UF) (declare-sort U 0) (declare-fun e () U) diff --git a/regression_itp/uf_duplicates.smt2 b/regression_itp/uf_duplicates.smt2 index 15b068e1..1fab207c 100644 --- a/regression_itp/uf_duplicates.smt2 +++ b/regression_itp/uf_duplicates.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_UF) (declare-sort Real 0) (declare-fun .uf-not () Bool) diff --git a/regression_itp/uf_itp_problem.smt2 b/regression_itp/uf_itp_problem.smt2 index 03839e46..8d6848a9 100644 --- a/regression_itp/uf_itp_problem.smt2 +++ b/regression_itp/uf_itp_problem.smt2 @@ -1,5 +1,5 @@ (set-option :produce-interpolants true) -(set-option :certify-interpolants 1) +(set-option :certify-interpolants true) (set-logic QF_UF) (declare-sort Real 0) (declare-fun g (Real Real ) Real) diff --git a/regression_itp/uf_local_colors_insufficient.smt2 b/regression_itp/uf_local_colors_insufficient.smt2 index 24489544..f7015fb2 100644 --- a/regression_itp/uf_local_colors_insufficient.smt2 +++ b/regression_itp/uf_local_colors_insufficient.smt2 @@ -1,5 +1,5 @@ -(set-option :produce-interpolants 1) -(set-option :certify-interpolants 1) +(set-option :produce-interpolants true) +(set-option :certify-interpolants true) (set-logic QF_UF) (declare-sort U 0) (declare-fun f (U U) U) From a09fcbd2d14b1d4a7a21fe84cd516bf34c56c715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 11:39:07 +0100 Subject: [PATCH 73/94] Interpret: Use correct string conversion for GetInfo --- src/api/Interpret.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index 2ae142c3..ab4e558e 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -62,7 +62,7 @@ void Interpret::interp(GetInfo const & n) { if (value.type == ConstType::empty) notify_formatted(true, "no value for info %s", name.c_str()); else { - auto val_str = value.getStringVal(); + auto val_str = value.toString(); notify_formatted(false, "%s %s", name.c_str(), val_str.c_str()); } } From e30546f1f4bae0a753a629bfcf029d2785f632eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 11:49:47 +0100 Subject: [PATCH 74/94] Interpret: allow only signed integers in options --- .../generic/pre-logic.smt2.expected.out | 8 +- src/api/Interpret.cc | 39 +++--- src/options/SMTConfig.cc | 4 +- src/options/SMTConfig.h | 121 +++++++++++------- src/parsers/smt2new/smt2newcontext.h | 7 +- src/parsers/smt2new/smt2newlexer.ll | 2 +- src/parsers/smt2new/smt2newparser.yy | 26 ++-- 7 files changed, 122 insertions(+), 85 deletions(-) diff --git a/regression/generic/pre-logic.smt2.expected.out b/regression/generic/pre-logic.smt2.expected.out index 0e4f217c..b0e978f9 100644 --- a/regression/generic/pre-logic.smt2.expected.out +++ b/regression/generic/pre-logic.smt2.expected.out @@ -6,7 +6,8 @@ success success success success -success +(error "Overflow in #xdeafbeef") + success success true @@ -17,8 +18,9 @@ Longer story (error "No value for attr :foo-option") 0 -3.14159 -3736059631 +3.141593 +(error "No value for option :hex") + 85 ( foo string 10 4075 1.23 2 ( ( ) bar ( :keyword ) ) ) (error "No value for attr :non-existing-option") diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index ab4e558e..1a34e865 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -48,8 +48,7 @@ Interpret::getParsedFormula() } void Interpret::interp(SetInfo const & n) { - std::string name = n.getName(); - config.setInfo(n.getName(), n.getValue()); + config.setInfo(n.getName(), SMTOption{n.getValue()}); notify_success(); } @@ -74,75 +73,83 @@ void Interpret::interp(SetOption const & n) { auto val = std::get_if>(&n.option->value); assert(val); assert(*val); - config.setOption(*(**val).name, *(**val).value); + try { + config.setOption(*(**val).name, SMTOption{*(**val).value}); + } catch (std::out_of_range & e) { + notify_formatted(true, "Overflow in %s", opensmt::nodeToString()(*(**val).value).c_str()); + return; + } catch (OsmtApiException & e) { + notify_formatted(true, "%s", e.what()); + return; + } break; } case OptionNode::OptionType::DiagnosticOutputChannel: { auto val = std::get_if>(&n.option->value); assert(val); assert(*val); - config.setOption("diagnostic-output-channel", std::move(**val)); + config.setOption(":diagnostic-output-channel", SMTOption{std::move(**val)}); break; } case OptionNode::OptionType::ExpandDefinitions: { auto val = std::get_if(&n.option->value); assert(val); - config.setOption("expand-definitions", *val); + config.setOption(":expand-definitions", SMTOption{*val}); break; } case OptionNode::OptionType::InteractiveMode: { auto val = std::get_if(&n.option->value); assert(val); - config.setOption("interactive-mode", *val); + config.setOption(":interactive-mode", SMTOption{*val}); break; } case OptionNode::OptionType::PrintSuccess: { auto val = std::get_if(&n.option->value); assert(val); - config.setOption("print-success", *val); + config.setOption(":print-success", SMTOption{*val}); break; } case OptionNode::OptionType::ProduceAssignments: { auto val = std::get_if(&n.option->value); assert(val); - config.setOption("produce-assignments", *val); + config.setOption(":produce-assignments", SMTOption{*val}); break; } case OptionNode::OptionType::ProduceModels: { auto val = std::get_if(&n.option->value); assert(val); - config.setOption("produce-models", *val); + config.setOption(":produce-models", SMTOption{*val}); break; } case OptionNode::OptionType::ProduceProofs: { auto val = std::get_if(&n.option->value); assert(val); - config.setOption("produce-proofs", *val); + config.setOption(":produce-proofs", SMTOption{*val}); break; } case OptionNode::OptionType::ProduceUnsatCores: { auto val = std::get_if(&n.option->value); assert(val); - config.setOption("produce-unsat-cores", *val); + config.setOption(":produce-unsat-cores", SMTOption{*val}); break; } case OptionNode::OptionType::RandomSeed: { - auto val = std::get_if(&n.option->value); + auto val = std::get_if(&n.option->value); assert(val); - config.setOption("random-seed", *val); + config.setOption(":random-seed", SMTOption{*val}); break; } case OptionNode::OptionType::RegularOutputChannel: { auto val = std::get_if>(&n.option->value); assert(val); assert(*val); - config.setOption("regular-output-channel", std::move(**val)); + config.setOption(":regular-output-channel", SMTOption{std::move(**val)}); break; } case OptionNode::OptionType::Verbosity: { - auto val = std::get_if(&n.option->value); + auto val = std::get_if(&n.option->value); assert(val); - config.setOption("verbosity", *val); + config.setOption(":verbosity", SMTOption{*val}); break; } default: diff --git a/src/options/SMTConfig.cc b/src/options/SMTConfig.cc index f5d04af8..907fb0e6 100644 --- a/src/options/SMTConfig.cc +++ b/src/options/SMTConfig.cc @@ -79,10 +79,10 @@ void SMTConfig::setOption(std::string const & name, const SMTOption& value) { } if (name == o_random_seed) { - if (value.type != ConstType::numeral) { + if (value.type != ConstType::integral) { throw OsmtApiException(s_err_not_num); } - uint32_t seed = value.getUint32Val(); + uint32_t seed = value.getIntVal(); if (seed == 0) { throw OsmtApiException(s_err_seed_zero); } } diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index 4305508e..9b6b2431 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -90,7 +90,7 @@ class SMTOption { public: ConstType type = ConstType::empty; - std::variant value = 0; + std::variant value = 0; std::string toString() const { if (auto val = std::get_if(&value)) { @@ -99,8 +99,6 @@ class SMTOption { return std::to_string(*val); } else if (auto val = std::get_if(&value)) { return std::to_string(*val); - } else if (auto val = std::get_if(&value)) { - return std::to_string(*val); } else if (auto val = std::get_if(&value)) { return *val ? "true" : "false"; } @@ -118,11 +116,9 @@ class SMTOption { } } double getDoubleVal() const { - if (type == ConstType::numeral) { + if (type == ConstType::integral) { if (auto val = std::get_if(&value)) { return static_cast(*val); - } else if (auto val = std::get_if(&value)) { - return static_cast(*val); } else { throw OsmtInternalException("Inconsistent value for option"); } @@ -135,7 +131,7 @@ class SMTOption { } } int getIntVal() const { - if (type == ConstType::numeral) { + if (type == ConstType::integral) { auto val = std::get_if(&value); assert(val); return *val; @@ -143,15 +139,6 @@ class SMTOption { throw OsmtApiException("Attempted to obtain int value for non-int type"); } } - uint32_t getUint32Val() const { - if (type == ConstType::uint32) { - auto val = std::get_if(&value); - assert(val); - return *val; - } else { - throw OsmtApiException("Attempted to obtain uint32 value for non-uint32 type"); - } - } bool getBoolVal() const { if (type == ConstType::boolean) { auto val = std::get_if(&value); @@ -163,19 +150,61 @@ class SMTOption { } } SMTOption() = default; - SMTOption(int i) : type(ConstType::numeral), value(i) {} - SMTOption(uint32_t i) : type(ConstType::uint32), value(i) {} - SMTOption(double i) : type(ConstType::decimal), value(i) {} - SMTOption(std::string && s) : type(ConstType::string), value(std::move(s)) {} - SMTOption(AttributeValueNode const & n) { + explicit SMTOption(bool i) : type(ConstType::boolean), value(i) {} + explicit SMTOption(int i) : type(ConstType::integral), value(i) {} + explicit SMTOption(double i) : type(ConstType::decimal), value(i) {} + explicit SMTOption(std::string && s) : type(ConstType::string), value(std::move(s)) {} + explicit SMTOption(AttributeValueNode const & n) { if (auto specConst_p = std::get_if>(&n.value)) { auto const & specConst = (**specConst_p); type = specConst.type; - value = *specConst.value; + switch (type) { + case ConstType::integral: { + value = std::stoi(*specConst.value); + break; + } + case ConstType::boolean: { + value = *specConst.value == "true"; + break; + } + case ConstType::string: { + value = *specConst.value; + break; + } + case ConstType::decimal: { + value = std::stod(*specConst.value); + break; + } + case ConstType::binary: { + value = std::stoi(static_cast(std::string_view(&(*specConst.value)[2], (*specConst.value).size()-2)), nullptr, 2); + break; + } + case ConstType::hexadecimal: { + value = std::stoi(static_cast(std::string_view(&(*specConst.value)[2], (*specConst.value).size()-2)), nullptr, 16); + break; + } + case ConstType::sexpr: + case ConstType::symbol: { + value = *specConst.value; + break; + } + case ConstType::empty: { + throw OsmtInternalException("Parsed an empty type"); + } + } } else if (auto symbol_p = std::get_if>(&n.value)) { auto const & symbol = (**symbol_p); - type = symbol.getType(); - value = opensmt::nodeToString()(symbol); + std::string symbolString = opensmt::nodeToString()(symbol); + if (not symbol.quoted and symbolString == "true") { + type = ConstType::boolean; + value = true; + } else if (not symbol.quoted and symbolString == "false") { + type = ConstType::boolean; + value = false; + } else { + type = symbol.getType(); + value = std::move(symbolString); + } } else if (auto sexprVec_p = std::get_if>>(&n.value)) { assert(sexprVec_p); type = ConstType::sexpr; @@ -404,7 +433,7 @@ struct SMTConfig void printHelp ( ); void printConfig ( std::ostream & out ); - inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed).getUint32Val(): 91648253; } + inline int getRandomSeed ( ) const { return optionTable.find(o_random_seed) != optionTable.end() ? optionTable.at(o_random_seed).getIntVal(): 91648253; } inline void setProduceModels( ) { insertOption(o_produce_models, SMTOption(1)); } inline bool setRandomSeed(int seed) { insertOption(o_random_seed, SMTOption(seed)); return true; } @@ -417,7 +446,7 @@ struct SMTConfig void setTimeQueries() { insertOption(o_time_queries, SMTOption(1)); } bool timeQueries() { return optionTable.find(o_time_queries) != optionTable.end() ? optionTable[o_time_queries].getBoolVal() : false; } // Set reduction params - inline void setReduction(int r) { insertOption(o_proof_reduce, SMTOption(r)); } + inline void setReduction(bool r) { insertOption(o_proof_reduce, SMTOption(r)); } inline void setReductionGraph(int r) { insertOption(o_proof_num_graph_traversals, SMTOption(r)); } @@ -437,16 +466,16 @@ struct SMTConfig // Get interpolation algorithms inline ItpAlgorithm getBooleanInterpolationAlgorithm() const { - return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg).getUint32Val()) + return optionTable.find(o_itp_bool_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_bool_alg).getIntVal()) : ItpAlgorithm::itp_alg_mcmillan; } inline ItpAlgorithm getEUFInterpolationAlgorithm() const { - return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg).getUint32Val()) + return optionTable.find(o_itp_euf_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_euf_alg).getIntVal()) : ItpAlgorithm::itp_euf_alg_strong; } inline ItpAlgorithm getLRAInterpolationAlgorithm() const { - return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg).getUint32Val()) + return optionTable.find(o_itp_lra_alg) != optionTable.end() ? static_cast(optionTable.at(o_itp_lra_alg).getIntVal()) : ItpAlgorithm::itp_lra_alg_strong; } @@ -482,10 +511,10 @@ struct SMTConfig optionTable.at(o_grow).getBoolVal() : 0; } int sat_clause_lim() const { return optionTable.find(o_clause_lim) != optionTable.end() ? - optionTable.at(o_clause_lim).getUint32Val() : 20; } + optionTable.at(o_clause_lim).getIntVal() : 20; } int sat_subsumption_lim() const { return optionTable.find(o_subsumption_lim) != optionTable.end() ? - optionTable.at(o_subsumption_lim).getUint32Val() : 1000; } + optionTable.at(o_subsumption_lim).getIntVal() : 1000; } double sat_simp_garbage_frac() const { return optionTable.find(o_simp_garbage_frac) != optionTable.end() ? optionTable.at(o_simp_garbage_frac).getDoubleVal() : 0.5; } @@ -511,14 +540,14 @@ struct SMTConfig optionTable.at(o_random_var_freq).getDoubleVal() : 0.02; } uint32_t sat_random_seed() const { return optionTable.find(o_random_seed) != optionTable.end() ? - optionTable.at(o_random_seed).getUint32Val() : 91648253; } + optionTable.at(o_random_seed).getIntVal() : 91648253; } bool sat_luby_restart() const { return optionTable.find(o_luby_restart) != optionTable.end() ? optionTable.at(o_luby_restart).getBoolVal() : true; } uint32_t sat_ccmin_mode() const { return optionTable.find(o_ccmin_mode) != optionTable.end() ? - optionTable.at(o_ccmin_mode).getUint32Val() : 2; + optionTable.at(o_ccmin_mode).getIntVal() : 2; } bool sat_rnd_pol() const { return optionTable.find(o_rnd_pol) != optionTable.end() ? @@ -533,7 +562,7 @@ struct SMTConfig } uint32_t sat_restart_first() const { return optionTable.find(o_restart_first) != optionTable.end() ? - optionTable.at(o_restart_first).getUint32Val() : 100; } + optionTable.at(o_restart_first).getIntVal() : 100; } double sat_restart_inc() const { return optionTable.find(o_restart_inc) != optionTable.end() ? optionTable.at(o_restart_inc).getDoubleVal() : 1.1; @@ -552,7 +581,7 @@ struct SMTConfig } uint32_t simplify_inter() const { return optionTable.find(o_simplify_inter) != optionTable.end() ? - optionTable.at(o_simplify_inter).getUint32Val() : false; + optionTable.at(o_simplify_inter).getIntVal() : false; } bool proof_struct_hash() const { return optionTable.find(o_proof_struct_hash) != optionTable.end() ? @@ -560,10 +589,10 @@ struct SMTConfig } uint32_t proof_num_graph_traversals() const { return optionTable.find(o_proof_num_graph_traversals) != optionTable.end() ? - optionTable.at(o_proof_num_graph_traversals).getUint32Val() : 3; } + optionTable.at(o_proof_num_graph_traversals).getIntVal() : 3; } uint32_t proof_red_trans() const { return optionTable.find(o_proof_red_trans) != optionTable.end() ? - optionTable.at(o_proof_red_trans).getUint32Val() : 2; + optionTable.at(o_proof_red_trans).getIntVal() : 2; } bool proof_rec_piv() const { return optionTable.find(o_proof_rec_piv) != optionTable.end() ? @@ -595,18 +624,18 @@ struct SMTConfig } uint32_t itp_bool_alg() const { return optionTable.find(o_itp_bool_alg) != optionTable.end() ? - optionTable.at(o_itp_bool_alg).getUint32Val() : 0; + optionTable.at(o_itp_bool_alg).getIntVal() : 0; } uint32_t itp_euf_alg() const { return optionTable.find(o_itp_euf_alg) != optionTable.end() ? - optionTable.at(o_itp_euf_alg).getUint32Val() : 0; + optionTable.at(o_itp_euf_alg).getIntVal() : 0; } uint32_t itp_lra_alg() const { return optionTable.find(o_itp_lra_alg) != optionTable.end() ? - optionTable.at(o_itp_lra_alg).getUint32Val() : 0; } + optionTable.at(o_itp_lra_alg).getIntVal() : 0; } uint32_t sat_dump_rnd_inter() const { return optionTable.find(o_sat_dump_rnd_inter) != optionTable.end() ? - optionTable.at(o_sat_dump_rnd_inter).getUint32Val() : 2; } + optionTable.at(o_sat_dump_rnd_inter).getIntVal() : 2; } bool declarations_are_global() const { return optionTable.find(o_global_declarations) != optionTable.end() ? @@ -709,7 +738,7 @@ struct SMTConfig } uint32_t sat_split_num() const { return optionTable.find(o_sat_split_num) != optionTable.end() ? - optionTable.at(o_sat_split_num).getUint32Val() : + optionTable.at(o_sat_split_num).getIntVal() : 2; } int sat_split_fixvars() const { @@ -750,7 +779,7 @@ struct SMTConfig uint32_t randomize_lookahead_bufsz() const { return optionTable.find(o_sat_split_randomize_lookahead_buf) != optionTable.end() ? - optionTable.at(o_sat_split_randomize_lookahead_buf).getUint32Val() : + optionTable.at(o_sat_split_randomize_lookahead_buf).getIntVal() : true; } @@ -793,7 +822,7 @@ struct SMTConfig uint32_t sat_solver_limit() const { return optionTable.find(o_sat_solver_limit) != optionTable.end() ? - optionTable.at(o_sat_solver_limit).getUint32Val() : 0; } + optionTable.at(o_sat_solver_limit).getIntVal() : 0; } bool sat_split_mode() const { return optionTable.find(o_sat_split_mode) != optionTable.end() ? @@ -808,9 +837,9 @@ struct SMTConfig bool rocset; // Regular Output Channel set ? bool docset; // Diagnostic Output Channel set ? int dump_formula; // Dump input formula - bool verbosity() const { // Verbosity level + uint32_t verbosity() const { // Verbosity level return optionTable.find(o_verbosity) != optionTable.end() ? - optionTable.at(o_verbosity).getBoolVal() : false; + optionTable.at(o_verbosity).getIntVal() : 0; } bool printSuccess() const { return optionTable.find(":print-success") != optionTable.end() ? diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index d919bd95..d273e3ac 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -34,10 +34,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include enum class ConstType { - numeral, + integral, decimal, hexadecimal, - uint32, binary, string, empty, @@ -141,10 +140,10 @@ class OptionNode : public GeneralNode { RegularOutputChannel, Verbosity, }; - std::variant,std::unique_ptr> value; OptionType type; + std::variant,std::unique_ptr> value; OptionNode(OptionType type, bool value) : type(type), value(value) {} - OptionNode(OptionType type, uint32_t value) : type(type), value(value) {} + OptionNode(OptionType type, int value) : type(type), value(value) {} OptionNode(OptionType type, std::unique_ptr && value) : type(type), value(std::move(value)) {} OptionNode(OptionType type, std::unique_ptr && value) : type(type), value(std::move(value)) {} }; diff --git a/src/parsers/smt2new/smt2newlexer.ll b/src/parsers/smt2new/smt2newlexer.ll index 84c1c9cc..c1217794 100644 --- a/src/parsers/smt2new/smt2newlexer.ll +++ b/src/parsers/smt2new/smt2newlexer.ll @@ -129,7 +129,7 @@ using namespace osmttokens; ":all-statistics" { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return KW_ALLSTATISTICS; } -0|-?[1-9][0-9]*(\/[1-9][0-9]*)? { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_NUM; } +0|-?[1-9][0-9]*(\/[1-9][0-9]*)? { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_INT; } -?[0-9]+\.0*[0-9]+ { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_DEC; } #x[0-9a-fA-F]+ { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_HEX; } #b[01]+ { yyget_lval(yyscanner)->str = new std::string(yyget_text(yyscanner)); return TK_BIN; } diff --git a/src/parsers/smt2new/smt2newparser.yy b/src/parsers/smt2new/smt2newparser.yy index d11f3c3f..bab79c86 100644 --- a/src/parsers/smt2new/smt2newparser.yy +++ b/src/parsers/smt2new/smt2newparser.yy @@ -122,13 +122,13 @@ std::unique_ptr mkUniqueStr(std::string const & s) { return std::ma %token TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %token TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO -%token TK_NUM TK_SYM TK_QSYM TK_KEY TK_STR TK_DEC TK_HEX TK_BIN +%token TK_INT TK_SYM TK_QSYM TK_KEY TK_STR TK_DEC TK_HEX TK_BIN %token KW_SORTS KW_FUNS KW_SORTSDESCRIPTION KW_FUNSDESCRIPTION KW_DEFINITION KW_NOTES KW_THEORIES KW_EXTENSIONS KW_VALUES KW_PRINTSUCCESS KW_EXPANDDEFINITIONS KW_INTERACTIVEMODE KW_PRODUCEPROOFS KW_PRODUCEUNSATCORES KW_PRODUCEMODELS KW_PRODUCEASSIGNMENTS KW_REGULAROUTPUTCHANNEL KW_DIAGNOSTICOUTPUTCHANNEL KW_RANDOMSEED KW_VERBOSITY KW_ERRORBEHAVIOR KW_NAME KW_NAMED KW_AUTHORS KW_VERSION KW_STATUS KW_REASONUNKNOWN KW_ALLSTATISTICS %type TK_AS TK_DECIMAL TK_EXISTS TK_FORALL TK_LET TK_NUMERAL TK_PAR TK_STRING %type TK_ASSERT TK_CHECKSAT TK_DECLARESORT TK_DECLAREFUN TK_DECLARECONST TK_DEFINESORT TK_DEFINEFUN TK_EXIT TK_GETASSERTIONS TK_GETASSIGNMENT TK_GETINFO TK_GETOPTION TK_GETPROOF TK_GETUNSATCORE TK_GETVALUE TK_GETMODEL TK_POP TK_PUSH TK_SETLOGIC TK_SETINFO TK_SETOPTION TK_THEORY TK_GETITPS TK_WRSTATE TK_RDSTATE TK_SIMPLIFY TK_WRFUNS TK_ECHO -%type TK_NUM TK_SYM TK_QSYM TK_KEY TK_STR TK_DEC TK_HEX TK_BIN +%type TK_INT TK_SYM TK_QSYM TK_KEY TK_STR TK_DEC TK_HEX TK_BIN %type KW_SORTS KW_FUNS KW_SORTSDESCRIPTION KW_FUNSDESCRIPTION KW_DEFINITION KW_NOTES KW_THEORIES KW_EXTENSIONS KW_VALUES KW_PRINTSUCCESS KW_EXPANDDEFINITIONS KW_INTERACTIVEMODE KW_PRODUCEPROOFS KW_PRODUCEUNSATCORES KW_PRODUCEMODELS KW_PRODUCEASSIGNMENTS KW_REGULAROUTPUTCHANNEL KW_DIAGNOSTICOUTPUTCHANNEL KW_RANDOMSEED KW_VERBOSITY KW_ERRORBEHAVIOR KW_NAME KW_NAMED KW_AUTHORS KW_VERSION KW_STATUS KW_REASONUNKNOWN KW_ALLSTATISTICS predef_key %type sort %type identifier @@ -179,7 +179,7 @@ command: '(' TK_SETLOGIC symbol ')' { $$ = new SetOption {std::unique_ptr($3)}; } | '(' TK_SETINFO attribute ')' { $$ = new SetInfo {std::unique_ptr($3)}; } - | '(' TK_DECLARESORT symbol TK_NUM ')' + | '(' TK_DECLARESORT symbol TK_INT ')' { $$ = new DeclareSort {std::unique_ptr($3), std::unique_ptr($4)}; } | '(' TK_DEFINESORT symbol '(' symbol_list ')' sort ')' { $$ = new DefineSort {std::unique_ptr($3), std::unique_ptr>>($5), std::unique_ptr($7)}; } @@ -189,9 +189,9 @@ command: '(' TK_SETLOGIC symbol ')' { $$ = new DeclareConst {std::unique_ptr($3), std::unique_ptr($4)}; } | '(' TK_DEFINEFUN symbol '(' sorted_var_list ')' sort term ')' { $$ = new DefineFun {std::unique_ptr($3), std::unique_ptr>>($5), std::unique_ptr($7), std::unique_ptr($8)}; } - | '(' TK_PUSH TK_NUM ')' + | '(' TK_PUSH TK_INT ')' { $$ = new PushNode {std::stoi(*$3)}; delete $3; } - | '(' TK_POP TK_NUM ')' + | '(' TK_POP TK_INT ')' { $$ = new PopNode {std::stoi(*$3)}; delete $3; } | '(' TK_ASSERT term ')' { $$ = new AssertNode{std::unique_ptr($3)}; } @@ -290,8 +290,8 @@ s_expr_list: ; -spec_const: TK_NUM - { $$ = new SpecConstNode{{}, ConstType::numeral, std::unique_ptr($1)}; } +spec_const: TK_INT + { $$ = new SpecConstNode{{}, ConstType::integral, std::unique_ptr($1)}; } | TK_DEC { $$ = new SpecConstNode{{}, ConstType::decimal, std::unique_ptr($1)}; } | TK_HEX @@ -308,9 +308,9 @@ const_val: symbol { $$ = new SymbolNode {{}, std::unique_ptr($1), false}; } ; -numeral_list: numeral_list TK_NUM +numeral_list: numeral_list TK_INT { $1->emplace_back(std::unique_ptr($2)); } - | TK_NUM + | TK_INT { $$ = new std::vector>(); $$->emplace_back(std::unique_ptr{$1}); } ; @@ -412,10 +412,10 @@ option: KW_PRINTSUCCESS b_value { $$ = new OptionNode {OptionNode::OptionType::RegularOutputChannel, std::unique_ptr($2)}; delete $1; } | KW_DIAGNOSTICOUTPUTCHANNEL TK_STR { $$ = new OptionNode {OptionNode::OptionType::DiagnosticOutputChannel, std::unique_ptr($2)}; delete $1; } - | KW_RANDOMSEED TK_NUM - { $$ = new OptionNode {OptionNode::OptionType::RandomSeed, static_cast(std::stoi(*$2)) }; delete $2; delete $1; } - | KW_VERBOSITY TK_NUM - { $$ = new OptionNode {OptionNode::OptionType::Verbosity, static_cast(std::stoi(*$2)) }; delete $2; delete $1; } + | KW_RANDOMSEED TK_INT + { $$ = new OptionNode {OptionNode::OptionType::RandomSeed, static_cast(std::stoi(*$2)) }; delete $2; delete $1; } + | KW_VERBOSITY TK_INT + { $$ = new OptionNode {OptionNode::OptionType::Verbosity, static_cast(std::stoi(*$2)) }; delete $2; delete $1; } | attribute { $$ = new OptionNode {OptionNode::OptionType::Attribute, std::unique_ptr($1) }; } ; From fbc98b2d96afe41b51948bffc82ffe670792a106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 11:54:18 +0100 Subject: [PATCH 75/94] Interpret: fix s-expression printing --- regression/generic/pre-logic.smt2.expected.out | 10 ++++------ src/options/SMTConfig.h | 10 +++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/regression/generic/pre-logic.smt2.expected.out b/regression/generic/pre-logic.smt2.expected.out index b0e978f9..e66d95b0 100644 --- a/regression/generic/pre-logic.smt2.expected.out +++ b/regression/generic/pre-logic.smt2.expected.out @@ -15,23 +15,21 @@ quux Longer story 3 /dev/null -(error "No value for attr :foo-option") - +() 0 3.141593 (error "No value for option :hex") 85 -( foo string 10 4075 1.23 2 ( ( ) bar ( :keyword ) ) ) -(error "No value for attr :non-existing-option") +(foo string #b1010 #xfeb 1.23 2 (() bar (:keyword))) +(error "No value for option :non-existing-option") success success success success success -(error "no value for info :foo") - +:foo () :error-behavior commit-adultery :name OpenSMT :authors Muumi-peikko diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index 9b6b2431..9d9d0c9d 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -209,11 +209,11 @@ class SMTOption { assert(sexprVec_p); type = ConstType::sexpr; auto const & sexprVec = **sexprVec_p; - std::string s; - for (SExpr * sexpr_p : sexprVec) { - s += "(" + opensmt::nodeToString()(sexpr_p) + ")"; - } - value = s; + auto str = std::accumulate(sexprVec.begin(), sexprVec.end(), std::string{}, + [](std::string & a, SExpr const * b) { + return a += (a.empty() ? "" : " ") + opensmt::nodeToString()(b); + }); + value = "(" + str + ")"; } } inline bool isEmpty() const { return type == ConstType::empty; } From f79624875d1afd1f32bc5cff21f48bcf5d3dc88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 11:55:57 +0100 Subject: [PATCH 76/94] Interpret: miscellaneous output fixes --- src/api/Interpret.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index 1a34e865..25bf94cd 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -154,8 +154,9 @@ void Interpret::interp(SetOption const & n) { } default: notify_formatted(true, "unknown option"); - break; + return; } + notify_success(); } void Interpret::interp(GetOption const & n) { @@ -310,8 +311,11 @@ void Interpret::interp(Simplify const & n) { return; } sstat status = main_solver->simplifyFormulas(); - if (status == s_Error) + if (status == s_Error) { notify_formatted(true, "Simplify"); + } else { + notify_success(); + } } void Interpret::interp(CheckSatNode const & n) { @@ -463,6 +467,9 @@ void Interpret::interp(PushNode const & n) { } else if (not isInitialized()) { notify_formatted(true, "Illegal command before set-logic: push"); return; + } else if (n.num < 0) { + notify_formatted(true, "Incorrect push command, value is negative."); + return; } int num = n.num; while (num --) { @@ -620,7 +627,7 @@ PTRef Interpret::parseTerm(NormalTermNode const * term, LetRecords & letRecords) if (term->returnSort) { return resolveQualifiedIdentifier(name, *term->returnSort, isQuoted); } else { - if (term->arguments->empty()) { + if (not term->arguments) { PTRef tr = letNameResolve(name.c_str(), letRecords); if (tr != PTRef_Undef) { return tr; @@ -782,6 +789,10 @@ void Interpret::writeState(std::string const & filename) void Interpret::interp(DeclareFun const & n) // (const char* fname, const vec& args) { + if (not isInitialized()) { + notify_formatted(true, "Illegal command before set-logic: declare-fun"); + return; + } SymbolNode const & name_node = *n.name; auto const & args_vec = *n.argumentSorts; SortNode const & ret_sort = *n.returnSort; @@ -821,6 +832,7 @@ void Interpret::interp(DeclareFun const & n) // (const char* fname, const vec Date: Mon, 31 Oct 2022 11:56:50 +0100 Subject: [PATCH 77/94] Interpret: Clean unused variables --- src/api/Interpret.cc | 14 +++++++------- src/bin/opensmt.cc | 1 - src/options/SMTConfig.h | 1 - 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index 25bf94cd..b0f9aea6 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -305,7 +305,7 @@ void Interpret::interp(AssertNode const & n) { } } -void Interpret::interp(Simplify const & n) { +void Interpret::interp(Simplify const &) { if (not isInitialized()) { notify_formatted(true, "Illegal command before set-logic: simplify"); return; @@ -318,7 +318,7 @@ void Interpret::interp(Simplify const & n) { } } -void Interpret::interp(CheckSatNode const & n) { +void Interpret::interp(CheckSatNode const &) { if (not isInitialized()) { notify_formatted(true, "Illegal command before set-logic: check-sat"); return; @@ -420,7 +420,7 @@ class NameClashResolver { }; } -void Interpret::interp(GetModel const & n) { +void Interpret::interp(GetModel const &) { if (not isInitialized()) { notify_formatted(true, "Illegal command before set-logic: get-model"); return; @@ -503,7 +503,7 @@ void Interpret::interp(PopNode const & n) { } } -void Interpret::interp(Exit const & n) { +void Interpret::interp(Exit const &) { exit(); notify_success(); } @@ -662,10 +662,10 @@ PTRef Interpret::parseTerm(NormalTermNode const * term, LetRecords & letRecords) } } -PTRef Interpret::parseTerm(ForallNode const * term, LetRecords & letRecords) { +PTRef Interpret::parseTerm(ForallNode const *, LetRecords &) { return PTRef_Undef; } -PTRef Interpret::parseTerm(ExistsNode const * term, LetRecords & letRecords) { +PTRef Interpret::parseTerm(ExistsNode const *, LetRecords &) { return PTRef_Undef; } @@ -673,7 +673,7 @@ PTRef Interpret::parseTerm(ExistsNode const * term, LetRecords & letRecords) { -void Interpret::interp(GetAssignment const & getAssignment) { +void Interpret::interp(GetAssignment const &) { if (not isInitialized()) { notify_formatted(true, "Illegal command before set-logic"); } diff --git a/src/bin/opensmt.cc b/src/bin/opensmt.cc index 32e179bf..0905d4c6 100644 --- a/src/bin/opensmt.cc +++ b/src/bin/opensmt.cc @@ -92,7 +92,6 @@ int main( int argc, char * argv[] ) // context.getConfig( ).printHelp( ); break; case 'd': - const char* msg; c.setOption(SMTConfig::o_dryrun, SMTOption(true)); break; case 'r': diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index 9d9d0c9d..bf7924f0 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -914,7 +914,6 @@ struct SMTConfig static uint16_t database_port; void setSimplifyInterpolant(int val) { - const char* msg; setOption(o_simplify_inter, SMTOption(val)); } From 10f46bfca9ee72443669b711101109cddbdf687b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 11:57:28 +0100 Subject: [PATCH 78/94] Interpret: make main interp public --- src/api/Interpret.h | 2 +- src/bin/opensmt.cc | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api/Interpret.h b/src/api/Interpret.h index d801873e..4a0dccfa 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -161,7 +161,6 @@ class Interpret { bool storeDefinedFun(std::string const & fname, const vec& args, SRef ret_sort, const PTRef tr); virtual void exit(); - void interp(CommandNode const * n); void interp(SetLogic const & n); void interp(SetInfo const & n); void interp(SetOption const & n); @@ -200,6 +199,7 @@ class Interpret { , f_exit (false) { } + void interp(CommandNode const * n); int interpFile(FILE* in); int interpFile(char *content); int interpPipe(); diff --git a/src/bin/opensmt.cc b/src/bin/opensmt.cc index 0905d4c6..4244727f 100644 --- a/src/bin/opensmt.cc +++ b/src/bin/opensmt.cc @@ -207,9 +207,10 @@ void interpretInteractive(Interpret & interpret) { if (rval != 0) interpret.reportError("scanner"); else { - ASTNode const & r = context.getRoot(); - interpret.execute(r); - done = interpret.gotExit(); + for (auto command : context.getRoot()) { + if (rval == 0 and not interpret.gotExit()) { interpret.interp(command); } + delete command; + } } add_history(parse_buf); pb_sz = 0; From ad9091e171a4fcf8b4c97635a7eacea922e66383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 11:58:26 +0100 Subject: [PATCH 79/94] unit tests: update Config::setOption signature --- test/unit/test_LIAInterpolation.cc | 9 ++-- .../unit/test_ResolutionProofInterpolation.cc | 9 ++-- test/unit/test_UFInterpolation.cc | 45 +++++++------------ 3 files changed, 21 insertions(+), 42 deletions(-) diff --git a/test/unit/test_LIAInterpolation.cc b/test/unit/test_LIAInterpolation.cc index 460da76c..9d2d568d 100644 --- a/test/unit/test_LIAInterpolation.cc +++ b/test/unit/test_LIAInterpolation.cc @@ -104,8 +104,7 @@ TEST_F(LIAInterpolationTest, test_Split_ALocal){ PTRef leq3 = logic.mkLeq(y, one); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "test"); PTRef partA = logic.mkAnd(leq1, leq2); PTRef partB = leq3; @@ -138,8 +137,7 @@ TEST_F(LIAInterpolationTest, test_Split_BLocal){ PTRef leq3 = logic.mkLeq(y, one); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "test"); PTRef partB = logic.mkAnd(leq1, leq2); PTRef partA = leq3; @@ -172,8 +170,7 @@ TEST_F(LIAInterpolationTest, test_Split_ABShared) { PTRef leq2 = logic.mkGeq(logic.mkMinus(logic.mkTimes(two, x), y), two); PTRef leq3 = logic.mkLeq(y, one); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "test"); PTRef partA = leq1; PTRef partB = logic.mkAnd(leq2, leq3); diff --git a/test/unit/test_ResolutionProofInterpolation.cc b/test/unit/test_ResolutionProofInterpolation.cc index dffa3cb5..fd2e0e40 100644 --- a/test/unit/test_ResolutionProofInterpolation.cc +++ b/test/unit/test_ResolutionProofInterpolation.cc @@ -16,8 +16,7 @@ class ResolutionProofInterpolationTest : public ::testing::Test { protected: ResolutionProofInterpolationTest(): logic{opensmt::Logic_t::QF_UF} {} virtual void SetUp() { - const char* msg; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); solver = std::make_unique(logic, config, "test"); a = logic.mkBoolVar("a"); b = logic.mkBoolVar("c"); @@ -83,8 +82,7 @@ class ResolutionProofInterpolationTestWithReduction : public ::testing::Test { protected: ResolutionProofInterpolationTestWithReduction(): logic{opensmt::Logic_t::QF_UF} {} virtual void SetUp() { - const char* msg; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); // config.setOption(SMTConfig::o_verbosity, SMTOption(2), msg); solver = std::make_unique(logic, config, "test"); a = logic.mkBoolVar("a"); @@ -134,8 +132,7 @@ class ResolutionProofIncrementalInterpolationTest : public ::testing::Test { protected: ResolutionProofIncrementalInterpolationTest(): logic{opensmt::Logic_t::QF_UF} {} virtual void SetUp() { - const char* msg; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); solver = std::make_unique(logic, config, "test"); a = logic.mkBoolVar("a"); b = logic.mkBoolVar("c"); diff --git a/test/unit/test_UFInterpolation.cc b/test/unit/test_UFInterpolation.cc index 6c6e186d..3e3f531f 100644 --- a/test/unit/test_UFInterpolation.cc +++ b/test/unit/test_UFInterpolation.cc @@ -54,8 +54,7 @@ TEST_F(UFInterpolationTest, test_SimpleTransitivity){ PTRef eq1 = logic.mkEq(x,y); PTRef eq2 = logic.mkEq(y,z1); PTRef eq3 = logic.mkEq(z1,x); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(eq1); solver.insertFormula(eq2); @@ -81,8 +80,7 @@ TEST_F(UFInterpolationTest, test_SimpleTransitivityReversed){ PTRef eq1 = logic.mkEq(x,y); PTRef eq2 = logic.mkEq(y,z1); PTRef eq3 = logic.mkEq(z1,x); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkNot(eq3)); solver.insertFormula(eq2); @@ -107,8 +105,7 @@ TEST_F(UFInterpolationTest, test_SimpleCongruence){ */ PTRef eq1 = logic.mkEq(x,y); PTRef eq2 = logic.mkEq(logic.mkUninterpFun(f, {x}), logic.mkUninterpFun(f, {y})); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(eq1); solver.insertFormula(logic.mkNot(eq2)); @@ -128,8 +125,7 @@ TEST_F(UFInterpolationTest, test_SimpleCongruenceReversed){ */ PTRef eq1 = logic.mkEq(x,y); PTRef eq2 = logic.mkEq(logic.mkUninterpFun(f, {x}), logic.mkUninterpFun(f, {y})); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkNot(eq2)); solver.insertFormula(eq1); @@ -151,8 +147,7 @@ TEST_F(UFInterpolationTest, test_NotImmediatelyColorableCGraph){ PTRef eqA2 = logic.mkEq(logic.mkUninterpFun(g, {x,z2}),z3); PTRef eqB1 = logic.mkEq(y,z2); PTRef eqB2 = logic.mkEq(logic.mkUninterpFun(g, {z1,y}),z3); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkAnd(eqA1, eqA2)); solver.insertFormula(logic.mkAnd(eqB1, logic.mkNot(eqB2))); @@ -180,8 +175,7 @@ TEST_F(UFInterpolationTest, test_NotImmediatelyColorableCGraphReversed){ PTRef eqB2 = logic.mkEq(logic.mkUninterpFun(g, {x,z2}),z3); PTRef eqA1 = logic.mkEq(y,z2); PTRef eqA2 = logic.mkEq(logic.mkUninterpFun(g, {z1,y}),z3); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkAnd(eqA1, logic.mkNot(eqA2))); solver.insertFormula(logic.mkAnd(eqB1, eqB2)); @@ -219,8 +213,7 @@ TEST_F(UFInterpolationTest, test_JustificationRequired){ PTRef eqB4 = logic.mkEq(y1,z7); PTRef eqB5 = logic.mkEq(z8,y2); PTRef eqB6 = logic.mkEq(y1,y2); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkAnd({eqA1, eqA2, eqA3, eqA4, eqA5, eqA6, eqA7, eqA8})); solver.insertFormula(logic.mkAnd({eqB1, eqB2, eqB3, eqB4, eqB5, logic.mkNot(eqB6)})); @@ -259,8 +252,7 @@ TEST_F(UFInterpolationTest, test_JustificationRequiredReversed){ PTRef eqA4 = logic.mkEq(y1,z7); PTRef eqA5 = logic.mkEq(z8,y2); PTRef eqA6 = logic.mkEq(y1,y2); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkAnd({eqA1, eqA2, eqA3, eqA4, eqA5, logic.mkNot(eqA6)})); solver.insertFormula(logic.mkAnd({eqB1, eqB2, eqB3, eqB4, eqB5, eqB6, eqB7,eqB8})); @@ -286,8 +278,7 @@ TEST_F(UFInterpolationTest, test_SimpleUninterpretedPredicate){ PTRef eq = logic.mkEq(x,y); PTRef px = logic.mkUninterpFun(p, {x}); PTRef py = logic.mkUninterpFun(p, {y}); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(px); solver.insertFormula(eq); @@ -310,8 +301,7 @@ TEST_F(UFInterpolationTest, test_ConstantsConflict){ PTRef d = logic.mkConst(ufsort, "d"); PTRef eqA = logic.mkEq(c,x); PTRef eqB = logic.mkEq(x,d); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(eqA); solver.insertFormula(eqB); @@ -337,8 +327,7 @@ TEST_F(UFInterpolationTest, test_TwoLevelJustification){ PTRef eqA2 = logic.mkEq(logic.mkUninterpFun(f, {z2}), x2); PTRef eqA3 = logic.mkEq(z3,z4); PTRef dis = logic.mkNot(logic.mkEq(x1, x2)); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkAnd({eqA1, eqA2, eqA3, dis})); solver.insertFormula(logic.mkAnd({eqB1, eqB2})); @@ -369,8 +358,7 @@ TEST_F(UFInterpolationTest, test_TwoLevelJustificationDiseqInB){ PTRef eqA2 = logic.mkEq(logic.mkUninterpFun(f, {z2}), x2); PTRef eqA3 = logic.mkEq(z3,z4); PTRef dis = logic.mkNot(logic.mkEq(x1, x2)); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkAnd({eqA1, eqA2, eqA3})); solver.insertFormula(logic.mkAnd({eqB1, eqB2, dis})); @@ -432,8 +420,7 @@ TEST_F(UFInterpolationTest, test_LocalColorInformationInsufficient){ logic.mkNot(logic.mkEq(r1, r2)) }); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkAnd(eqB1, eqB2)); solver.insertFormula(A); @@ -456,8 +443,7 @@ TEST_F(UFInterpolationTest, test_DistinctInA){ PTRef eqA1 = logic.mkEq(x1,x2); PTRef eqA2 = logic.mkEq(x2,x3); PTRef deqB = logic.mkDistinct({x1,x4,x3}); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(logic.mkAnd(eqA1, eqA2)); solver.insertFormula(deqB); @@ -481,8 +467,7 @@ TEST_F(UFInterpolationTest, test_DistinctInB){ PTRef eqB1 = logic.mkEq(x1,x2); PTRef eqB2 = logic.mkEq(x2,x3); PTRef deqA = logic.mkDistinct({x1,x4,x3}); - const char* msg = "ok"; - config.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config.setOption(SMTConfig::o_produce_inter, SMTOption(true)); MainSolver solver(logic, config, "ufinterpolator"); solver.insertFormula(deqA); solver.insertFormula(logic.mkAnd(eqB1, eqB2)); From 1045ec62a36d8b4f9bb439f00484b5e4ed3e2199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 11:58:51 +0100 Subject: [PATCH 80/94] Parser: printer for nodes --- src/parsers/smt2new/ParseNodePrinter.h | 101 +++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 src/parsers/smt2new/ParseNodePrinter.h diff --git a/src/parsers/smt2new/ParseNodePrinter.h b/src/parsers/smt2new/ParseNodePrinter.h new file mode 100644 index 00000000..7b7955b6 --- /dev/null +++ b/src/parsers/smt2new/ParseNodePrinter.h @@ -0,0 +1,101 @@ +// +// Created by Antti Hyvärinen on 26.10.22. +// + +#ifndef OPENSMT_PARSENODEPRINTER_H +#define OPENSMT_PARSENODEPRINTER_H + +#include "smt2newcontext.h" +#include + +namespace opensmt { + +class nodeToString { +public: + std::string operator()(SymbolNode const & node) { + if (auto str = std::get_if>(&node.name)) { + return {**str}; + } else if (auto specConstNode = std::get_if>(&node.name)) { + return {*(**specConstNode).value}; + } + assert(false); + return {}; + } + std::string operator()(SortNode const & node) { + // Todo: better printing + return operator()(*node.identifier->symbol); + } + std::string operator()(IdentifierNode const & identifier) { + return operator()(*identifier.symbol); + } + std::string operator()(SExpr const * root) { + struct QEl { SExpr const * sexpr; unsigned long count; }; + std::vector childStrings; + std::vector stack; + stack.push_back({root, 0}); + while (not stack.empty()) { + auto & [sexpr, count] = stack.back(); + if (auto vec_p = std::get_if>>(&(*sexpr).data)) { + assert(*vec_p); + auto & vec = **vec_p; + if (count < vec.size()) { + // Note: the order is important since `count` is a reference to `stack` + ++count; + stack.push_back({ vec[count-1], 0 }); + continue; + } + // Vector, all children processed + auto childStringStart = childStrings.end() - vec.size(); + auto siblingString = std::accumulate(childStringStart, childStrings.end(), std::string(), + [](std::string & a, const std::string & b) { + return a += (a.empty() ? "" : " ") + b; + }); + childStrings.erase(childStringStart, childStrings.end()); + childStrings.emplace_back("(" + siblingString + ")"); + } else if (auto constNode = std::get_if>(&(*sexpr).data)) { + assert(*constNode); + childStrings.push_back(*(**constNode).value); + } else if (auto symbolNode = std::get_if>(&(*sexpr).data)) { + assert(*symbolNode); + childStrings.push_back(operator()(**symbolNode)); + } else if (auto string = std::get_if>(&(*sexpr).data)) { + assert(*string); + childStrings.push_back(**string); + } + stack.pop_back(); + } + if (auto sexprVec_p = std::get_if>>(&root->data)) { + auto sexprsString = std::accumulate((*sexprVec_p)->begin(), (*sexprVec_p)->end(), std::string{}, + [this](std::string & a, SExpr const * b) { + return a += (a.empty() ? "" : " ") + operator()(b); + }); + return "(" + sexprsString + ")"; + } else { + assert(childStrings.size() == 1); + return childStrings[0]; + } + } + std::string operator() (AttributeValueNode const & attributeValue) { + if (auto specConst_p = std::get_if>(&attributeValue.value)) { + return {*(**specConst_p).value}; + } else if (auto symbol_p = std::get_if>(&attributeValue.value)) { + return operator()(**symbol_p); + } else if (auto sexprVec_p = std::get_if>>(&attributeValue.value)) { + auto sexprsString = std::accumulate((*sexprVec_p)->begin(), (*sexprVec_p)->end(), std::string("("), + [this](std::string & a, SExpr const * b) { + return a += operator()(b) + ' '; + }); + return sexprsString += ')'; + } else { + assert(false); + return {}; + } + } +}; + + + + + +} +#endif // OPENSMT_PARSENODEPRINTER_H From 39a7872d227aad2d8e4a21801611d280b53092f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:08:25 +0100 Subject: [PATCH 81/94] Split regression: use booleans for options --- regression_splitting/patches/init_unsat-deep.smt2 | 4 ++-- regression_splitting/patches/init_unsat-lookahead.smt2 | 2 +- regression_splitting/patches/init_unsat-scatter.smt2 | 2 +- regression_splitting/patches/iso_brn164-deep.smt2 | 4 ++-- regression_splitting/patches/iso_brn164-lookahead.smt2 | 2 +- regression_splitting/patches/iso_brn164-scatter.smt2 | 2 +- ...ti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 | 4 ++-- ...rski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 | 2 +- ...tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-scatter.smt2 | 2 +- regression_splitting/patches/p2-zenonumeric_s6-deep.smt2 | 4 ++-- regression_splitting/patches/p2-zenonumeric_s6-lookahead.smt2 | 2 +- regression_splitting/patches/p2-zenonumeric_s6-scatter.smt2 | 2 +- regression_splitting/patches/small-deep.smt2 | 4 ++-- regression_splitting/patches/small-lookahead.smt2 | 2 +- regression_splitting/patches/small-scatter.smt2 | 2 +- .../tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 | 4 ++-- ..._startup_simple_startup_3nodes.synchro.base-lookahead.smt2 | 2 +- ...ta_startup_simple_startup_3nodes.synchro.base-scatter.smt2 | 2 +- regression_splitting/patches/unsat-2-incremental-scatter.smt2 | 2 +- regression_splitting/patches/unsat-2-scatter.smt2 | 2 +- regression_splitting/patches/unsat-4-scatter.smt2 | 2 +- 21 files changed, 27 insertions(+), 27 deletions(-) diff --git a/regression_splitting/patches/init_unsat-deep.smt2 b/regression_splitting/patches/init_unsat-deep.smt2 index b5c3b3b6..bae3d316 100644 --- a/regression_splitting/patches/init_unsat-deep.smt2 +++ b/regression_splitting/patches/init_unsat-deep.smt2 @@ -1,6 +1,6 @@ 0a1,7 -> (set-option :lookahead-split) -> (set-option :lookahead-score-deep) +> (set-option :lookahead-split true) +> (set-option :lookahead-score-deep true) > (set-option :split-num 64) > (set-option :output-dir "splits_here") > (set-option :test_cube_and_conquer true) diff --git a/regression_splitting/patches/init_unsat-lookahead.smt2 b/regression_splitting/patches/init_unsat-lookahead.smt2 index adce06e9..e5e31143 100644 --- a/regression_splitting/patches/init_unsat-lookahead.smt2 +++ b/regression_splitting/patches/init_unsat-lookahead.smt2 @@ -1,5 +1,5 @@ 0a1,6 -> (set-option :lookahead-split) +> (set-option :lookahead-split true) > (set-option :split-num 64) > (set-option :output-dir "splits_here") > (set-option :test_cube_and_conquer true) diff --git a/regression_splitting/patches/init_unsat-scatter.smt2 b/regression_splitting/patches/init_unsat-scatter.smt2 index 174d6ae1..b62b0762 100644 --- a/regression_splitting/patches/init_unsat-scatter.smt2 +++ b/regression_splitting/patches/init_unsat-scatter.smt2 @@ -1,4 +1,4 @@ 0a1,3 -> (set-option :scatter-split) +> (set-option :scatter-split true) > (set-option :split-num 2) > (set-option :output-dir "split_and_solve_work") diff --git a/regression_splitting/patches/iso_brn164-deep.smt2 b/regression_splitting/patches/iso_brn164-deep.smt2 index 3895a8cd..5963f7e4 100644 --- a/regression_splitting/patches/iso_brn164-deep.smt2 +++ b/regression_splitting/patches/iso_brn164-deep.smt2 @@ -1,8 +1,8 @@ 0a1 -> (set-option :lookahead-split) +> (set-option :lookahead-split true) 5a7,13 > -> (set-option :lookahead-score-deep) +> (set-option :lookahead-score-deep true) > (set-option :split-num 16) > (set-option :output-dir "splits_here") > diff --git a/regression_splitting/patches/iso_brn164-lookahead.smt2 b/regression_splitting/patches/iso_brn164-lookahead.smt2 index 97a45b79..ed972d1c 100644 --- a/regression_splitting/patches/iso_brn164-lookahead.smt2 +++ b/regression_splitting/patches/iso_brn164-lookahead.smt2 @@ -1,5 +1,5 @@ 0a1 -> (set-option :lookahead-split) +> (set-option :lookahead-split true) 5a7,12 > > (set-option :split-num 16) diff --git a/regression_splitting/patches/iso_brn164-scatter.smt2 b/regression_splitting/patches/iso_brn164-scatter.smt2 index 174d6ae1..b62b0762 100644 --- a/regression_splitting/patches/iso_brn164-scatter.smt2 +++ b/regression_splitting/patches/iso_brn164-scatter.smt2 @@ -1,4 +1,4 @@ 0a1,3 -> (set-option :scatter-split) +> (set-option :scatter-split true) > (set-option :split-num 2) > (set-option :output-dir "split_and_solve_work") diff --git a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 index b5c3b3b6..bae3d316 100644 --- a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 +++ b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 @@ -1,6 +1,6 @@ 0a1,7 -> (set-option :lookahead-split) -> (set-option :lookahead-score-deep) +> (set-option :lookahead-split true) +> (set-option :lookahead-score-deep true) > (set-option :split-num 64) > (set-option :output-dir "splits_here") > (set-option :test_cube_and_conquer true) diff --git a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 index adce06e9..e5e31143 100644 --- a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 +++ b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 @@ -1,5 +1,5 @@ 0a1,6 -> (set-option :lookahead-split) +> (set-option :lookahead-split true) > (set-option :split-num 64) > (set-option :output-dir "splits_here") > (set-option :test_cube_and_conquer true) diff --git a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-scatter.smt2 b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-scatter.smt2 index 174d6ae1..b62b0762 100644 --- a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-scatter.smt2 +++ b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-scatter.smt2 @@ -1,4 +1,4 @@ 0a1,3 -> (set-option :scatter-split) +> (set-option :scatter-split true) > (set-option :split-num 2) > (set-option :output-dir "split_and_solve_work") diff --git a/regression_splitting/patches/p2-zenonumeric_s6-deep.smt2 b/regression_splitting/patches/p2-zenonumeric_s6-deep.smt2 index f9ac28b0..ec8b943a 100644 --- a/regression_splitting/patches/p2-zenonumeric_s6-deep.smt2 +++ b/regression_splitting/patches/p2-zenonumeric_s6-deep.smt2 @@ -1,6 +1,6 @@ 0a1,7 -> (set-option :lookahead-split) -> (set-option :lookahead-score-deep) +> (set-option :lookahead-split true) +> (set-option :lookahead-score-deep true) > (set-option :split-num 8) > (set-option :output-dir "split_and_solve_work") > diff --git a/regression_splitting/patches/p2-zenonumeric_s6-lookahead.smt2 b/regression_splitting/patches/p2-zenonumeric_s6-lookahead.smt2 index 0a4dc745..1cf4241c 100644 --- a/regression_splitting/patches/p2-zenonumeric_s6-lookahead.smt2 +++ b/regression_splitting/patches/p2-zenonumeric_s6-lookahead.smt2 @@ -1,5 +1,5 @@ 0a1,6 -> (set-option :lookahead-split) +> (set-option :lookahead-split true) > (set-option :split-num 8) > (set-option :output-dir "split_and_solve_work") > diff --git a/regression_splitting/patches/p2-zenonumeric_s6-scatter.smt2 b/regression_splitting/patches/p2-zenonumeric_s6-scatter.smt2 index 174d6ae1..b62b0762 100644 --- a/regression_splitting/patches/p2-zenonumeric_s6-scatter.smt2 +++ b/regression_splitting/patches/p2-zenonumeric_s6-scatter.smt2 @@ -1,4 +1,4 @@ 0a1,3 -> (set-option :scatter-split) +> (set-option :scatter-split true) > (set-option :split-num 2) > (set-option :output-dir "split_and_solve_work") diff --git a/regression_splitting/patches/small-deep.smt2 b/regression_splitting/patches/small-deep.smt2 index f8f344e4..9c1055d6 100644 --- a/regression_splitting/patches/small-deep.smt2 +++ b/regression_splitting/patches/small-deep.smt2 @@ -1,6 +1,6 @@ 0a1,5 -> (set-option :lookahead-split) -> (set-option :lookahead-score-deep) +> (set-option :lookahead-split true) +> (set-option :lookahead-score-deep true) > (set-option :output-dir "splits_here") > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/small-lookahead.smt2 b/regression_splitting/patches/small-lookahead.smt2 index bf0c4982..06cac631 100644 --- a/regression_splitting/patches/small-lookahead.smt2 +++ b/regression_splitting/patches/small-lookahead.smt2 @@ -1,5 +1,5 @@ 0a4 -> (set-option :lookahead-split) +> (set-option :lookahead-split true) > (set-option :output-dir "splits_here") > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/small-scatter.smt2 b/regression_splitting/patches/small-scatter.smt2 index 174d6ae1..b62b0762 100644 --- a/regression_splitting/patches/small-scatter.smt2 +++ b/regression_splitting/patches/small-scatter.smt2 @@ -1,4 +1,4 @@ 0a1,3 -> (set-option :scatter-split) +> (set-option :scatter-split true) > (set-option :split-num 2) > (set-option :output-dir "split_and_solve_work") diff --git a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 index b5c3b3b6..bae3d316 100644 --- a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 +++ b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 @@ -1,6 +1,6 @@ 0a1,7 -> (set-option :lookahead-split) -> (set-option :lookahead-score-deep) +> (set-option :lookahead-split true) +> (set-option :lookahead-score-deep true) > (set-option :split-num 64) > (set-option :output-dir "splits_here") > (set-option :test_cube_and_conquer true) diff --git a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-lookahead.smt2 b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-lookahead.smt2 index adce06e9..e5e31143 100644 --- a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-lookahead.smt2 +++ b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-lookahead.smt2 @@ -1,5 +1,5 @@ 0a1,6 -> (set-option :lookahead-split) +> (set-option :lookahead-split true) > (set-option :split-num 64) > (set-option :output-dir "splits_here") > (set-option :test_cube_and_conquer true) diff --git a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-scatter.smt2 b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-scatter.smt2 index 174d6ae1..b62b0762 100644 --- a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-scatter.smt2 +++ b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-scatter.smt2 @@ -1,4 +1,4 @@ 0a1,3 -> (set-option :scatter-split) +> (set-option :scatter-split true) > (set-option :split-num 2) > (set-option :output-dir "split_and_solve_work") diff --git a/regression_splitting/patches/unsat-2-incremental-scatter.smt2 b/regression_splitting/patches/unsat-2-incremental-scatter.smt2 index 6d5e7a63..17607b1b 100644 --- a/regression_splitting/patches/unsat-2-incremental-scatter.smt2 +++ b/regression_splitting/patches/unsat-2-incremental-scatter.smt2 @@ -1,6 +1,6 @@ 0a1,4 > -> (set-option :scatter-split) +> (set-option :scatter-split true) > (set-option :split-num 2) > (set-option :output-dir "split_and_solve_work") 9c13,14 diff --git a/regression_splitting/patches/unsat-2-scatter.smt2 b/regression_splitting/patches/unsat-2-scatter.smt2 index 174d6ae1..b62b0762 100644 --- a/regression_splitting/patches/unsat-2-scatter.smt2 +++ b/regression_splitting/patches/unsat-2-scatter.smt2 @@ -1,4 +1,4 @@ 0a1,3 -> (set-option :scatter-split) +> (set-option :scatter-split true) > (set-option :split-num 2) > (set-option :output-dir "split_and_solve_work") diff --git a/regression_splitting/patches/unsat-4-scatter.smt2 b/regression_splitting/patches/unsat-4-scatter.smt2 index 7a1d24d8..0e207bc0 100644 --- a/regression_splitting/patches/unsat-4-scatter.smt2 +++ b/regression_splitting/patches/unsat-4-scatter.smt2 @@ -1,4 +1,4 @@ 0a1,3 -> (set-option :scatter-split) +> (set-option :scatter-split true) > (set-option :split-num 4) > (set-option :output-dir "split_and_solve_work") From 1a41d10234fe0c1055d433d38926b1bb4cd76d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:09:08 +0100 Subject: [PATCH 82/94] Split regression: Use correct output directory --- regression_splitting/patches/init_unsat-deep.smt2 | 2 +- regression_splitting/patches/init_unsat-lookahead.smt2 | 2 +- regression_splitting/patches/iso_brn164-deep.smt2 | 2 +- regression_splitting/patches/iso_brn164-lookahead.smt2 | 2 +- ...meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 | 2 +- ...tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 | 2 +- regression_splitting/patches/small-deep.smt2 | 2 +- regression_splitting/patches/small-lookahead.smt2 | 2 +- .../tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 | 2 +- ...ta_startup_simple_startup_3nodes.synchro.base-lookahead.smt2 | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/regression_splitting/patches/init_unsat-deep.smt2 b/regression_splitting/patches/init_unsat-deep.smt2 index bae3d316..0c2b2cfd 100644 --- a/regression_splitting/patches/init_unsat-deep.smt2 +++ b/regression_splitting/patches/init_unsat-deep.smt2 @@ -2,7 +2,7 @@ > (set-option :lookahead-split true) > (set-option :lookahead-score-deep true) > (set-option :split-num 64) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > (set-option :test_cube_and_conquer true) > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/init_unsat-lookahead.smt2 b/regression_splitting/patches/init_unsat-lookahead.smt2 index e5e31143..d75fbcfb 100644 --- a/regression_splitting/patches/init_unsat-lookahead.smt2 +++ b/regression_splitting/patches/init_unsat-lookahead.smt2 @@ -1,7 +1,7 @@ 0a1,6 > (set-option :lookahead-split true) > (set-option :split-num 64) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > (set-option :test_cube_and_conquer true) > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/iso_brn164-deep.smt2 b/regression_splitting/patches/iso_brn164-deep.smt2 index 5963f7e4..361f5751 100644 --- a/regression_splitting/patches/iso_brn164-deep.smt2 +++ b/regression_splitting/patches/iso_brn164-deep.smt2 @@ -4,7 +4,7 @@ > > (set-option :lookahead-score-deep true) > (set-option :split-num 16) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/iso_brn164-lookahead.smt2 b/regression_splitting/patches/iso_brn164-lookahead.smt2 index ed972d1c..b23767ab 100644 --- a/regression_splitting/patches/iso_brn164-lookahead.smt2 +++ b/regression_splitting/patches/iso_brn164-lookahead.smt2 @@ -3,7 +3,7 @@ 5a7,12 > > (set-option :split-num 16) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 index bae3d316..0c2b2cfd 100644 --- a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 +++ b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-deep.smt2 @@ -2,7 +2,7 @@ > (set-option :lookahead-split true) > (set-option :lookahead-score-deep true) > (set-option :split-num 64) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > (set-option :test_cube_and_conquer true) > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 index e5e31143..d75fbcfb 100644 --- a/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 +++ b/regression_splitting/patches/meti-tarski_sqrt_1mcosq_7_sqrt-1mcosq-7-chunk-0100-lookahead.smt2 @@ -1,7 +1,7 @@ 0a1,6 > (set-option :lookahead-split true) > (set-option :split-num 64) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > (set-option :test_cube_and_conquer true) > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/small-deep.smt2 b/regression_splitting/patches/small-deep.smt2 index 9c1055d6..3b75dcd7 100644 --- a/regression_splitting/patches/small-deep.smt2 +++ b/regression_splitting/patches/small-deep.smt2 @@ -1,6 +1,6 @@ 0a1,5 > (set-option :lookahead-split true) > (set-option :lookahead-score-deep true) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/small-lookahead.smt2 b/regression_splitting/patches/small-lookahead.smt2 index 06cac631..355f75c6 100644 --- a/regression_splitting/patches/small-lookahead.smt2 +++ b/regression_splitting/patches/small-lookahead.smt2 @@ -1,5 +1,5 @@ 0a4 > (set-option :lookahead-split true) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 index bae3d316..0c2b2cfd 100644 --- a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 +++ b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-deep.smt2 @@ -2,7 +2,7 @@ > (set-option :lookahead-split true) > (set-option :lookahead-score-deep true) > (set-option :split-num 64) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > (set-option :test_cube_and_conquer true) > (set-option :split-format-length "brief") > (set-option :split-format smt2) diff --git a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-lookahead.smt2 b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-lookahead.smt2 index e5e31143..d75fbcfb 100644 --- a/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-lookahead.smt2 +++ b/regression_splitting/patches/tta_startup_simple_startup_3nodes.synchro.base-lookahead.smt2 @@ -1,7 +1,7 @@ 0a1,6 > (set-option :lookahead-split true) > (set-option :split-num 64) -> (set-option :output-dir "splits_here") +> (set-option :output-dir "split_and_solve_work") > (set-option :test_cube_and_conquer true) > (set-option :split-format-length "brief") > (set-option :split-format smt2) From 1f0d6d6e54420cae48635fedb9161148bc322274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:10:23 +0100 Subject: [PATCH 83/94] SplitterInterpret: Reintroduce splitting --- src/api/Interpret.cc | 4 ++++ src/api/Interpret.h | 1 + src/parallel/SplitterInterpret.cc | 19 ++++++++++++++++++- src/parallel/SplitterInterpret.h | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index b0f9aea6..4e4c419a 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -323,7 +323,10 @@ void Interpret::interp(CheckSatNode const &) { notify_formatted(true, "Illegal command before set-logic: check-sat"); return; } + (void)checkSat(); +} +sstat Interpret::checkSat() { sstat res; res = main_solver->check(); @@ -353,6 +356,7 @@ void Interpret::interp(CheckSatNode const &) { if (!o_dump_state.isEmpty() && o_split == spt_none) writeState(name); } + return res; } namespace { diff --git a/src/api/Interpret.h b/src/api/Interpret.h index 4a0dccfa..e8ae96d4 100644 --- a/src/api/Interpret.h +++ b/src/api/Interpret.h @@ -190,6 +190,7 @@ class Interpret { PTRef resolveQualifiedIdentifier(std::string const & name, SortNode const & sort, bool isQuoted); SRef sortFromSortNode(SortNode const & node) const; + virtual sstat checkSat(); virtual std::unique_ptr createMainSolver(std::string const & logic_name); public: diff --git a/src/parallel/SplitterInterpret.cc b/src/parallel/SplitterInterpret.cc index 30390a7a..0c7831da 100644 --- a/src/parallel/SplitterInterpret.cc +++ b/src/parallel/SplitterInterpret.cc @@ -44,4 +44,21 @@ sstat SplitterInterpret::interpSMTContent(char *content, vec SplitterInterpret::createMainSolver(std::string const & logic_name) { + if (config.sat_split_type() != spt_none) { + auto th = MainSolver::createTheory(*logic, config); + auto tm = std::make_unique(*logic); + auto thandler = new THandler(*th, *tm); + return std::make_unique(std::move(th), + std::move(tm), + std::unique_ptr(thandler), + MainSplitter::createInnerSolver(config, *thandler, channel), + *logic, + config, + std::string(logic_name) + + " splitter"); + } else + return std::make_unique(*logic, config, std::string(logic_name) + " solver"); +} diff --git a/src/parallel/SplitterInterpret.h b/src/parallel/SplitterInterpret.h index ee35a6b5..86f245b3 100644 --- a/src/parallel/SplitterInterpret.h +++ b/src/parallel/SplitterInterpret.h @@ -18,6 +18,7 @@ class SplitterInterpret : public Interpret { protected: void writeSplits(std::string const & filename); + std::unique_ptr createMainSolver(std::string const & logic_name) override; sstat checkSat() override; void exit() override { return; } From 633f8808bc632b84a894c9c283edab27ae55fac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:11:38 +0100 Subject: [PATCH 84/94] SplitterInterpret: Fix handling of output file name --- src/options/SMTConfig.h | 2 +- src/parallel/SplitterInterpret.cc | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index bf7924f0..896ee5c4 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -462,7 +462,7 @@ struct SMTConfig inline void setLRAStrengthFactor(const char *factor) { insertOption(o_itp_lra_factor, SMTOption(factor)); } - inline void setInstanceName(const char* name) { insertOption(o_inst_name, SMTOption(name)); } + inline void setInstanceName(std::string && name) { insertOption(o_inst_name, SMTOption(std::move(name))); } // Get interpolation algorithms inline ItpAlgorithm getBooleanInterpolationAlgorithm() const { diff --git a/src/parallel/SplitterInterpret.cc b/src/parallel/SplitterInterpret.cc index 0c7831da..7e5ba81e 100644 --- a/src/parallel/SplitterInterpret.cc +++ b/src/parallel/SplitterInterpret.cc @@ -28,7 +28,10 @@ sstat SplitterInterpret::checkSat() { auto name = config.dump_state(); sstat res = Interpret::checkSat(); - if (res == s_Undef and not config.output_dir().empty()) { + if (res == s_Undef) { + if (not config.output_dir().empty()) { + name = config.output_dir().append(name, name.rfind('/'), std::string::npos); + } writeSplits(name); } return res; From 05ea4ea083b1c3216ea0966e58538059d38ab9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:12:09 +0100 Subject: [PATCH 85/94] SplitterInterpret: use signed integers in options --- src/options/SMTConfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/options/SMTConfig.h b/src/options/SMTConfig.h index 896ee5c4..77e25cc7 100644 --- a/src/options/SMTConfig.h +++ b/src/options/SMTConfig.h @@ -736,7 +736,7 @@ struct SMTConfig optionTable.at(o_sat_split_midtune).getDoubleVal() : -1; } - uint32_t sat_split_num() const { + int sat_split_num() const { return optionTable.find(o_sat_split_num) != optionTable.end() ? optionTable.at(o_sat_split_num).getIntVal() : 2; From a518749d5468c83c814674f6680bbc2a7418128c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:12:40 +0100 Subject: [PATCH 86/94] SplitterInterpret: fix initialization --- src/parallel/opensmtSplitter.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/parallel/opensmtSplitter.cc b/src/parallel/opensmtSplitter.cc index 05246e18..c17d949a 100644 --- a/src/parallel/opensmtSplitter.cc +++ b/src/parallel/opensmtSplitter.cc @@ -81,17 +81,14 @@ int main( int argc, char * argv[] ) // context.getConfig( ).printHelp( ); break; case 'd': - const char* msg; - c.setOption(SMTConfig::o_dryrun, SMTOption(true), msg); + c.setOption(SMTConfig::o_dryrun, SMTOption(true)); break; case 'r': - if (!c.setOption(SMTConfig::o_random_seed, SMTOption(atoi(optarg)), msg)) - fprintf(stderr, "Error setting random seed: %s\n", msg); - else - fprintf(stderr, "; Using random seed %d\n", atoi(optarg)); + c.setOption(SMTConfig::o_random_seed, SMTOption(atoi(optarg))); + fprintf(stderr, "; Using random seed %d\n", atoi(optarg)); break; case 'i': - c.setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + c.setOption(SMTConfig::o_produce_inter, SMTOption(true)); break; case 'p': pipe = true; @@ -189,13 +186,14 @@ void interpretInteractive(SplitterInterpret & interpret) { // Parsing should be done from a string that I get from the readline // library. Smt2newContext context(parse_buf); - int rval = smt2newparse(&context); + int rval = yyparse(&context); if (rval != 0) interpret.reportError("scanner"); else { - const ASTNode* r = context.getRoot(); - interpret.execute(r); - done = interpret.gotExit(); + for (auto command : context.getRoot()) { + if (rval == 0 and not interpret.gotExit()) { interpret.interp(command); } + delete command; + } } add_history(parse_buf); pb_sz = 0; From 98bc0a4d9491989ef8d3efa95b11808b68d0dd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:13:44 +0100 Subject: [PATCH 87/94] Regression: Fix error message --- regression/QF_BV/bar.smt2.expected.out | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regression/QF_BV/bar.smt2.expected.out b/regression/QF_BV/bar.smt2.expected.out index a4cf0f18..dc2c1f94 100644 --- a/regression/QF_BV/bar.smt2.expected.out +++ b/regression/QF_BV/bar.smt2.expected.out @@ -1 +1 @@ -At line 4: syntax error, unexpected TK_SYM, expecting TK_NUM or ')' +At line 4: syntax error, unexpected TK_SYM, expecting TK_INT or ')' From 45ff0f911ca22b1eae6f62174e737193cc570eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:29:52 +0100 Subject: [PATCH 88/94] examples: fix setOption signature --- examples/test_itp.cc | 6 ++---- examples/test_lra_itp.cc | 6 ++---- examples/test_lra_value.cc | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/examples/test_itp.cc b/examples/test_itp.cc index 350f7bcb..0a76396e 100644 --- a/examples/test_itp.cc +++ b/examples/test_itp.cc @@ -5,8 +5,7 @@ Opensmt* pre() { auto config = std::make_unique(); - const char* msg; - config->setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config->setOption(SMTConfig::o_produce_inter, SMTOption(true)); Opensmt* osmt = new Opensmt(opensmt_logic::qf_lra, "test solver", std::move(config)); return osmt; } @@ -50,8 +49,7 @@ int main() { printf("unsat\n"); // Set labeling function - const char* msg; - c.setOption(SMTConfig::o_itp_bool_alg, SMTOption(0), msg); + c.setOption(SMTConfig::o_itp_bool_alg, SMTOption(0)); auto itp_context = mainSolver.getInterpolationContext(); // Create the partitioning mask diff --git a/examples/test_lra_itp.cc b/examples/test_lra_itp.cc index 8a2196c1..ff5567a2 100644 --- a/examples/test_lra_itp.cc +++ b/examples/test_lra_itp.cc @@ -5,8 +5,7 @@ Opensmt* pre() { auto config = std::make_unique(); - const char* msg; - config->setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config->setOption(SMTConfig::o_produce_inter, SMTOption(true)); Opensmt* osmt = new Opensmt(opensmt_logic::qf_lra, "test solver", std::move(config)); return osmt; } @@ -57,8 +56,7 @@ int main() { printf("unsat\n"); // Set labeling function - const char* msg; - c.setOption(SMTConfig::o_itp_bool_alg, SMTOption(0), msg); + c.setOption(SMTConfig::o_itp_bool_alg, SMTOption(0)); // Create the proof graph auto itp_context = mainSolver.getInterpolationContext(); diff --git a/examples/test_lra_value.cc b/examples/test_lra_value.cc index 2a738dc4..3ad3d6c2 100644 --- a/examples/test_lra_value.cc +++ b/examples/test_lra_value.cc @@ -5,8 +5,7 @@ Opensmt* pre() { auto config = std::unique_ptr(new SMTConfig()); - const char* msg; - config->setOption(SMTConfig::o_produce_inter, SMTOption(true), msg); + config->setOption(SMTConfig::o_produce_inter, SMTOption(true)); Opensmt* osmt = new Opensmt(opensmt_logic::qf_lra, "test solver", std::move(config)); return osmt; } @@ -90,8 +89,7 @@ int main() { printf("unsat\n"); // Set labeling function - const char* msg; - c.setOption(SMTConfig::o_itp_bool_alg, SMTOption(0), msg); + c.setOption(SMTConfig::o_itp_bool_alg, SMTOption(0)); auto itp_context = mainSolver.getInterpolationContext(); // Create the partitioning mask From 742bd5600e8c229ba7c625695aea23b3f1f58caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:30:19 +0100 Subject: [PATCH 89/94] Build: add missing includes to install --- src/common/CMakeLists.txt | 2 +- src/parsers/smt2new/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 57bc5605..5e0d21f3 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -24,7 +24,7 @@ target_sources(common install(FILES Integer.h Number.h FastRational.h XAlloc.h Alloc.h StringMap.h Timer.h osmtinttypes.h TreeOps.h Real.h FlaPartitionMap.h PartitionInfo.h OsmtApiException.h TypeUtils.h - NumberUtils.h NatSet.h + NumberUtils.h NatSet.h OsmtInternalException.h DESTINATION ${INSTALL_HEADERS_DIR}) diff --git a/src/parsers/smt2new/CMakeLists.txt b/src/parsers/smt2new/CMakeLists.txt index 290fabfa..e0f4f326 100644 --- a/src/parsers/smt2new/CMakeLists.txt +++ b/src/parsers/smt2new/CMakeLists.txt @@ -24,5 +24,5 @@ target_sources(parsers target_compile_options(parsers PRIVATE -Wno-error) -install(FILES smt2newcontext.h +install(FILES smt2newcontext.h ParseNodePrinter.h DESTINATION ${INSTALL_HEADERS_DIR}) From 0c1dce69a2a4f7e6a452a382a94a99474886db1d Mon Sep 17 00:00:00 2001 From: aehyvari Date: Mon, 31 Oct 2022 17:51:00 +0100 Subject: [PATCH 90/94] Parser: add missing include --- src/parsers/smt2new/smt2newcontext.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parsers/smt2new/smt2newcontext.h b/src/parsers/smt2new/smt2newcontext.h index d273e3ac..1584af7c 100644 --- a/src/parsers/smt2new/smt2newcontext.h +++ b/src/parsers/smt2new/smt2newcontext.h @@ -32,6 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include enum class ConstType { integral, From ed0509cf445fd6e325a539ee9e9fb6ab42835872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 17:57:27 +0100 Subject: [PATCH 91/94] parser: remove handwritten parser --- src/api/handwritten.h | 253 ------------------------------------------ 1 file changed, 253 deletions(-) delete mode 100644 src/api/handwritten.h diff --git a/src/api/handwritten.h b/src/api/handwritten.h deleted file mode 100644 index 0b70dab3..00000000 --- a/src/api/handwritten.h +++ /dev/null @@ -1,253 +0,0 @@ -// -// Created by Antti Hyvarinen on 29.08.22. -// - -#ifndef OPENSMT_HANDWRITTEN_H -#define OPENSMT_HANDWRITTEN_H -#include "smt2tokens.h" - -#include -#include -#include -#include -#include - - -class OsmtParserException: public std::exception { - std::string msg; -public: - OsmtParserException(const std::string & msg) : msg(msg) {} - virtual const char* what() const noexcept override { return msg.c_str(); } -}; - -class Expr {}; -class EmptyExpr : public Expr {}; -class DeclareFun : public Expr {}; - -struct Token { - std::string name; - osmttokens::token token; - opensmt::pair pos = {0, 0}; - Expr * parsedType = nullptr; -}; - -struct SExpr { - std::variant> data; - std::string toString() const { - if (auto token_p = std::get_if(&data)) { - return (token_p->name); - } else if (auto vec_p = std::get_if>(&data)) { - std::string out = "("; - for (unsigned long i = 0; i != vec_p->size(); ++i) { - out += (*vec_p)[i]->toString() + (i == vec_p->size()-1 ? "" : " "); - } - out += ")"; - return out; - } - assert(false); - return {}; - } -}; - -class SExprParser { - std::istream & input; - char token = 0; - std::vector stack; - uint32_t line = 0; - uint32_t column = 0; - - static bool isWhiteSpace(char token) { - return (token == ' ' or token == '\t' or token == '\r' or token == '\n'); - } - - char get() { - auto c = static_cast(input.get()); - if (c == '\n') { ++ line; column = 0; } - ++ column; - return c; - } - - void advance(bool comments = true) { - token = get(); - if (comments and token == ';') { - while (token != '\n' and token != 0) { - token = static_cast(get()); - } - } - } - - void skipWhitespace() { - while (isWhiteSpace(token)) { - advance(); - } - } - - osmttokens::token resolveToken(std::string const & name) { - if (osmttokens::nameToToken.find(name) != osmttokens::nameToToken.end()) { - return osmttokens::nameToToken.at(name); - } else { - return osmttokens::t_none; - } - } - - Token parseToken() { - std::string result; - skipWhitespace(); - opensmt::pair tokenStartPos {line, column}; - bool inQuotedSymbol = token == '|'; - bool inString = token == '"'; - bool isString = inString; - - if (inQuotedSymbol) { - advance(false); - } - while (token != 0) { - char c = token; - if (inQuotedSymbol and c == '|') { - advance(); - break; - } else if (inString and result.size() > 1 and c == '"') { - inString = false; - } else if (not inQuotedSymbol and not inString and (isWhiteSpace(token) or c == '(' or c == ')')) { - break; - } - result.push_back(c); - advance(not inString and not inQuotedSymbol); - } - osmttokens::token type = isString ? osmttokens::t_STRING : resolveToken(result); - return {result, type, tokenStartPos}; - } - - void parseError(std::string const & error) { - throw OsmtParserException("At line " + std::to_string(line) + ", column " + std::to_string(column) + ": " + error); - } - -public: - SExprParser(std::istream & input) : input(input), token(' '), line(1) {} - - bool isEOF() { - skipWhitespace(); - return input.eof(); - } - - SExpr * parseExpr() { - while (not isEOF()) { - skipWhitespace(); - if (token == '(') { - stack.emplace_back(new SExpr{std::vector()}); - advance(); - skipWhitespace(); - } else if (token == ')') { - if (stack.empty()) { - parseError("Unexpected `" + std::string(1, token) + "`"); - } else if (stack.size() == 1) { - advance(); - skipWhitespace(); - break; - } else { - // Copy the contents of this stack to the SExpr in the previous frame. - auto & prevData = std::get>((stack.rbegin()[1])->data); - prevData.emplace_back(stack.back()); - assert(stack.size() > 1); - stack.pop_back(); - advance(); - skipWhitespace(); - } - } else { - if (stack.empty()) { - parseError("Expected `(` or `;`, got " + std::string(1, token)); - } - assert(not stack.empty()); - auto & currentData = std::get>(stack.back()->data); - currentData.emplace_back(new SExpr{parseToken()}); - } - } - if (stack.size() != 1) { - parseError("Unexpected EOF"); - } - assert(stack.size() == 1); - auto res = stack[0]; - stack.pop_back(); - return res; - } -}; - -class HandWrittenParser { - std::istream & input; - -public: - HandWrittenParser(std::istream & input) : input(input) {} - template void traverse(SExpr * root, F & op) { - struct Qel { SExpr * node; uint32_t processed; }; - std::vector queue; - queue.emplace_back(Qel{root, static_cast(0)}); - while (not queue.empty()) { - auto & [node, processed] = queue.back(); - auto children = std::get_if>(&node->data); - if (children and processed < children->size()) { - ++ processed; - queue.emplace_back(Qel{(*children)[processed-1], 0}); - continue; - } - assert(not children or processed == children->size()); - assert(node); - op(node); - queue.pop_back(); - } - } - void parse() { - SExprParser parser(input); - class Counter { - uint32_t count = 0; - public: - void operator() (SExpr *) { - ++ count; - } - uint32_t getCount() const { return count; } - }; - class Deleter { - public: - void operator() (SExpr * e) { - delete e; - } - }; - - class Printer { - void error(Token * token, std::string const & msg) { - std::cout << "At line " - << std::to_string(token->pos.first) - << " column " - << std::to_string(token->pos.second) - << ", " - << token->name << " " << msg << std::endl; - } - public: - Expr * operator() (SExpr * e) { - if (auto expr_p = std::get_if>(&e->data)) { - if (expr_p->empty()) { return new EmptyExpr(); } - if (auto token_p = std::get_if(&((*expr_p)[0])->data)) { - if (token_p->token == osmttokens::t_declarefun) { - if (expr_p->size() != 3) { error(token_p, "expected 3 arguments"); } - } - } - } - return nullptr; - } - }; -// Counter counter; - Printer printer; - Deleter deleter; - while (not parser.isEOF()) { - try { - auto sexpr = parser.parseExpr(); - traverse(sexpr, printer); - traverse(sexpr, deleter); - } catch (OsmtParserException const & e) { - std::cout << e.what() << std::endl; - break; - } - } -// std::cout << std::to_string(counter.getCount()) << std::endl; - } -}; -#endif // OPENSMT_HANDWRITTEN_H \ No newline at end of file From 4846d7b351bc23d437e97e6cad3b247fa598f661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 18:27:06 +0100 Subject: [PATCH 92/94] Interpret: Throw error on forall and exists --- src/api/Interpret.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/Interpret.cc b/src/api/Interpret.cc index 4e4c419a..7c3c781b 100644 --- a/src/api/Interpret.cc +++ b/src/api/Interpret.cc @@ -667,9 +667,11 @@ PTRef Interpret::parseTerm(NormalTermNode const * term, LetRecords & letRecords) } PTRef Interpret::parseTerm(ForallNode const *, LetRecords &) { + throw OsmtApiException("Forall not implemented"); return PTRef_Undef; } PTRef Interpret::parseTerm(ExistsNode const *, LetRecords &) { + throw OsmtApiException("Exists not implemented"); return PTRef_Undef; } From 9e840953d13b840d16a6004436b8a6ae3e3a3624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 18:27:36 +0100 Subject: [PATCH 93/94] Parser: remove unused structure --- src/api/smt2tokens.h | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/src/api/smt2tokens.h b/src/api/smt2tokens.h index 20b6035d..42aa1e68 100644 --- a/src/api/smt2tokens.h +++ b/src/api/smt2tokens.h @@ -150,44 +150,7 @@ namespace osmttokens { {t_let, "let"}, {t_echo, "echo"} }; - inline const std::unordered_map nameToToken = { - {"none", t_none}, - {"as", t_as}, - {"decimal", t_DECIMAL}, - {"numeral", t_NUMERAL}, - {"par", t_par}, - {"string", t_STRING}, - {"exists", t_exists}, - {"forall", t_forall}, - {"assert", t_assert}, - {"check-sat", t_checksat}, - {"declare-sort", t_declaresort}, - {"define-sort", t_definesort}, - {"declare-fun", t_declarefun}, - {"declare-const", t_declareconst}, - {"define-fun", t_definefun}, - {"exit", t_exit}, - {"get-assertions", t_getassertions}, - {"get-assignment", t_getassignment}, - {"get-info", t_getinfo}, - {"set-info", t_setinfo}, - {"get-option", t_getoption}, - {"set-option", t_setoption}, - {"get-proof", t_getproof}, - {"get-unsat-core", t_getunsatcore}, - {"get-value", t_getvalue}, - {"get-model", t_getmodel}, - {"pop", t_pop}, - {"push", t_push}, - {"set-logic", t_setlogic}, - {"get-interpolants", t_getinterpolants}, - {"theory", t_theory}, - {"write-state", t_writestate}, - {"read-state", t_readstate}, - {"simplify", t_simplify}, - {"let", t_let}, - {"echo", t_echo} - }; + struct smt2token { token x; }; From 406e76dfee20cab5db896c1223c11d36a144ec29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Hyv=C3=A4rinen?= Date: Mon, 31 Oct 2022 18:27:57 +0100 Subject: [PATCH 94/94] unit test: remove empty test --- test/unit/CMakeLists.txt | 8 -------- test/unit/test_ParserSymbols.cc | 11 ----------- 2 files changed, 19 deletions(-) delete mode 100644 test/unit/test_ParserSymbols.cc diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index f543db09..9d54259b 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -245,11 +245,3 @@ PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/test_SATSolverTypes.cc" target_link_libraries(SATSolverTypesTest OpenSMT gtest gtest_main) gtest_add_tests(TARGET SATSolverTypesTest) - -add_executable(ParserSymbolsTest) -target_sources(ParserSymbolsTest -PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/test_ParserSymbols.cc" -) - -target_link_libraries(ParserSymbolsTest OpenSMT gtest gtest_main) -gtest_add_tests(TARGET ParserSymbolsTest) diff --git a/test/unit/test_ParserSymbols.cc b/test/unit/test_ParserSymbols.cc deleted file mode 100644 index 0e98f2fc..00000000 --- a/test/unit/test_ParserSymbols.cc +++ /dev/null @@ -1,11 +0,0 @@ -// -// Created by Antti Hyvärinen on 20.09.22. -// - -#include -#include - -TEST(ParserSymbolsTest, test_DeclareSort) { -// auto str = new std::string("foo"); -// (void)SymbolNode{{}, std::unique_ptr(str), false}; -} \ No newline at end of file