| 1 |
<div align="center"> |
| 2 |
<h1><code>wast</code></h1> |
| 3 |
|
| 4 |
<strong>A <a href="https://bytecodealliance.org/">Bytecode Alliance</a> project</strong> |
| 5 |
|
| 6 |
<p> |
| 7 |
<strong>A Rust parser for the <a href="https://webassembly.github.io/spec/core/text/index.html">WebAssembly Text Format (WAT)</a>.</strong> |
| 8 |
</p> |
| 9 |
|
| 10 |
<p> |
| 11 |
<a href="https://crates.io/crates/wast"><img src="https://img.shields.io/crates/v/wast.svg?style=flat-square" alt="Crates.io version" /></a> |
| 12 |
<a href="https://crates.io/crates/wast"><img src="https://img.shields.io/crates/d/wast.svg?style=flat-square" alt="Download" /></a> |
| 13 |
<a href="https://docs.rs/wast/"><img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square" alt="docs.rs docs" /></a> |
| 14 |
</p> |
| 15 |
</div> |
| 16 |
|
| 17 |
|
| 18 |
## Usage |
| 19 |
|
| 20 |
Add `wast` to your `Cargo.toml` |
| 21 |
|
| 22 |
```sh |
| 23 |
$ cargo add wast |
| 24 |
``` |
| 25 |
|
| 26 |
The intent of this crate is to provide utilities, combinators, and built-in |
| 27 |
types to parse anything that looks like a WebAssembly s-expression. |
| 28 |
|
| 29 |
* Need to parse a `*.wat` file? |
| 30 |
* Need to parse a `*.wast` file? |
| 31 |
* Need to run test suite assertions from the official wasm test suite? |
| 32 |
* Want to write an extension to the WebAssembly text format? |
| 33 |
|
| 34 |
If you'd like to do any of the above this crate might be right for you! You may |
| 35 |
also want to check out the `wat` crate which provides a much more stable |
| 36 |
interface if all you'd like to do is convert `*.wat` to `*.wasm`. |
| 37 |
|
| 38 |
## Cargo features |
| 39 |
|
| 40 |
By default this crate enables and exports support necessary to parse `*.wat` and |
| 41 |
`*.wast` files, or in other words entire wasm modules. If you're using this |
| 42 |
crate, however, to parse simply an s-expression wasm-related format (like |
| 43 |
`*.witx` or `*.wit` perhaps) then you can disable the default set of features to |
| 44 |
only include a lexer, the parsing framework, and a few basic token-related |
| 45 |
parsers. |
| 46 |
|
| 47 |
```sh |
| 48 |
$ cargo add wast --no-default-features |
| 49 |
``` |
| 50 |
|
| 51 |
# License |
| 52 |
|
| 53 |
This project is licensed under the Apache 2.0 license with the LLVM exception. |
| 54 |
See [LICENSE](LICENSE) for more details. |
| 55 |
|
| 56 |
### Contribution |
| 57 |
|
| 58 |
Unless you explicitly state otherwise, any contribution intentionally submitted |
| 59 |
for inclusion in this project by you, as defined in the Apache-2.0 license, |
| 60 |
shall be dual licensed as above, without any additional terms or conditions. |