Skip to content

Commit

Permalink
how to wasm-interp sieve.wat
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakov Zaytsev committed Sep 26, 2019
1 parent b1d53fc commit db31ebf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ define i32 @add(i32 %a, i32 %b) #0 {
}
```

## How to run sieve.wat

```
wat2wasm --enable-tail-call -v sieve.wat -o sieve.wasm
wasm-interp --run-all-exports --enable-tail-call --host-print sieve.wasm
called host host.print(i32:42) => i32:0
f() => i32:0
```

## How wabt(-rs) works

`ScriptParser::from_str` takes wast input e.g. testsuite/i32.wast
Expand Down
9 changes: 9 additions & 0 deletions sieve.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(module
(import "host" "print" (func $imported (param i32) (result i32)))

(func (export "f") (result i32)
i32.const 42
return_call $imported
unreachable
)
)

0 comments on commit db31ebf

Please sign in to comment.