Skip to content

Lrpar codegen - #657

Open
ratmice wants to merge 14 commits into
softdevteam:masterfrom
ratmice:lrpar_codegen4
Open

Lrpar codegen#657
ratmice wants to merge 14 commits into
softdevteam:masterfrom
ratmice:lrpar_codegen4

Conversation

@ratmice

@ratmice ratmice commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

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_string

  1. BuildEnvArgs is kind of a minimalist equivalent of the current builder, it's just full of Option values.
  2. BuildEnv is full of derived values, it mostly strips off the Option, but it also contains values like ASTWithValidityInfo that are derived from all the other args.
  3. Codegen then owns the YaccGrammar, StateTable and StateGraphs, 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.

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.

2 participants