Skip to content

Commit 924533f

Browse files
authored
[Parser] Parse wast scripts (#6581)
The spec tests use an extension of the standard text format that includes various commands and assertions used to test WebAssembly implementations. Add a utility to parse this extended WebAssembly script format and use it in wasm-shell to check that it parses our spec tests without error. Fix a few errors the new parser found in our spec tests. A future PR will rewrite wasm-shell to interpret the results of the new parser, but for now to keep the diff smaller, do not do anything with the new parser except check for errors.
1 parent 5b46a5b commit 924533f

13 files changed

+555
-26
lines changed

src/parser/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(parser_SOURCES
33
context-decls.cpp
44
context-defs.cpp
55
lexer.cpp
6+
wast-parser.cpp
67
wat-parser.cpp
78
${parser_HEADERS}
89
)

src/parser/contexts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> {
16961696
return Builder::addVar(func, name, type);
16971697
}
16981698

1699-
Result<Expression*> makeExpr() { return irBuilder.build(); }
1699+
Result<Expression*> makeExpr() { return withLoc(irBuilder.build()); }
17001700

17011701
Memarg getMemarg(uint64_t offset, uint32_t align) { return {offset, align}; }
17021702

0 commit comments

Comments
 (0)