summaryrefslogtreecommitdiff
path: root/src/parser/parser.cpp
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@cs.nyu.edu>2014-10-23 03:11:18 -0400
committerMorgan Deters <mdeters@cs.nyu.edu>2014-10-23 19:40:41 -0400
commitc6436566dec99c0ed6794fa34b9b67a7e47918b0 (patch)
tree5555462cd38a49a9b6bed760d7af728d59371ee4 /src/parser/parser.cpp
parent1c8d1d7c5831baebc0a59a7dcf36f942504e5556 (diff)
Parsing and infrastructure support for SMT-LIBv2.5 input and output languages.
* support for new commands meta-info, declare-const, echo, get-model, reset, and reset-assertions * support for set-option :global-declarations * support for set-option :produce-assertions * support for set-option :reproducible-resource-limit * support for get-info :assertion-stack-levels * support for set-info :smt-lib-version 2.5 * ascribe types for abstract values (the new 2.5 standard clarifies that this is required) * SMT-LIB v2.5 string literals (we still support 2.0 string literals when in 2.0 mode) What's still to do: * check-sat-assumptions/get-unsat-assumptions (still being hotly debated). Also set-option :produce-unsat-assumptions. * define-fun-rec doesn't allow mutual recursion * All options should be restored to defaults with (reset) command. (Currently :incremental and maybe others get "stuck" due to late driver integration.)
Diffstat (limited to 'src/parser/parser.cpp')
-rw-r--r--src/parser/parser.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp
index 064379cf3..045cd4ae1 100644
--- a/src/parser/parser.cpp
+++ b/src/parser/parser.cpp
@@ -29,7 +29,6 @@
#include "expr/kind.h"
#include "expr/type.h"
#include "util/output.h"
-#include "options/options.h"
using namespace std;
using namespace CVC4::kind;
@@ -43,6 +42,7 @@ Parser::Parser(ExprManager* exprManager, Input* input, bool strictMode, bool par
d_symtabAllocated(),
d_symtab(&d_symtabAllocated),
d_assertionLevel(0),
+ d_globalDeclarations(false),
d_anonymousFunctionCount(0),
d_done(false),
d_checksEnabled(true),
@@ -142,6 +142,9 @@ bool Parser::isPredicate(const std::string& name) {
Expr
Parser::mkVar(const std::string& name, const Type& type, uint32_t flags) {
+ if(d_globalDeclarations) {
+ flags |= ExprManager::VAR_FLAG_GLOBAL;
+ }
Debug("parser") << "mkVar(" << name << ", " << type << ")" << std::endl;
Expr expr = d_exprManager->mkVar(name, type, flags);
defineVar(name, expr, flags & ExprManager::VAR_FLAG_GLOBAL);
@@ -158,6 +161,9 @@ Parser::mkBoundVar(const std::string& name, const Type& type) {
Expr
Parser::mkFunction(const std::string& name, const Type& type, uint32_t flags) {
+ if(d_globalDeclarations) {
+ flags |= ExprManager::VAR_FLAG_GLOBAL;
+ }
Debug("parser") << "mkVar(" << name << ", " << type << ")" << std::endl;
Expr expr = d_exprManager->mkVar(name, type, flags);
defineFunction(name, expr, flags & ExprManager::VAR_FLAG_GLOBAL);
@@ -166,6 +172,9 @@ Parser::mkFunction(const std::string& name, const Type& type, uint32_t flags) {
Expr
Parser::mkAnonymousFunction(const std::string& prefix, const Type& type, uint32_t flags) {
+ if(d_globalDeclarations) {
+ flags |= ExprManager::VAR_FLAG_GLOBAL;
+ }
stringstream name;
name << prefix << "_anon_" << ++d_anonymousFunctionCount;
return d_exprManager->mkVar(name.str(), type, flags);
@@ -173,6 +182,9 @@ Parser::mkAnonymousFunction(const std::string& prefix, const Type& type, uint32_
std::vector<Expr>
Parser::mkVars(const std::vector<std::string> names, const Type& type, uint32_t flags) {
+ if(d_globalDeclarations) {
+ flags |= ExprManager::VAR_FLAG_GLOBAL;
+ }
std::vector<Expr> vars;
for(unsigned i = 0; i < names.size(); ++i) {
vars.push_back(mkVar(names[i], type, flags));
@@ -234,6 +246,9 @@ Parser::defineParameterizedType(const std::string& name,
SortType
Parser::mkSort(const std::string& name, uint32_t flags) {
+ if(d_globalDeclarations) {
+ flags |= ExprManager::VAR_FLAG_GLOBAL;
+ }
Debug("parser") << "newSort(" << name << ")" << std::endl;
Type type = d_exprManager->mkSort(name, flags);
defineType(name, type);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback