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.
As an excercise I wrote a super simple transpiler from PVM to AssemblyScript (which can then be compiled with
asc
into WASM).The idea is to figure out how things like this work, obviously it's not very useful practically, but can serve as an example how this kind of stuff could be done. Most of the code is generated by altering strings of current code (sic!), but I wanted to keep the changes minimal.
Practically what could work (but not fast enough) is generating WASM straight from the PVM code (no assembly script).
Some issues that I already see:
ecalli
- we need to first dump registers and be able to read the memory, and after the host call is finished we need to write down the data and resume execution.How to run:
Generated Fibonacci AssemblyScript
Which in turns compiles to the following WASM:
Compiled WABT