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
Frontend parsing breakdown #4131
Comments
I don't think I can find any real code that's actually using the sort synonym feature: https://github.com/search?q=org%3Aruntimeverification+%2Fsyntax.*%3D%2F+path%3A*.k+OR+path%3A*.md+NOT+%2Flexical%2F+NOT+%2F%3A%3A%3D%2F&type=code @dwightguth @ehildenb the feature was added without context here (#791). Any idea whether this is something we need to keep supporting? |
(also - this is great stuff @gtrepta, thanks for putting it together!) |
Related: #1278 |
Synonyms were historically used in KEVM to select different implementations of a sort depending on what backend you're on; it's not a lot of code and seems like a useful feature so we should document this and keep the code. |
There are some subtle differences between how Pyk and the Java frontend handle outer parsing; @tothtamas28 has documented these - please link the relevant PRs here for @gtrepta |
Just updated the outer parsing section with more details. Notably there are a couple of structural checks and generation of syntax priority/associativity sentences from syntax declarations. |
Known differences are the following. Parser
Lexer
|
Another difference I've noticed is that the pyk parsed definition does not contain any source location information. I've opened an issue on the pyk repo for it. |
(WIP)
Kompile
callsparseDefinition
, which calls out to theDefinitionParsing
class that handles all the frontend outer/inner parsing. Its first step is to do outer parsing, things it does here that are noteworthy:slurp
is used to parse the modules in the definition file, resolve file paths inrequires
clauses, and recursively slurp those files into the definition.prelude.md
to the definition unless--no-prelude
was passedsyntax Num = Int
, then any productions withNum
nonterminals becomeInt
)MAP
,K-REFLECTION
,STDIN-STREAM
,STDOUT-STREAM
.K-IO
if--coverage
is used)At this point it's time to do inner parsing. This is done in two steps, first on the configuration declarations and then on the rest of the definition.
Briefly, Resolving the configuration bubbles does a few things:
DEFAULT-CONFIGURATION
to the main module's imports if it doesn't have it's own configuration declarationMAP
module to the main module's imports as well, as it's necessary for configuration initialization. (An error will be thrown if it can't somehow find theMAP
module in the definition!)The text was updated successfully, but these errors were encountered: