wa_parser (wa_parser v0.1.0)

View Source

WebAssembly binary format parser — event based.

Parses a .wasm binary into a flat sequence of parse events. Use it directly from Erlang:

Events = wa_parser:events(Binary).

Each event is one of {magic, Bin}, {version, Bin}, {section_id, Id}, {section_type, Type}, {section_length, Len}, {section_body, Body}. Malformed input raises erlang:error({parse_error, Reason, DetailBin}), where Reason is a stable atom (e.g. bad_magic, truncated, unknown_opcode, non_canonical) suitable for programmatic matching.

Elixir projects can use the wa_parser_ex package for an idiomatic wrapper (WaParser.stream/1 plus a %WaParser.ParseError{} exception).

Summary

Functions

Parses a WASM binary into the full list of parse events.

Functions

events(Data)

Parses a WASM binary into the full list of parse events.

Raises erlang:error({parse_error, Reason, Detail}) on malformed input.

parse/1