Lrpar codegen - #657
Open
ratmice wants to merge 14 commits into
Open
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I think this is probably as reviewable as I'm going to manage to make this large of a patch.
The basic idea behind this patch is to have a kind of "functional pipeline", for doing code generation,
((yacc_source_string -> SrcEnv?), BuildEnvArgs) -> BuildEnv? -> Codegen? -> rs_source_stringBuildEnvArgsis kind of a minimalist equivalent of the current builder, it's just full ofOptionvalues.BuildEnvis full ofderivedvalues, it mostly strips off theOption, but it also contains values likeASTWithValidityInfothat are derived from all the other args.Codegenthen owns theYaccGrammar,StateTableandStateGraphs, which you can take ownership of after generating code.This may not be totally perfect basis for traits and external usage, for example it currently returns
Box<dyn Error>instead of typed errors. But it should be a pretty faithful conversion of the existing process, into a more targeted/self contained module.