diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2020-07-06 18:48:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 18:48:10 -0500 |
commit | 9678f58a7fedab4fc061761c58382f4023686108 (patch) | |
tree | 5ccc2e13b00a32a2e8fa87604b4a2f3a92b12e7e /src/parser/parser.cpp | |
parent | ae0bfbdacfec8b2d21b10cbc4955305f49a62a54 (diff) |
Front end support for sequences (#4690)
With this PR, we now support a preliminary draft of a theory of sequences.
This PR adds front end support for sequences in the smt2 parser, in the new API, adds regressions and unit tests for them.
As discussed offline, many of the string kinds are given a sequence version in the external API, but not in the internal one. This means that a special case for such kinds, getKindHelper was added to Term.
We do not yet support proper smt2 printing of sequences, which will require access to this code for Kind conversions (to distinguish e.g. str.++ from seq.++).
Diffstat (limited to 'src/parser/parser.cpp')
-rw-r--r-- | src/parser/parser.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index 5d80dd55f..a5ce1bed0 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -563,6 +563,22 @@ api::Term Parser::applyTypeAscription(api::Term t, api::Sort s) { t = d_solver->mkEmptySet(s); } + else if (k == api::CONST_SEQUENCE) + { + if (!s.isSequence()) + { + std::stringstream ss; + ss << "Type ascription on empty sequence must be a sequence, got " << s; + parseError(ss.str()); + } + if (!t.getConstSequenceElements().empty()) + { + std::stringstream ss; + ss << "Cannot apply a type ascription to a non-empty sequence"; + parseError(ss.str()); + } + t = d_solver->mkEmptySequence(s.getSequenceElementSort()); + } else if (k == api::UNIVERSE_SET) { t = d_solver->mkUniverseSet(s); |