WIP: implement an asm.js code generator - #14
Draft
zerbina wants to merge 7 commits into
Draft
Conversation
The code generator / pass takes a subset of the L0 language as input and translates it to asm.js. This is a very early implementation, based on `pass0`, with lots of issues and missing features.
It just writes the asm.js code to a file and invokes Node.js on it.
`parseType` properly considers the new inlined types now. Tracking the position of the typedefs list (the `types` field) is removed; it was unnecessary from the start.
The integration is very basic at the moment -- evaluation/execution is not yet implemented.
Collaborator
Author
|
Same as with #146, there's no rush to finish this PR. Every additional code-generator-like translation pass increases the overhead of making changes to ILs, so the soonest this is eligible for merging is once the ILs stabilize. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The code generator takes a subset of the
L0language as input and translates itto
asm.js. It's currently more a proof-of-concept, based onpass0, but itlargely works already, in that it produces valid
asm.jscode for most of theL0subset it supports.Compared to
L0, the subset:CheckedCall,Raise,Except, etc.)Choiceor float-valueSelectsupportA grammar for the new intermediate language is missing, as well as a pass to
lower
L0into said language.For the sake of simplicity, the code generator currently formats the final code
in-place, but first emitting a
PackedTreethat is then turned into text would becleaner (and possibly more efficient).