Skip to content

SMT2 parser errors #3441

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 2 commits into from
Nov 29, 2018
Merged

SMT2 parser errors #3441

merged 2 commits into from
Nov 29, 2018

Conversation

kroening
Copy link
Member

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: 726babc).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91800481

/// this is a dummy -- errors are reported via the error() stream
std::string what() const override
{
return "";
Copy link
Member

@peterschrammel peterschrammel Nov 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of non-standard use of exceptions. The error message should be attached to it so that the fatal error handling and printing can be done by the caller. It's the decision of the caller what to do when an error happens (ignore, log and carry on, abort,...). Moreover, the message handler dependency could be removed here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now with error message in the exception.

}
}
catch(smt2_errort)
{
return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think translating exceptions to 'error codes' at internal interfaces is a good thing.

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm with @peterschrammel - I think this is exceptions-as-return-values, which is the one thing we teach people not to use exceptions for. Also both commits lack a commit message body explaining why any of these changes are being made. Such messages might help understand why introducing state into the lexer is a good idea.

@@ -56,6 +56,10 @@ class smt2_tokenizert:public parsert
return messaget::error();
}

/// skip any tokens until all parentheses are closed
/// or the end of file is reached
void skip_to_end_of_list();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being added, but never invoked. (And I find it rather weird to have an a lexical analyzer.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now moved one level up to parser.

error() << "expected end of command" << eom;
return;
// consume any tokens till the end of the command
skip_to_end_of_list();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to recover cleanly from parse errors.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: b97d3a1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92465647

}
}
catch(smt2_errort)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will now just eat the error message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@kroening kroening assigned tautschnig and unassigned kroening Nov 28, 2018
@kroening kroening force-pushed the smt2_parser_errors branch 2 times, most recently from a0444cd to 5f79032 Compare November 28, 2018 20:22
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: 5f79032).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92913553

@tautschnig
Copy link
Collaborator

This (now) needs a rebase, but is otherwise good to go.

Daniel Kroening added 2 commits November 28, 2018 17:27
The tokenizer is changed to split reading tokens and consuming them; the
parser counts the parentheses.
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: e6049e1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92942542

@tautschnig tautschnig merged commit 5e68531 into develop Nov 29, 2018
@tautschnig tautschnig deleted the smt2_parser_errors branch November 29, 2018 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants