wasm-ast

Crates.iowasm-ast
lib.rswasm-ast
version0.1.0
sourcesrc
created_at2021-08-19 15:29:50.088544
updated_at2021-10-27 00:00:32.79185
descriptionA WebAssembly syntax model useful for generate, reading, and emitting WebAssembly code.
homepagehttps://github.com/misalcedo/wasm-ast
repositoryhttps://github.com/misalcedo/wasm-ast
max_upload_size
id439674
size340,324
Miguel D. Salcedo (misalcedo)

documentation

https://docs.rs/wasm-ast

README

WASM

Build License Crates.io Version Docs.rs Version

A Rust-native WebAssembly syntax model useful for generating, parsing, and emitting WebAssembly code.

Design

WASM-AST is designed with minimal validation. The goal is to closely model the WASM syntax specification in order to allow valid and invalid abstract syntax trees. Lastly, modules cannot be mutated once built.

Features

Parser

A parser for binary WebAssembly format. Attempts to maintain as much of the binary information as possible.

Text

A parser for the text and binary WebAssembly formats. The text format is transformed to binary, then passed to the binary parser. Some information may be lost in the text to binary conversion.

Emitter

Emits binary WebAssembly format for a module.

Usage

To use wasm-ast, first add this to your Cargo.toml:

[dependencies]
wasm-ast = "0.1.0"

Then, add this to your crate:

use wasm_ast::model::Module;

fn main() {
    let mut builder = Module::builder();
    let module = builder.build();
}

Examples

Create an empty WASM module:

use wasm_ast::model::Module;

fn main() {
    let module = Module::empty();
}

Additional (i.e., more useful) examples can be found in the repository.

Stability

The interface is considered stable. No breaking changes will be introduced until the next major version (e.g. 1.0).

Issues

Please file any issues for areas where this crate does not properly adhere to the WebAssembly standard.

License

Licensed under Apache License, Version 2.0 (LICENSE-APACHE or http://apache.org/licenses/LICENSE-2.0)

Contribution

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

Commit count: 162

cargo fmt