diff options
48 files changed, 93 insertions, 93 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index aef83435..199a276a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -275,8 +275,8 @@ if (NOT EMSCRIPTEN) # wast2wasm wabt_executable(wast2wasm src/tools/wast2wasm.cc) - # wasm2wast - wabt_executable(wasm2wast src/tools/wasm2wast.cc) + # wasm2wat + wabt_executable(wasm2wat src/tools/wasm2wat.cc) # wasm-opcodecnt wabt_executable(wasm-opcodecnt @@ -5,7 +5,7 @@ WABT (we pronounce it "wabbit") is a suite of tools for WebAssembly, including: - **wast2wasm**: translate from [WebAssembly text format](http://webassembly.github.io/spec/text/index.html) to the [WebAssembly binary format](http://webassembly.github.io/spec/binary/index.html) - - **wasm2wast**: the inverse of wast2wasm, translate from the binary format back to the text format (also known as a .wast) + - **wasm2wat**: the inverse of wast2wasm, translate from the binary format back to the text format (also known as a .wat) - **wasm-objdump**: print information about a wasm binary. Similiar to objdump. - **wasm-interp**: decode and run a WebAssembly binary file using a stack-based interpreter - **wast-desugar**: parse .wast text form as supported by the spec interpreter (s-expressions, flat syntax, or mixed) and print "canonical" flat format @@ -26,7 +26,7 @@ Wabt has been compiled to JavaScript via emscripten. Some of the functionality i - [index](https://cdn.rawgit.com/WebAssembly/wabt/7e56ca56/demo/index.html) - [wast2wasm](https://cdn.rawgit.com/WebAssembly/wabt/7e56ca56/demo/wast2wasm/) -- [wasm2wast](https://cdn.rawgit.com/WebAssembly/wabt/7e56ca56/demo/wasm2wast/) +- [wasm2wat](https://cdn.rawgit.com/WebAssembly/wabt/7e56ca56/demo/wasm2wast/) ## Cloning @@ -157,22 +157,22 @@ $ out/wast2wasm -h Or try the [online demo](https://cdn.rawgit.com/WebAssembly/wabt/013802ca01035365e2459c70f0508481393ac075/demo/wast2wasm/). -## Running wasm2wast +## Running wasm2wat Some examples: ```sh -# parse binary file test.wasm and write s-expression file test.wast -$ out/wasm2wast test.wasm -o test.wast +# parse binary file test.wasm and write text file test.wat +$ out/wasm2wat test.wasm -o test.wat -# parse test.wasm and write test.wast -$ out/wasm2wast test.wasm -o test.wast +# parse test.wasm and write test.wat +$ out/wasm2wat test.wasm -o test.wat ``` You can use `-h` to get additional help: ```console -$ out/wasm2wast -h +$ out/wasm2wat -h ``` Or try the [online demo](https://cdn.rawgit.com/WebAssembly/wabt/013802ca01035365e2459c70f0508481393ac075/demo/wasm2wast/). diff --git a/demo/index.html b/demo/index.html index 86b3a394..d395d1b7 100644 --- a/demo/index.html +++ b/demo/index.html @@ -34,7 +34,7 @@ </p> </li> <li> - <a href="wasm2wast/">wasm2wast demo</a> + <a href="wasm2wat/">wasm2wat demo</a> <p> Example showing converting binary to text. </p> diff --git a/demo/wasm2wast/demo.js b/demo/wasm2wat/demo.js index a1b6b442..a1b6b442 100644 --- a/demo/wasm2wast/demo.js +++ b/demo/wasm2wat/demo.js diff --git a/demo/wasm2wast/examples.js b/demo/wasm2wat/examples.js index 11e2caf3..11e2caf3 100644 --- a/demo/wasm2wast/examples.js +++ b/demo/wasm2wat/examples.js diff --git a/demo/wasm2wast/index.html b/demo/wasm2wat/index.html index 051f037b..d2de0eee 100644 --- a/demo/wasm2wast/index.html +++ b/demo/wasm2wat/index.html @@ -18,14 +18,14 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> - <title>wasm2wast demo</title> + <title>wasm2wat demo</title> <link href="../third_party/codemirror/codemirror.css" rel="stylesheet"> <link href="../primer.css" rel="stylesheet"> <link href="../custom.css" rel="stylesheet"> </head> <body> <div class="container"> - <h1>wasm2wast demo</h1> + <h1>wasm2wat demo</h1> <hr> <p>WebAssembly has a <a href="http://webassembly.github.io/spec/text/index.html">text format</a> diff --git a/scripts/fuzz-wasm2wast.sh b/scripts/fuzz-wasm2wat.sh index 8cfbca3b..b51979b4 100755 --- a/scripts/fuzz-wasm2wast.sh +++ b/scripts/fuzz-wasm2wat.sh @@ -21,4 +21,4 @@ set -o errexit SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" ROOT_DIR="$(dirname "${SCRIPT_DIR}")" -${FUZZ_BIN_DIR}/afl-fuzz -i fuzz-in/wasm/ -o fuzz-out -- out/gcc-fuzz/Debug/wasm2wast @@ +${FUZZ_BIN_DIR}/afl-fuzz -i fuzz-in/wasm/ -o fuzz-out -- out/gcc-fuzz/Debug/wasm2wat @@ diff --git a/src/tools/wasm2wast.cc b/src/tools/wasm2wat.cc index 8b2957fa..be1009b3 100644 --- a/src/tools/wasm2wast.cc +++ b/src/tools/wasm2wat.cc @@ -45,19 +45,19 @@ static std::unique_ptr<FileStream> s_log_stream; static bool s_validate = true; static const char s_description[] = -R"( read a file in the wasm binary format, and convert it to the wasm - s-expression file format. +R"( Read a file in the WebAssembly binary format, and convert it to + the WebAssembly text format. examples: - # parse binary file test.wasm and write s-expression file test.wast - $ wasm2wast test.wasm -o test.wast + # parse binary file test.wasm and write text file test.wast + $ wasm2wat test.wasm -o test.wat - # parse test.wasm, write test.wast, but ignore the debug names, if any - $ wasm2wast test.wasm --no-debug-names -o test.wast + # parse test.wasm, write test.wat, but ignore the debug names, if any + $ wasm2wat test.wasm --no-debug-names -o test.wat )"; static void ParseOptions(int argc, char** argv) { - OptionParser parser("wasm2wast", s_description); + OptionParser parser("wasm2wat", s_description); parser.AddOption('v', "verbose", "Use multiple times for more info", []() { s_verbose++; diff --git a/test/README.md b/test/README.md index e03508f4..207ab633 100644 --- a/test/README.md +++ b/test/README.md @@ -130,7 +130,7 @@ The currently supported list of tools (see a collection of `.wasm` and `.wast` files, then run `wasm-interp` on the JSON file. - `run-gen-wasm`: parse a "gen-wasm" text file (which can describe invalid - binary files), then parse via `wasm2wast` and display the result + binary files), then parse via `wasm2wat` and display the result - `run-gen-wasm-interp`: parse a "gen-wasm" text file, generate a wasm file, the run `wasm-interp` on it, which runes all exported functions in an interpreter diff --git a/test/binary/bad-duplicate-section-around-custom.txt b/test/binary/bad-duplicate-section-around-custom.txt index 752905dc..fcbe72a8 100644 --- a/test/binary/bad-duplicate-section-around-custom.txt +++ b/test/binary/bad-duplicate-section-around-custom.txt @@ -6,7 +6,7 @@ section(TYPE) { count[0] } section("foo") { 1 2 3 4 } section(TYPE) { count[0] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000017: error: section Type out of order ;;; STDERR ;;) diff --git a/test/binary/bad-duplicate-section.txt b/test/binary/bad-duplicate-section.txt index 1f206113..190ad39b 100644 --- a/test/binary/bad-duplicate-section.txt +++ b/test/binary/bad-duplicate-section.txt @@ -5,7 +5,7 @@ version section(TYPE) { count[0] } section(TYPE) { count[0] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000000d: error: section Type out of order ;;; STDERR ;;) diff --git a/test/binary/bad-duplicate-subsection.txt b/test/binary/bad-duplicate-subsection.txt index c6c75ed8..ef9b04d8 100644 --- a/test/binary/bad-duplicate-subsection.txt +++ b/test/binary/bad-duplicate-subsection.txt @@ -20,7 +20,7 @@ section("name") { count[0] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000028: error: duplicate sub-section ;;; STDERR ;;) diff --git a/test/binary/bad-export-func.txt b/test/binary/bad-export-func.txt index b59b6c00..1dd4f640 100644 --- a/test/binary/bad-export-func.txt +++ b/test/binary/bad-export-func.txt @@ -6,7 +6,7 @@ section(TYPE) { count[1] function params[0] results[0] } section(FUNCTION) { count[1] sig[0] } section(EXPORT) { count[1] str("foo") func_kind func[1] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000001b: error: invalid export func index: 1 ;;; STDERR ;;) diff --git a/test/binary/bad-extra-end.txt b/test/binary/bad-extra-end.txt index adf017af..f7330335 100644 --- a/test/binary/bad-extra-end.txt +++ b/test/binary/bad-extra-end.txt @@ -13,7 +13,7 @@ section(CODE) { } } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": error: popping empty label stack 000001a: error: OnEndExpr callback failed diff --git a/test/binary/bad-function-body-count.txt b/test/binary/bad-function-body-count.txt index 2e4b8986..d76302f6 100644 --- a/test/binary/bad-function-body-count.txt +++ b/test/binary/bad-function-body-count.txt @@ -9,7 +9,7 @@ section(CODE) { func { locals[0] } } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000016: error: function signature count != function body count ;;; STDERR ;;) diff --git a/test/binary/bad-function-local-type.txt b/test/binary/bad-function-local-type.txt index 602505d4..10654005 100644 --- a/test/binary/bad-function-local-type.txt +++ b/test/binary/bad-function-local-type.txt @@ -12,7 +12,7 @@ section(CODE) { } } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000019: error: expected valid local type ;;; STDERR ;;) diff --git a/test/binary/bad-function-names-too-many.txt b/test/binary/bad-function-names-too-many.txt index bb936ae6..e1aaff30 100644 --- a/test/binary/bad-function-names-too-many.txt +++ b/test/binary/bad-function-names-too-many.txt @@ -15,7 +15,7 @@ section("name") { str("g") } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": error: expected function name count (2) <= function count (1) 0000023: error: OnFunctionNamesCount callback failed diff --git a/test/binary/bad-function-param-type.txt b/test/binary/bad-function-param-type.txt index d61f7f38..756a69b2 100644 --- a/test/binary/bad-function-param-type.txt +++ b/test/binary/bad-function-param-type.txt @@ -7,7 +7,7 @@ section(TYPE) { function params[1] void results[0] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000000e: error: expected valid param type (got -64) ;;; STDERR ;;) diff --git a/test/binary/bad-function-result-type.txt b/test/binary/bad-function-result-type.txt index cb7fe427..cfb0e62c 100644 --- a/test/binary/bad-function-result-type.txt +++ b/test/binary/bad-function-result-type.txt @@ -7,7 +7,7 @@ section(TYPE) { function params[1] i32 results[1] void } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000010: error: expected valid result type: -64 ;;; STDERR ;;) diff --git a/test/binary/bad-function-sig.txt b/test/binary/bad-function-sig.txt index 95993af5..e68cb889 100644 --- a/test/binary/bad-function-sig.txt +++ b/test/binary/bad-function-sig.txt @@ -5,7 +5,7 @@ version section(TYPE) { count[1] function params[1] i32 results[1] i32 } section(FUNCTION) { count[1] type[1] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000014: error: invalid function signature index: 1 ;;; STDERR ;;) diff --git a/test/binary/bad-function-too-many-results.txt b/test/binary/bad-function-too-many-results.txt index 992c0c7e..cd05abde 100644 --- a/test/binary/bad-function-too-many-results.txt +++ b/test/binary/bad-function-too-many-results.txt @@ -4,7 +4,7 @@ magic version section(TYPE) { count[1] function params[0] results[2] i32 i32 } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000000e: error: result count must be 0 or 1 ;;; STDERR ;;) diff --git a/test/binary/bad-import-sig.txt b/test/binary/bad-import-sig.txt index c2d4c63a..9e81a66a 100644 --- a/test/binary/bad-import-sig.txt +++ b/test/binary/bad-import-sig.txt @@ -5,7 +5,7 @@ version section(TYPE) { count[1] function params[0] results[1] i32 } section(IMPORT) { count[1] str("module") str("func") func_kind type[1] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000020: error: invalid import signature index ;;; STDERR ;;) diff --git a/test/binary/bad-magic.txt b/test/binary/bad-magic.txt index 263be60c..bb13f7b6 100644 --- a/test/binary/bad-magic.txt +++ b/test/binary/bad-magic.txt @@ -3,7 +3,7 @@ 0 "ASM" version (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000004: error: bad magic value ;;; STDERR ;;) diff --git a/test/binary/bad-memory-init-max-size.txt b/test/binary/bad-memory-init-max-size.txt index 07fac13d..f5ef8a0f 100644 --- a/test/binary/bad-memory-init-max-size.txt +++ b/test/binary/bad-memory-init-max-size.txt @@ -9,7 +9,7 @@ section(MEMORY) { max[1] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000000e: error: memory initial size must be <= max size ;;; STDERR ;;) diff --git a/test/binary/bad-memory-init-size.txt b/test/binary/bad-memory-init-size.txt index befe9700..f6a5711c 100644 --- a/test/binary/bad-memory-init-size.txt +++ b/test/binary/bad-memory-init-size.txt @@ -8,7 +8,7 @@ section(MEMORY) { initial[leb_u32(65537)] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000000f: error: invalid memory initial size ;;; STDERR ;;) diff --git a/test/binary/bad-memory-max-size.txt b/test/binary/bad-memory-max-size.txt index dc8aec74..683a19e0 100644 --- a/test/binary/bad-memory-max-size.txt +++ b/test/binary/bad-memory-max-size.txt @@ -9,7 +9,7 @@ section(MEMORY) { max[leb_u32(65537)] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000010: error: invalid memory max size ;;; STDERR ;;) diff --git a/test/binary/bad-name-section-invalid-index.txt b/test/binary/bad-name-section-invalid-index.txt index e5640219..3301f1f0 100644 --- a/test/binary/bad-name-section-invalid-index.txt +++ b/test/binary/bad-name-section-invalid-index.txt @@ -19,7 +19,7 @@ section("name") { str("$F0") } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000028: error: invalid function index: 8 ;;; STDERR ;;) diff --git a/test/binary/bad-names-duplicate-locals.txt b/test/binary/bad-names-duplicate-locals.txt index 643c5684..1e96f65a 100644 --- a/test/binary/bad-names-duplicate-locals.txt +++ b/test/binary/bad-names-duplicate-locals.txt @@ -28,7 +28,7 @@ section("name") { str("L1") } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000035: error: duplicate local index: 0 ;;; STDERR ;;) diff --git a/test/binary/bad-names-duplicates.txt b/test/binary/bad-names-duplicates.txt index 3801e025..611c7c59 100644 --- a/test/binary/bad-names-duplicates.txt +++ b/test/binary/bad-names-duplicates.txt @@ -20,7 +20,7 @@ section("name") { str("F1") } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000002c: error: duplicate function name: 0 ;;; STDERR ;;) diff --git a/test/binary/bad-names-function-locals-out-of-order.txt b/test/binary/bad-names-function-locals-out-of-order.txt index dc97252b..864fd7e9 100644 --- a/test/binary/bad-names-function-locals-out-of-order.txt +++ b/test/binary/bad-names-function-locals-out-of-order.txt @@ -31,7 +31,7 @@ section("name") { str("L0") } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000003d: error: locals function index out of order: 0 ;;; STDERR ;;) diff --git a/test/binary/bad-names-locals-out-of-order.txt b/test/binary/bad-names-locals-out-of-order.txt index d05edc6a..f5234588 100644 --- a/test/binary/bad-names-locals-out-of-order.txt +++ b/test/binary/bad-names-locals-out-of-order.txt @@ -28,7 +28,7 @@ section("name") { str("L0") } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000035: error: local index out of order: 0 ;;; STDERR ;;) diff --git a/test/binary/bad-names-out-of-order.txt b/test/binary/bad-names-out-of-order.txt index ccb0a84f..02a8122c 100644 --- a/test/binary/bad-names-out-of-order.txt +++ b/test/binary/bad-names-out-of-order.txt @@ -21,7 +21,7 @@ section("name") { str("F0") } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000002c: error: function index out of order: 0 ;;; STDERR ;;) diff --git a/test/binary/bad-op-after-end.txt b/test/binary/bad-op-after-end.txt index c6ab8051..da64af13 100644 --- a/test/binary/bad-op-after-end.txt +++ b/test/binary/bad-op-after-end.txt @@ -13,7 +13,7 @@ section(CODE) { } } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": error: accessing stack depth: 0 >= max: 0 000001a: error: OnNopExpr callback failed diff --git a/test/binary/bad-section-ends-early.txt b/test/binary/bad-section-ends-early.txt index 7c7d73f4..d983e6d4 100644 --- a/test/binary/bad-section-ends-early.txt +++ b/test/binary/bad-section-ends-early.txt @@ -14,7 +14,7 @@ dummy[0] dummy[0] dummy[0] (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000000b: error: unfinished section (expected end: 0xf) ;;; STDERR ;;) diff --git a/test/binary/bad-section-size-zero.txt b/test/binary/bad-section-size-zero.txt index d1e43807..2eb7350b 100644 --- a/test/binary/bad-section-size-zero.txt +++ b/test/binary/bad-section-size-zero.txt @@ -6,7 +6,7 @@ section_code[1] section_size[0] ;; garbage after the section; shouldn't be read 1 2 3 4 5 (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000000a: error: unable to read u32 leb128: type count ;;; STDERR ;;) diff --git a/test/binary/bad-segment-no-memory.txt b/test/binary/bad-segment-no-memory.txt index d6759393..5e426ee8 100644 --- a/test/binary/bad-segment-no-memory.txt +++ b/test/binary/bad-segment-no-memory.txt @@ -8,7 +8,7 @@ section(DATA) { data[str("hi")] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000000b: error: data section without memory section ;;; STDERR ;;) diff --git a/test/binary/bad-start-func.txt b/test/binary/bad-start-func.txt index 38fcb7bf..112653d2 100644 --- a/test/binary/bad-start-func.txt +++ b/test/binary/bad-start-func.txt @@ -6,7 +6,7 @@ section(TYPE) { count[1] function params[0] results[0] } section(FUNCTION) { count[1] sig[0] } section(START) { func[1] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000015: error: invalid start function index: 1 ;;; STDERR ;;) diff --git a/test/binary/bad-subsection-out-of-order.txt b/test/binary/bad-subsection-out-of-order.txt index 35e92676..b0eeb489 100644 --- a/test/binary/bad-subsection-out-of-order.txt +++ b/test/binary/bad-subsection-out-of-order.txt @@ -20,7 +20,7 @@ section("name") { count[0] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000028: error: out-of-order sub-section ;;; STDERR ;;) diff --git a/test/binary/bad-subsection-size.txt b/test/binary/bad-subsection-size.txt index 1941c23d..4f9bba22 100644 --- a/test/binary/bad-subsection-size.txt +++ b/test/binary/bad-subsection-size.txt @@ -19,7 +19,7 @@ section("name") { str("$F0") } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000027: error: unable to read u32 leb128: function index ;;; STDERR ;;) diff --git a/test/binary/bad-subsection-unfinished.txt b/test/binary/bad-subsection-unfinished.txt index 44f32658..6a281b47 100644 --- a/test/binary/bad-subsection-unfinished.txt +++ b/test/binary/bad-subsection-unfinished.txt @@ -23,7 +23,7 @@ section("name") { data[1] } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000002c: error: unfinished sub-section (expected end: 0x30) ;;; STDERR ;;) diff --git a/test/binary/bad-type-form.txt b/test/binary/bad-type-form.txt index d7ab94c9..d26ee974 100644 --- a/test/binary/bad-type-form.txt +++ b/test/binary/bad-type-form.txt @@ -7,7 +7,7 @@ section(TYPE) { 0x20 } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 000000c: error: unexpected type form: 32 ;;; STDERR ;;) diff --git a/test/binary/bad-typecheck-missing-drop.txt b/test/binary/bad-typecheck-missing-drop.txt index 10b82719..daec1479 100644 --- a/test/binary/bad-typecheck-missing-drop.txt +++ b/test/binary/bad-typecheck-missing-drop.txt @@ -14,7 +14,7 @@ section(CODE) { } } (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": out/test/binary/bad-typecheck-missing-drop/bad-typecheck-missing-drop.wasm:000001c: error: type stack at end of function is 1, expected 0 ;;; STDERR ;;) diff --git a/test/binary/bad-version.txt b/test/binary/bad-version.txt index 8e988b98..f815fd2d 100644 --- a/test/binary/bad-version.txt +++ b/test/binary/bad-version.txt @@ -3,7 +3,7 @@ magic 0xe 0 0 0 (;; STDERR ;;; -Error running "wasm2wast": +Error running "wasm2wat": 0000008: error: bad wasm file version: 0xe (expected 0x1) ;;; STDERR ;;) diff --git a/test/find_exe.py b/test/find_exe.py index 098cf6e5..d05fac18 100644 --- a/test/find_exe.py +++ b/test/find_exe.py @@ -24,7 +24,7 @@ IS_WINDOWS = sys.platform == 'win32' SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) REPO_ROOT_DIR = os.path.dirname(SCRIPT_DIR) EXECUTABLES = [ - 'wast2wasm', 'wasm2wast', 'wasm-objdump', 'wasm-interp', 'wasm-opcodecnt', + 'wast2wasm', 'wasm2wat', 'wasm-objdump', 'wasm-interp', 'wasm-opcodecnt', 'wast-desugar', 'wasm-link' ] @@ -68,8 +68,8 @@ def GetWast2WasmExecutable(override=None): return FindExecutable('wast2wasm', override) -def GetWasm2WastExecutable(override=None): - return FindExecutable('wasm2wast', override) +def GetWasm2WatExecutable(override=None): + return FindExecutable('wasm2wat', override) def GetWasmdumpExecutable(override=None): diff --git a/test/gen-spec-js.py b/test/gen-spec-js.py index 5b7df621..40d22020 100755 --- a/test/gen-spec-js.py +++ b/test/gen-spec-js.py @@ -135,7 +135,7 @@ def F64ToJS(f64_bits): def UnescapeWasmString(s): # Wast allows for more escape characters than this, but we assume that - # wasm2wast will only use the \xx escapes. + # wasm2wat will only use the \xx escapes. result = '' i = 0 while i < len(s): @@ -218,15 +218,15 @@ def CollectInvalidModuleCommands(commands): class ModuleExtender(object): - def __init__(self, wast2wasm, wasm2wast, temp_dir): + def __init__(self, wast2wasm, wasm2wat, temp_dir): self.wast2wasm = wast2wasm - self.wasm2wast = wasm2wast + self.wasm2wat = wasm2wat self.temp_dir = temp_dir self.lines = [] self.exports = {} def Extend(self, wasm_path, commands): - wast_path = self._RunWasm2Wast(wasm_path) + wast_path = self._RunWasm2Wat(wasm_path) with open(wast_path) as wast_file: wast = wast_file.read() @@ -365,9 +365,9 @@ class ModuleExtender(object): inst = F64ToWasm(int(const['value'])) self.lines.append(inst) - def _RunWasm2Wast(self, wasm_path): + def _RunWasm2Wat(self, wasm_path): wast_path = ChangeDir(ChangeExt(wasm_path, '.wast'), self.temp_dir) - self.wasm2wast.RunWithArgs(wasm_path, '-o', wast_path) + self.wasm2wat.RunWithArgs(wasm_path, '-o', wast_path) return wast_path def _RunWast2Wasm(self, wast_path): @@ -499,12 +499,12 @@ def main(args): wast2wasm = Executable( find_exe.GetWast2WasmExecutable(options.bindir), error_cmdline=options.error_cmdline) - wasm2wast = Executable( - find_exe.GetWasm2WastExecutable(options.bindir), + wasm2wat = Executable( + find_exe.GetWasm2WatExecutable(options.bindir), error_cmdline=options.error_cmdline) wast2wasm.verbose = options.print_cmd - wasm2wast.verbose = options.print_cmd + wasm2wat.verbose = options.print_cmd with open(options.file) as json_file: json_dir = os.path.dirname(options.file) @@ -515,7 +515,7 @@ def main(args): modules = CollectInvalidModuleCommands(all_commands) with utils.TempDirectory(options.temp_dir, 'gen-spec-js-') as temp_dir: - extender = ModuleExtender(wast2wasm, wasm2wast, temp_dir) + extender = ModuleExtender(wast2wasm, wasm2wat, temp_dir) for module_command, assert_commands in modules: if assert_commands: wasm_path = os.path.join(json_dir, module_command['filename']) diff --git a/test/help/wasm2wast.txt b/test/help/wasm2wat.txt index 504e8dd4..5cbced57 100644 --- a/test/help/wasm2wast.txt +++ b/test/help/wasm2wat.txt @@ -1,17 +1,17 @@ -;;; EXE: %(wasm2wast)s +;;; EXE: %(wasm2wat)s ;;; FLAGS: --help (;; STDOUT ;;; -usage: wasm2wast [options] filename +usage: wasm2wat [options] filename - read a file in the wasm binary format, and convert it to the wasm - s-expression file format. + Read a file in the WebAssembly binary format, and convert it to + the WebAssembly text format. examples: - # parse binary file test.wasm and write s-expression file test.wast - $ wasm2wast test.wasm -o test.wast + # parse binary file test.wasm and write text file test.wast + $ wasm2wat test.wasm -o test.wat - # parse test.wasm, write test.wast, but ignore the debug names, if any - $ wasm2wast test.wasm --no-debug-names -o test.wast + # parse test.wasm, write test.wat, but ignore the debug names, if any + $ wasm2wat test.wasm --no-debug-names -o test.wat options: -v, --verbose Use multiple times for more info diff --git a/test/run-gen-wasm.py b/test/run-gen-wasm.py index 24c8b198..4b1aa8aa 100755 --- a/test/run-gen-wasm.py +++ b/test/run-gen-wasm.py @@ -59,16 +59,16 @@ def main(args): find_exe.GetWasmdumpExecutable(options.bindir), error_cmdline=options.error_cmdline) - wasm2wast = utils.Executable( - find_exe.GetWasm2WastExecutable(options.bindir), + wasm2wat = utils.Executable( + find_exe.GetWasm2WatExecutable(options.bindir), error_cmdline=options.error_cmdline) - wasm2wast.AppendOptionalArgs({ + wasm2wat.AppendOptionalArgs({ '--no-debug-names': options.no_debug_names, }) - wasm2wast.AppendOptionalArgs({'--verbose': options.verbose,}) + wasm2wat.AppendOptionalArgs({'--verbose': options.verbose,}) gen_wasm.verbose = options.print_cmd - wasm2wast.verbose = options.print_cmd + wasm2wat.verbose = options.print_cmd objdump.verbose = options.print_cmd with utils.TempDirectory(options.out_dir, 'run-gen-wasm-') as out_dir: @@ -77,7 +77,7 @@ def main(args): if options.objdump: objdump.RunWithArgs(out_file, '-x') else: - wasm2wast.RunWithArgs(out_file) + wasm2wat.RunWithArgs(out_file) if __name__ == '__main__': diff --git a/test/run-roundtrip.py b/test/run-roundtrip.py index 0924652c..47245f57 100755 --- a/test/run-roundtrip.py +++ b/test/run-roundtrip.py @@ -57,7 +57,7 @@ def FilesAreEqual(filename1, filename2, verbose=False): return (OK, '') -def TwoRoundtrips(wast2wasm, wasm2wast, out_dir, filename, verbose): +def TwoRoundtrips(wast2wasm, wasm2wat, out_dir, filename, verbose): basename = os.path.basename(filename) basename_noext = os.path.splitext(basename)[0] wasm1_file = os.path.join(out_dir, basename_noext + '-1.wasm') @@ -70,14 +70,14 @@ def TwoRoundtrips(wast2wasm, wasm2wast, out_dir, filename, verbose): # test) return (SKIPPED, None) try: - wasm2wast.RunWithArgs('-o', wast2_file, wasm1_file) + wasm2wat.RunWithArgs('-o', wast2_file, wasm1_file) wast2wasm.RunWithArgs('-o', wasm3_file, wast2_file) except Error as e: return (ERROR, str(e)) return FilesAreEqual(wasm1_file, wasm3_file, verbose) -def OneRoundtripToStdout(wast2wasm, wasm2wast, out_dir, filename, verbose): +def OneRoundtripToStdout(wast2wasm, wasm2wat, out_dir, filename, verbose): basename = os.path.basename(filename) basename_noext = os.path.splitext(basename)[0] wasm_file = os.path.join(out_dir, basename_noext + '.wasm') @@ -88,7 +88,7 @@ def OneRoundtripToStdout(wast2wasm, wasm2wast, out_dir, filename, verbose): # test) return (SKIPPED, None) try: - wasm2wast.RunWithArgs(wasm_file) + wasm2wat.RunWithArgs(wasm_file) except Error as e: return (ERROR, str(e)) return (OK, '') @@ -130,10 +130,10 @@ def main(args): '--no-check': options.no_check, }) - wasm2wast = utils.Executable( - find_exe.GetWasm2WastExecutable(options.bindir), + wasm2wat = utils.Executable( + find_exe.GetWasm2WatExecutable(options.bindir), error_cmdline=options.error_cmdline) - wasm2wast.AppendOptionalArgs({ + wasm2wat.AppendOptionalArgs({ '--fold-exprs': options.fold_exprs, '--enable-exceptions': options.enable_exceptions, '--inline-exports': options.inline_exports, @@ -143,7 +143,7 @@ def main(args): }) wast2wasm.verbose = options.print_cmd - wasm2wast.verbose = options.print_cmd + wasm2wat.verbose = options.print_cmd filename = options.file if not os.path.exists(filename): @@ -152,10 +152,10 @@ def main(args): with utils.TempDirectory(options.out_dir, 'roundtrip-') as out_dir: if options.stdout: - result, msg = OneRoundtripToStdout(wast2wasm, wasm2wast, out_dir, + result, msg = OneRoundtripToStdout(wast2wasm, wasm2wat, out_dir, filename, options.verbose) else: - result, msg = TwoRoundtrips(wast2wasm, wasm2wast, out_dir, filename, + result, msg = TwoRoundtrips(wast2wasm, wasm2wat, out_dir, filename, options.verbose) if result == ERROR: sys.stderr.write(msg) |