WABT(1)

πŸ’… WABT(1) β€” the wast2json era πŸ’…

okay so bestie, welcome to the WABT girlies' corner of the manual. this one's all about wast2json, and yes she's iconic, yes she eats, let's get into it πŸŽ€


✨ NAME ✨

wast2json β€” convert a file in the wasm spec test format to a JSON file and associated wasm binary files

like literally she takes your .wast and gives you back a JSON plus a lil pile of .wasm binaries. no cap. πŸ¦‹


🌸 SYNOPSIS 🌸

wast2json [options] filename

one filename, and then whatever options your heart desires. that's the whole vibe check. πŸ’–


πŸ‘‘ DESCRIPTION πŸ‘‘

so wast2json reads a file in the wasm spec test format, checks it for errors (yes she's a good friend like that, she'll tell you if something's wrong 😭), and converts it to a JSON file and associated wasm binary files.

the options are as follows, and there are A LOT of them, so buckle up buttercup:

  • --help β€” prints this help message. the classic. the blueprint. 🫢
  • --version β€” print version information. who are you, really?
  • -v, --verbose β€” use multiple times for more info. stack her up, she gets chattier every time, iykyk πŸ”₯
  • --disable-exceptions β€” disable Experimental exception handling
  • --disable-mutable-globals β€” disable Import/export mutable globals
  • --disable-saturating-float-to-int β€” disable Saturating float-to-int operators
  • --disable-sign-extension β€” disable Sign-extension operators
  • --disable-simd β€” disable SIMD support
  • --enable-threads β€” enable Threading support
  • --enable-function-references β€” enable Typed function references
  • --disable-multi-value β€” disable Multi-value
  • --disable-tail-call β€” disable Tail-call support
  • --disable-bulk-memory β€” disable Bulk-memory operations
  • --disable-reference-types β€” disable Reference types (externref)
  • --disable-annotations β€” disable Custom annotation syntax
  • --enable-code-metadata β€” enable Code metadata
  • --enable-gc β€” enable Garbage collection πŸ—‘οΈβœ¨ (not the vibes kind, the memory kind)
  • --disable-memory64 β€” disable 64-bit memory
  • --disable-multi-memory β€” disable Multi-memory
  • --disable-extended-const β€” disable Extended constant expressions
  • --disable-relaxed-simd β€” disable Relaxed SIMD
  • --enable-custom-page-sizes β€” enable Custom page sizes
  • --enable-compact-imports β€” enable Compact import section
  • --enable-wide-arithmetic β€” enable Wide arithmetic
  • --enable-all β€” enable all features. the "i want everything, give me the whole menu" option πŸ‘‘
  • -o, --output=FILE β€” output JSON file
  • -r, --relocatable β€” Create a relocatable wasm binary (suitable for linking with e.g. lld)
  • --no-canonicalize-leb128s β€” Write all LEB128 sizes as 5-bytes instead of their minimal size
  • --debug-names β€” Write debug names to the generated binary file
lowkey noticing how many of these are --disable vs --enable? yeah. she's got opinions about defaults and she's not sorry. πŸ’…

🌈 EXAMPLES 🌈

ok so hear me out β€” parse spec-test.wast, and write files to spec-test.json. Modules are written to spec-test.0.wasm, spec-test.1.wasm, etc. (yes babe, numbered. one for every module. it's giving organized.)

$ wast2json spec-test.wast -o spec-test.json

literally that's it. she ate and left no crumbs. πŸ“


πŸ’œ SEE ALSO πŸ’œ

the whole friend group, fr fr:

wasm-interp(1), wasm-objdump(1), wasm-stats(1), wasm-strip(1), wasm-validate(1), wasm2c(1), wasm2wat(1), wat-desugar(1), wat2wasm(1), spectest-interp(1)

group chat's poppin' off, ngl. 🧚


πŸ™ˆ BUGS πŸ™ˆ

If you find a bug, please report it at https://github.com/WebAssembly/wabt/issues.

don't be shy, bestie β€” they literally want to know. it's not snitching, it's contributing to open source. main character energy. ⭐


and that's the tea πŸ«– β€” this page came to you from the Debian fam, with the $Mdocdate$ date stamped on it, and it's all wrapped up as WABT(1). go forth and convert some spec tests, queen πŸ‘‘πŸ’–

πŸ“¦ where this page comes from