bytecodealliance / bytecodealliance/wasm-tools
Making wast parse results serializable
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 351
- Avg merge
- 16h 57m
- Merged PRs (30d)
- 38
Description
I'd love to use the parser and encoder from `wast` in JavaScript. The easiest way for that to work would be for the parsed module to be serializable and deserializable as JSON, so that the string representations can be passed to JS via wasm-bindgen. Could the various AST types be made serializable?
I know adding serde adds some heft, but I think it could be done conditionally with an off-by-default feature.
I tried doing this myself by sprinkling `#[derive(Serialize, Deserialize)]` everywhere, but got stuck making the lifetimes work inside the [`instructions` macro](https://github.com/bytecodealliance/wasm-tools/blob/90161a9b5fbfeaa40e9b4ba2339d7cd1bd52deff/crates/wast/src/core/expr.rs#L344). I don't have enough experience with rust to figure out how to get that working.
Contributor guide
Assessment
This issue has not been assessed yet.