zksecurity / wasmati

Write low-level WebAssembly, from JavaScript
MIT License
219 stars 6 forks source link

Docstring would be lovely #5

Open erhant opened 6 months ago

erhant commented 6 months ago

Since the types are rather fancy throughout the exported items, hovering over them alone does not help too much to understand their usage. I presume some level of WASM-literacy is expected from the user, but in any case I think docstrings would be so much helpful.

erhant commented 6 months ago

@mitschabaude if you can point me to some docs that are kind of 1-to-1 with the naming, I can work on the docs as well. I have a fetish of writing docs hahah & it would personally help me learn quite a lot; in case you have work to do elsewhere right now 🙏🏻

mitschabaude commented 3 months ago

@erhant sorry for replying so late.

Obviously docstrings would be awesome, but also a considerable undertaking that I don't have the time for currently.

Regarding resources, I was working mostly off of the Webassembly spec: https://webassembly.github.io/spec/core/

Note that for implementing wasmati it was not necessary to understand what all individual instructions actually do 😅 We just need to provide an interface with the correct input/output type, and support encoding all instructions into wasm bytecode.

Incomplete docs for some instructions can be found on MDN: https://developer.mozilla.org/en-US/docs/WebAssembly/Reference

To actually understand some of the newer instructions however, the only useful docs I found were often the original Wasm extension proposals, for example this one for SIMD

An invaluable resource to see all old and new extensions is the WebAssembly Roadmap