wasm_wast (wasm v0.1.0)
View SourceSpecification scripts: the .wast format the conformance suite is written in.
You want this only if you are running the suite.
A .wast file is a module interleaved with assertions about it. This reads one
into the command list the runner already understands, so the suite can be
replayed from the upstream source rather than from fixtures generated by
another tool.
The shape is the tool's, deliberately
Commands come out in the same shape wasm-tools json-from-wast produces:
binary keys, assert_return carrying action and expected, values as
#{type, value} with integers signed and floats as bit patterns. That is not
imitation for its own sake. It means the runner reads both, and the two can be
compared command by command over the whole suite, which is the only way to know
this file agrees with the tool it replaces.
The one difference is where a module comes from. The tool writes a .wasm file
and names it; here the module travels with the command as {form, Sexp},
{quote, Source} or {binary, Bytes}.
Modules are not parsed here
A script is read whole and its modules parsed one at a time afterwards. Parsing
them while reading would mean a file containing one deliberately malformed
module could not be read at all, and assert_malformed is a third of what the
suite asserts.
Summary
Types
A script command, in the shape the runner consumes.
-type module_source() :: {form, wasm_wat_sexp:sexp()} | {quote, binary()} | {binary, binary()}.
Where a command's module comes from.
form is text already read; quote is text carried as a string and not yet
read; binary is the bytes of a module written out directly.