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

First pass at AST-based codegen #1333

Merged
merged 12 commits into from
Dec 11, 2021
Merged

First pass at AST-based codegen #1333

merged 12 commits into from
Dec 11, 2021

Conversation

kyleconroy
Copy link
Collaborator

Currently, we generate code by using Go templates. While this approached has served us well, the code generators themselves are getting more complicated and difficult to understand. Templates aren't fully typed-checked. Functionality is split across Go code and template code.

I'm experimenting with a new approach, starting with Python. Instead of using templates, we'll build an AST and then print that AST to a file. I'm aiming to replicate the go/ast and go/printer packages. Lastly, the AST itself is defined via Protocol Buffers so that we can serialize the AST. This will be helpful in the future when we have plugin support.

@kyleconroy kyleconroy marked this pull request as ready for review December 11, 2021 03:00
@kyleconroy kyleconroy merged commit c7a0afe into main Dec 11, 2021
@kyleconroy kyleconroy deleted the kyle/python-writer branch December 11, 2021 03:03
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.

1 participant