As a means to learn about both WebAssembly and Rust, I started writing a WebAssembly binary decoder (i.e. a parser for `.wasm` files) from scratch.
Recently it hit v3 spec conformance. (I'm executing the upstream spec test suite.)
I don't plan to make it a highly-performant decoder for use in production environments, but rather one that can be used for educational purposes, easy to read and/or debugging issues with modules. That's why I decided not to offer a streaming API, and why I'll be focusing on things like good errors, good code docs etc.
I followed the same testing approach when writing a Wasm binary parser (technically, a decoder)[0].
It was pretty helpful having the official spec suite available and a major boost of confidence that your parser is compliant.
Nevertheless, it was my own tests that found a regression in the latest published version of the spec[1], which shows how important it is to have a variety of implementations.
Tangential: I decided to write a Wasm parser (more precisely, a decoder the the Wasm binary format) from scratch, as a means to learn both Wasm and Rust[0].
It was the first time I was writing this sort of thing, but I found the spec very clear and well-written.
Fun fact: I was surprised when the test from a toy parser surfaced a real regression in version 3 of the spec[1], released roughly 4 months before.
Slowly but steadily implementing support for version 3 of the Wasm specification in my wasm parser (written from scratch): https://github.com/agis/wadec
I plan to continue building the hobby project I started (a Wasm module parser[1]) by implementing version 3 of the WebAssembly specification and eventually implementing the Validation phase.
As a means to learn about both WebAssembly and Rust, I started writing a WebAssembly binary decoder (i.e. a parser for `.wasm` files) from scratch.
Recently it hit v2.0 spec conformance. 3.0 is next on the roadmap. (I'm executing it against the upstream spec test suite.)
I don't plan to make it a highly-performant decoder for use in production environments, but rather one that can be used for educational purposes, easy to read and/or debugging issues with modules. That's why I decided not to offer a streaming API, and why I'll be focusing on things like good errors, good code docs etc.
I'd say jump straight to the specification (maybe v2, which is simpler).
But I occasionally saw one or two articles around where they explain how the binary format works, which could be a good introduction before jumping to the spec.
Really happy to see Pat keeping it up! His first Ruby under a Microscope book but also his blog posts are amazing and a major source of inspiration for me. I did meet him personally in a Euruko conference. Such a great person.
Recently it hit v3 spec conformance. (I'm executing the upstream spec test suite.)
I don't plan to make it a highly-performant decoder for use in production environments, but rather one that can be used for educational purposes, easy to read and/or debugging issues with modules. That's why I decided not to offer a streaming API, and why I'll be focusing on things like good errors, good code docs etc.
https://github.com/agis/wadec
P.S. I'm new to the language so any feedback is more than welcome.