Skip to content

smt2_parser: parse Array sort #3161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/solvers/smt2/smt2_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,32 @@ typet smt2_parsert::sort()
return nil_typet();
}
}
else if(buffer == "Array")
{
// this gets two sorts as arguments, domain and range
auto domain = sort();
auto range = sort();

// eat the ')'
if(next_token() != CLOSE)
{
error() << "expected ')' at end of Array sort" << eom;
return nil_typet();
}

// we can turn arrays that map an unsigned bitvector type
// to something else into our 'array_typet'
if(domain.id() == ID_unsignedbv)
{
const auto size = to_unsignedbv_type(domain).largest_expr();
return array_typet(range, size);
}
else
{
error() << "unsupported array sort" << eom;
return nil_typet();
}
}
else
{
error() << "unexpected sort: `" << buffer << '\'' << eom;
Expand Down