-
-
Notifications
You must be signed in to change notification settings - Fork 12
Description
To enable WebAssembly to be read and edited by humans, there is a textual representation of the wasm binary format.
The above sentences are from MDN's article: Understanding WebAssembly text format.
This way that we write the code runs on modern browsers is still not readable, this is the example that wasm text format project: https://github.com/mafintosh/blake2b-wasm/blob/master/blake2b.wat. I hardly read over 300 lines, even the whole source file contains 2800+ lines.
Improving this source would have the following 2 ways for now:
- split the big file into many modules in a structured place, that's play WAT better
- writing the same implementation in existing language that's friend to developers
I'll go for the latter, the former method may works, but with a hard learning curve. Obviously the existing language is the JavaScript itself. Aha, that we would do: write JavaScript and compile it to binary executable, and run in JavaScript VM. Interesting, right?
Having to say, this idea looks like what I was expecting in yorkie/lv, which gets AST via esprima, and generates Assembly source code for NASM. About the implementation of the new thoughts, we don't need esprima any more, because we can provide APIs by following WAT's specification, and generates WAT source directly.
If you have interested in this project, feel free to leave comments here :)