Skip to content

Parse and validate text format together #2438

@eqrion

Description

@eqrion

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions