Skip to content

Bring our TokenTree model closer to rustc's #17830

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

Closed
wants to merge 2 commits into from

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Aug 8, 2024

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
Copy link
Contributor

bors commented Aug 29, 2024

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

@ChayimFriedman2
Copy link
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
Copy link
Member Author

Veykril commented Jan 8, 2025

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
Copy link
Member Author

Veykril commented Jan 9, 2025

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