Skip to content

Bring our TokenTree model closer to rustc's#17830

Closed
Veykril wants to merge 2 commits into
rust-lang:masterfrom
Veykril:tt-model2
Closed

Bring our TokenTree model closer to rustc's#17830
Veykril wants to merge 2 commits into
rust-lang:masterfrom
Veykril:tt-model2

Conversation

@Veykril

@Veykril Veykril commented Aug 8, 2024

Copy link
Copy Markdown
Member

Our model is kind of arbitrary and less strict, the syntax node <-> TokenTree conversion is also messy and brittle, likewise our MBE infra will benefit from a more concise model. Lastly, rustc uses this one TokenStream model for the parser, be it from macro inputs/outputs or general lexing where as we have a very confusing and inefficient setup to make this work for our parser. Ideally we should do a similar move and switch to a unified input there which ought to aid perf quite a bit when transcribing MBE macros.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 8, 2024
@bors

bors commented Aug 29, 2024

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #17994) made this pull request unmergeable. Please resolve the merge conflicts.

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Switching to a unified representation is problematic because we need syntax trees to be lossless but tt must not be lossless - to help incrementality, but I do have a sketch of idea.

@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 2, 2025
@Veykril

Veykril commented Jan 8, 2025

Copy link
Copy Markdown
Member Author

Fyi I am currently bringing this PR back on track (module the mbe crate, will likely rewrite it on top of this change), as changing the token tree representation here is still beneficial either way. The unified input thing is a different story, unrelated to this PR in my eyes.

@Veykril

Veykril commented Jan 9, 2025

Copy link
Copy Markdown
Member Author

I started work on a fresh branch for this but I now noticed that swapping this is quite the pain due to our parser setup. The parser needs a dire rewrite as well, the way it handles tokens it horrible for wrangling macros so this goes back to the input structure of the parser needing to be changed

@Veykril Veykril closed this Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants