This repository was archived by the owner on Dec 1, 2022. It is now read-only.
Open
Conversation
ma2bd
reviewed
Oct 13, 2021
| %type sort_decs Vec<(T::Symbol, crate::Numeral)>; | ||
|
|
||
| %start_symbol command; | ||
| %start_symbol mode; |
There was a problem hiding this comment.
Perhaps input or start instead of mode ?
| mode ::= theory(td) { ParseResult::Theory(td) } | ||
| } | ||
|
|
||
| pub enum ParseResult<C, T> { |
There was a problem hiding this comment.
This seems reasonable. (Need inline doc comment for public API though :))
In full generality, we could pass an artificial input token to signal what we expect but this is not even needed here since there is no ambiguity.
| fn parsing_error(&mut self, position: crate::Position, s: String) -> Self::Error; | ||
| } | ||
|
|
||
| /// A visitor for the entire SMT2 syntax. |
| return match parser.end_of_input() { | ||
| Ok((command, _)) => Some(Ok(command)), | ||
| Ok((ParseResult::Command(command), _)) => Some(Ok(command)), | ||
| Ok((ParseResult::Theory(res), _)) => unimplemented!(), |
There was a problem hiding this comment.
So this will return an error value here, obviously.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, I wanted to take a crack at getting theory parsing working to fix #15.
Before I went to the trouble of implementing all the parser rules and concrete syntax types, I wanted to validate the approach I'm taking.
Basically it amounts to:
ParseResultwhich could be either aCommandor aTheory. (currently, no modesetting is done, we rely on upstream consumers like CommandStream, to provide errors if the parser returns an unexpected result)SmtVisitorwithTheoryVisitor. I'm not sure I like this because I imagine there are a lot of tools that will only operate onCommands and not onTheorys but it seemed the least invasive choice. I would welcome some guidance on this point.