Skip to content

Lrlex codegen - #661

Merged
ltratt merged 7 commits into
softdevteam:masterfrom
ratmice:lrlex_codegen
Aug 23, 2026
Merged

Lrlex codegen#661
ltratt merged 7 commits into
softdevteam:masterfrom
ratmice:lrlex_codegen

Conversation

@ratmice

@ratmice ratmice commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

This is an attempt at lrlex codegen, in the style of the recently added lrpar codegen module.
One thing this doesn't do is change the CTTokenMapBuilder.

This tries to sequence the move over a couple of commits, with the first commit just generating module and ownership structure. With each subsequent commit moving one aspect of code generation, until it's all in the codegen module.

One slightly suprising thing was the placement of lexerdef within the LexerBuildEnv, because we need it to generate the rule_ids_map, with that we can wait to generate the LexerCodegen util the rule_ids_map is built, and pass it in to the code_generator function, this is a slight departure from the lrpar api, which merely took a timestamp.

Edit: One thing that the additional rule_ids_map parameter I immediately notice is that unlike BuildEnvArgs and other builder patterns, it's hard for us to add add an additional parameter should we need one. I wonder if we should consider LexerCodegenArgs?

Comment thread lrlex/src/lib/codegen.rs
Comment thread lrlex/src/lib/ctbuilder.rs
Comment thread lrlex/src/lib/codegen.rs
Comment thread lrlex/src/lib/codegen.rs
Comment thread lrlex/src/lib/codegen.rs Outdated
Comment thread lrlex/src/lib/ctbuilder.rs
@ltratt

ltratt commented Aug 23, 2026

Copy link
Copy Markdown
Member

I think this is ready for squashing?

@ratmice

ratmice commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator Author

Squashed the stray commits into the first one.

@ltratt
ltratt added this pull request to the merge queue Aug 23, 2026
Merged via the queue into softdevteam:master with commit 09dd83a Aug 23, 2026
2 checks passed
@ratmice
ratmice deleted the lrlex_codegen branch August 23, 2026 10:24
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