37 stable releases

1.0.38 Jun 15, 2021
1.0.37 Mar 31, 2021
1.0.35 Feb 19, 2021
1.0.31 Dec 15, 2020
0.1.0 Sep 23, 2016

#254 in WebAssembly

Download history 15133/week @ 2021-04-03 14802/week @ 2021-04-10 15347/week @ 2021-04-17 14363/week @ 2021-04-24 14292/week @ 2021-05-01 15594/week @ 2021-05-08 15610/week @ 2021-05-15 17183/week @ 2021-05-22 16327/week @ 2021-05-29 15784/week @ 2021-06-05 17786/week @ 2021-06-12 18789/week @ 2021-06-19 16691/week @ 2021-06-26 17932/week @ 2021-07-03 17850/week @ 2021-07-10 14328/week @ 2021-07-17

66,810 downloads per month
Used in 98 crates (28 directly)

Apache-2.0 WITH LLVM-exception



A Bytecode Alliance project

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

Crates.io version Download docs.rs docs docs.rs docs


Add this to your Cargo.toml:

wat = "1.0"

And then you can parse WAT to binary WebAssembly via:

// Parse from a file ...
let binary = wat::parse_file("./foo.wat")?;

// ... or a string
let wat = r#"
        (func $foo)

        (func (export "bar")
            call $foo
let binary = wat::parse_str(wat)?;

Low-level parsing

This repository and project also aims to provide low-level parsing support for the WAT and WAST formats. Effectively, if you've got an s-expression lookalike that you'd like to parse, you should be able to parse it!

The wat crate does not support this because it strives to provide strong API-level stability guarantees, but the wast crate has all the low-level details and is the implementation of the wast crate. Be sure to check out its README.md for more information.

Stability and WebAssembly Features

Consult the crate documentation for more information, but the general idea is this crate will not issue a semver-breaking change for breaking changes in the WAT format, either for MVP features or post-MVP features. No opt-in is required to use WebAssembly features, so using them may break if the upstream spec changes.


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


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 licensed as above, without any additional terms or conditions.