#parser #utility

wasm-opcodes

A set of procedural enums useful for readabilty when implementing something over all wasm instructions

1 unstable release

0.115.1 Oct 19, 2023
0.115.0 Oct 19, 2023

#1114 in #utility

MIT license

18KB
310 lines

WASM-opcodes

crates.io docs.rs crates.io

A set of procedural enums useful for readabilty when implementing something over all wasm instructions.


lib.rs:

Implementing something on top of wasmparser is slightly tedious due to the number of operations that it can parse, usually resulting in either a huge match statement, or several match statements which each process some subset of the operations and then have a catchall unreachable!() statement. This crate provides a middleground: a hierarchy of operations, split by proposal, allowing you to exhaustively match firstly on the proposal, and then secondly on the operation.

To start, use OperatorByProposal::from(op: wasmparser::Operator), or the equivalent Into implementation.

Versioning

This crate aims to match versions with wasmparser, since the code in this crate is generated from wasmparser's supported operations.

Dependencies

~2MB
~41K SLoC