bytecodealliance / bytecodealliance/wasm-tools

Parse and validate text format together

Open
#2,438 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.8k
Forks
351
Avg merge
16h 57m
Merged PRs (30d)
38

Description

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:
1. `wast` could emit a `offset -> text span` table
2. `wasm-tools parse` would optionally validate the resulting binary
3. 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.