The wasm-tools parse command doesn't validate that resulting module is correct. This is nice for writing tests, but is difficult for teaching beginners wasm. They're able to get text examples parsing correctly, but then they have to separately validate the binary and if that fails, all they are given is a terse error with a binary offset.
It'd be nice if wasm-tools parse had a mode which would also validate the result and display errors in terms of the original text.
I think the best way to do this would be if:
wast could emit a offset -> text span table
wasm-tools parse would optionally validate the resulting binary
- Any errors are formatted to show the original source using the offset table
I didn't see any support in wast for this sort of source information. There is DWARF support, but I'm not sure if that could be hooked up for this.
The
wasm-tools parsecommand doesn't validate that resulting module is correct. This is nice for writing tests, but is difficult for teaching beginners wasm. They're able to get text examples parsing correctly, but then they have to separately validate the binary and if that fails, all they are given is a terse error with a binary offset.It'd be nice if
wasm-tools parsehad a mode which would also validate the result and display errors in terms of the original text.I think the best way to do this would be if:
wastcould emit aoffset -> text spantablewasm-tools parsewould optionally validate the resulting binaryI didn't see any support in wast for this sort of source information. There is DWARF support, but I'm not sure if that could be hooked up for this.