5 ms·
I also want to generate webassembly. I compared the option of generating wasm directly with using llvm. The wasm spec is hard to read without enough examples.
by billconan 6y ago
I also want to generate webassembly. I compared the option of generating wasm directly with using llvm. The wasm spec is hard to read without enough examples.
My current approach is writing my runtime in c or c++, and put most logic there. And I will try to generate c code first, and compile the c code using clang and learn from the generated IR.
I kinda want to write the runtime also in rust, but I don't know if linking will be a problem.
- hardwaregeek 6y agoAgreed that the WebAssembly spec is a pain to read. I mostly used this outdated doc: https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md https://github.com/WebAssembly/design/blob/master/BinaryEnco... Generating C seems like a good middle ground. I also considered that. Frankly though code generation is hard regardless because you’re gonna have some abstractions that just don’t lower nicely. Writing the runtime in Rust might work but ownership might get in the way. Happy to talk about this more if you want. Shoot me an email