Skip to content
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

Syntax wrappers #313

Open
AntonC9018 opened this issue Sep 22, 2022 · 1 comment
Open

Syntax wrappers #313

AntonC9018 opened this issue Sep 22, 2022 · 1 comment

Comments

@AntonC9018
Copy link

Digging through the syntax tree in search of certain nodes is not maintainable - the code becomes cryptic even for simple grammars. Is there a way to generate convenient type-safe wrappers for any syntactic construct? They can be done as wrappers over raw nodes.

For example:
Usage with wrappers (manually written out)
And the grammar + wrappers themselves:

The same code without said wrappers, with digging through the syntax tree done manually, inline

The way I did it is not necessarily optimal, but I think it's pretty plausible.
From experience working with Roslyn, it's a real good thing.

@AntonC9018
Copy link
Author

Perhaps better switches for the options could be beneficial. Stuff kind of like SumType, but with tags.

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

No branches or pull requests

1 participant