-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add code generation for Zig #936
Conversation
Thanks! Would you also add a |
Also, if you have any comments or feedback on the experience of adding a new backend, have things that you think should be documented more, etc, I'd be happy to get such feedback. |
Of course! A CI test has been added. To avoid mixing two PRs, the generated files have the typo, but I'll regenerate them once the other PR is merged. Adding a new backend was actually quite simple. Just one thing: there is a single instruction for changing the size of a value ( Type casts in Zig are safer than other currently supported languages. There are 3 ways to change the size of a value:
This is not that big of a deal, since Ideally, most |
Thanks! The CI has caught a bug:
Glad to hear it!
Ah, I should be able to add an extra argument to
This should not be done from the stringification code, which unfortunately remains unproven and should be as simple and direct a translation as possible. If it's really important to do this, I can look in to adding an extra rewriter pass keyed on an extra command-line argument to remove useless |
This should be rebased and regenerated now that the other PR has been merged. Also, I forgot to request it before, please mark the .zig files as generated in |
Hi Jason, The changes have been rebased, the zig files have been regenerated, and the |
Great, thanks! |
One last request: Since none of us can vouch for the correctness of this code, are you okay with us adding you as the maintainer of this backend to the table I'm adding in #940? And finally, it looks like you accidentally reverted a bump of coq-scripts; feel free to amend your commit to not change the coq-scripts submodule (you'll have to go into coq-scripts and check out the version that's at current master), or else I can just re-bump it after merging this. |
Oops, I didn't notice the submodule was updated. The re-bump was amended. And yes, I can take responsibility for maintaining the code. I'll be maintaining the code using it in the Zig standard library, so I can make sure it is correct, and keeps being updated along with new releases of the compiler. |
Hi Jason, Do you think this is ready to be merged, or is there anything else you'd like me to do? |
This adds code generation for Zig, a compiled, safe programming language that can produce code for many targets, including WebAssembly.
Note that in Zig, types can have arbitrary sizes (
u1
,u2
,u51
,u2048
), so we don't need to define any private types.