spacetanuki% touch empty.wast
spacetanuki% wast2json empty.wast
empty.wast:1:1: error: unexpected token "EOF", expected a module field or a command.
spacetanuki% ~/git/wasm/spec/interpreter/wasm empty.wast
spacetanuki% wasmtime wast empty.wast
Error: failed to run script file 'empty.wast'
Caused by:
expected at least one module field
--> empty.wast:1:1
|
1 |
| ^
spacetanuki% wasmer wast empty.wast
error: failed to test the wast `empty.wast`
│ 1: tests failed
╰─▶ 2: expected at least one module field
--> empty.wast:1:1
|
1 |
| ^
spacetanuki%
if my reading of the spec is correct, an empty wast file is valid.
https://github.com/WebAssembly/spec/blob/main/interpreter/README.md#scripts
an example of such a file:
https://github.com/WebAssembly/multi-memory/blob/4f6b8f53ec11e59f5e38033db4199db18df83706/test/core/multi-memory/memory_copy1.wast#L1
how other implementations behave: