#webassembly #wat #parser #text

wast

Customizable Rust parsers for the WebAssembly Text formats WAT and WAST

68 releases (major breaking)

new 52.0.3 Feb 3, 2023
51.0.0 Jan 17, 2023
50.0.0 Nov 21, 2022
49.0.0 Nov 9, 2022
1.0.2 Oct 17, 2019

#13 in WebAssembly

Download history 97374/week @ 2022-10-14 82754/week @ 2022-10-21 78324/week @ 2022-10-28 67699/week @ 2022-11-04 82267/week @ 2022-11-11 70344/week @ 2022-11-18 69592/week @ 2022-11-25 58086/week @ 2022-12-02 70418/week @ 2022-12-09 67489/week @ 2022-12-16 30746/week @ 2022-12-23 48924/week @ 2022-12-30 66111/week @ 2023-01-06 64713/week @ 2023-01-13 68920/week @ 2023-01-20 63672/week @ 2023-01-27

273,940 downloads per month
Used in 296 crates (30 directly)

Apache-2.0 WITH LLVM-exception

795KB
18K SLoC

wast

A Bytecode Alliance project

A Rust parser for the WebAssembly Text Format (WAT).

Crates.io version Download docs.rs docs

Usage

Add wast to your Cargo.toml

$ cargo add wast

The intent of this crate is to provide utilities, combinators, and built-in types to parse anything that looks like a WebAssembly s-expression.

  • Need to parse a *.wat file?
  • Need to parse a *.wast file?
  • Need to run test suite assertions from the official wasm test suite?
  • Want to write an extension to the WebAssembly text format?

If you'd like to do any of the above this crate might be right for you! You may also want to check out the wat crate which provides a much more stable interface if all you'd like to do is convert *.wat to *.wasm.

Cargo features

By default this crate enables and exports support necessary to parse *.wat and *.wast files, or in other words entire wasm modules. If you're using this crate, however, to parse simply an s-expression wasm-related format (like *.witx or *.wit perhaps) then you can disable the default set of features to only include a lexer, the parsing framework, and a few basic token-related parsers.

$ cargo add wast --no-default-features

License

This project is licensed under the Apache 2.0 license with the LLVM exception. See LICENSE for more details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies