From 86eb2490a00466d5b014976fc89b813011b663eb Mon Sep 17 00:00:00 2001 From: "Christopher L. Conway" Date: Tue, 6 Jul 2010 17:10:53 +0000 Subject: [PATCH] Adding Array types to SMT2 parser --- src/parser/smt2/Smt2.g | 12 ++++++++++++ test/regress/regress0/arr1.smt2 | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/regress/regress0/arr1.smt2 diff --git a/src/parser/smt2/Smt2.g b/src/parser/smt2/Smt2.g index 91f2f205b..c23ccca6b 100644 --- a/src/parser/smt2/Smt2.g +++ b/src/parser/smt2/Smt2.g @@ -359,9 +359,21 @@ sortName[std::string& name, CVC4::parser::DeclarationCheck check] sortSymbol[CVC4::Type& t] @declarations { std::string name; + std::vector args; } : sortName[name,CHECK_NONE] { t = PARSER_STATE->getSort(name); } + | LPAREN_TOK symbol[name,CHECK_NONE,SYM_SORT] sortList[args] RPAREN_TOK + { + if( name == "Array" ) { + if( args.size() != 2 ) { + PARSER_STATE->parseError("Illegal array type."); + } + t = EXPR_MANAGER->mkArrayType( args[0], args[1] ); + } else { + PARSER_STATE->parseError("Unhandled parameterized type."); + } + } ; /** diff --git a/test/regress/regress0/arr1.smt2 b/test/regress/regress0/arr1.smt2 new file mode 100644 index 000000000..844f7d8e5 --- /dev/null +++ b/test/regress/regress0/arr1.smt2 @@ -0,0 +1,10 @@ +(set-logic QF_AX) +(set-info :status unsat) +(declare-sort Index 0) +(declare-sort Element 0) +(declare-fun a () (Array Index Element)) +(declare-fun i1 () Index) +(declare-fun i2 () Index) +(assert (not (=> (= i1 i2) (= (select a i1) (select a i2))))) +(check-sat) + -- 2.30.2