This drops the text format (%.wat) and renames InstantiateModuleFromCode to InstantiateModuleFromBinary as it is no longer ambiguous. We decided to stop supporting the text format as it isn't typically used in production, yet costs a lot of work to develop. Given the resources available and the increased work added with WebAssembly 2.0 and soon WASI 2, we can't afford to spend the time on it. The old parser is used only internally and will eventually be moved to its own repository named watzero, possibly towards archival. See #59 Signed-off-by: Adrian Cole <adrian@tetrate.io>
16 lines
471 B
Plaintext
16 lines
471 B
Plaintext
(module
|
|
;; Define the optional module name. '$' prefixing is a part of the text format.
|
|
$wasm/math
|
|
|
|
;; add returns $x+$y.
|
|
;;
|
|
;; Notes:
|
|
;; * The stack begins empty and anything left must match the result type.
|
|
;; * export allows api.Module to return this via ExportedFunction("add")
|
|
(func (export "add") (param $x i32) (param $y i32) (result i32)
|
|
local.get $x ;; stack: [$x]
|
|
local.get $y ;; stack: [$x, $y]
|
|
i32.add ;; stack: [$x+$y]
|
|
)
|
|
)
|