bytecodealliance / bytecodealliance/wasm-tools
`json-from-wast`: differences to wabt's `wast2json`
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 351
- Avg merge
- 16h 57m
- Merged PRs (30d)
- 38
Description
I just saw the new `json-from-wast` command. It is great to see a `wast2json`-like tool as part of `wasm-tools`, especially since it supports many more proposed features than `wabt`.
However, I've noticed that `json-from-wast` outputs slightly different JSON than `wabt`. In particular:
* `wabt` writes the module names in their `$`-prefixed form, while `json-from-wast` drops the `$` from the module names.
* `wabt` writes all numeric values in their unsigned representation (even if the corresponding type itself is signed like `i32` and `i64`), while `json-from-wast` writes negative numbers as they are, with a minus sign.
Another difference is how the filenames for the associated modules are derived: `wabt` derives these names from the given output filename. IMHO, this has the advantage that both the JSON file and the associated module files share the same base name.
As noted in the commit, `json-from-wast` also doesn't write the `expected` return types for commands like `assert_trap`. Are there any plans to add this feature in the future?
I also experimented with my own `wast2json` implementation in the past. My approach was to parse and analyze the associated modules after encoding and store their exported function and global types so that they could be queried when needed.
Contributor guide
Assessment
This issue has not been assessed yet.