we (web engine): Experimental web browser project to understand the limits of Claude
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

WebAssembly binary module parser #220

open opened by pierrelf.com

Add a new we-wasm workspace crate and implement the WebAssembly binary format parser (WebAssembly Core Specification 2.0, ยง5 Binary Format). This is the foundation for the entire Phase 22 effort and must precede validation, execution, and JS API issues.

Scope:

  • Create crates/wasm/ with name we-wasm; add to workspace; 100% safe Rust; zero external dependencies.
  • Implement readers for LEB128 unsigned/signed integers, IEEE-754 f32/f64 little-endian floats, and UTF-8 names with length prefix per spec.
  • Parse the module preamble: magic 0x6d736100 and version 1.
  • Parse all standard sections: Custom (0), Type (1), Import (2), Function (3), Table (4), Memory (5), Global (6), Export (7), Start (8), Element (9), Code (10), Data (11), DataCount (12).
  • Parse all numeric, parametric, variable, table, memory, control, and reference instruction opcodes into an intermediate enum representation (no execution yet).
  • Reject malformed modules with structured ParseError values that carry byte offsets and human-readable diagnostics.
  • Preserve unknown custom sections as opaque byte blobs (name + payload) so later issues can layer on name sections and debug info.

Acceptance criteria:

  • Unit tests cover LEB128 edge cases (max-width, malformed, overflow), preamble parsing, every section type round-tripped from hand-authored binary fixtures, and at least one Rust-compiled real-world module from rustc target wasm32-unknown-unknown.
  • Parser surface area is the public crate API; downstream crates can build an in-memory Module struct via we-wasm::parse(&[u8]).
  • cargo clippy --workspace -- -D warnings passes; no unsafe outside allowed crates; no external dependencies.
sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mm2tjhbkig2z