So, I’ve spent a fair bit of time fooling around with parsers and programming languages over the years. Lately, I’ve been experimenting with WebAssembly in various contexts–mostly in the compilers course where I’ve started using it as a compilation target. Recently, I got to thinking about the problem of decoding Wasm . There are two common Wasm formats, “wasm” which is a low-level binary encoding that’s actually used in the deployment of Wasm, and “wat” which is a text-representation based on S-expressions. If you wanted to write a tool to parse/decode Wasm, you might be inclined to work with the more human-readable “wat” format. However, it turns out that writing a recursive descent binary parser is even easier.
So, this is basically the “wadze” library. A simple recursive descent binary wasm decoder. It’s fast and doesn’t involve much code. I think it’s kind of neat… now I just have to explore various diabolical things to do with it.