bacaea238f
Pull in a number of new SIMD opcodes, and a change from iNxM.any_true to v128.any_true. Plus whatever else has landed in the mean time... Differential Revision: https://phabricator.services.mozilla.com/D102398 |
||
---|---|---|
.. | ||
src | ||
.cargo-checksum.json | ||
Cargo.toml | ||
README.md |
README.md
Usage
Add this to your Cargo.toml
:
[dependencies]
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#"
(module
(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.
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 licensed as above, without any additional terms or conditions.