#wasm-interpreter #walrus #simple #interpreter

walrus-simple-interpreter

A simple interpreter for WebAssembly using the Walrus library

4 releases

Uses new Rust 2024

new 0.2.2 May 1, 2025
0.2.1 May 1, 2025
0.2.0 May 1, 2025
0.1.0 Apr 30, 2025

#584 in WebAssembly

Download history

59 downloads per month

MIT/Apache

32KB
644 lines

A tiny and incomplete Wasm interpreter

This code's base is https://github.com/rustwasm/wasm-bindgen/blob/c35cc9369d5e0dc418986f7811a0dd702fb33ef9/crates/wasm-interpreter/src/lib.rs

This module contains a tiny and incomplete Wasm interpreter built on top of walrus's module structure. Each Interpreter contains some state about the execution of a Wasm instance.


simple wasm interpreter

This dependents walrus, anyhow, log only.

  • call func with virtual system per eval operation
  • register import func
  • Coverage of some instruction. If not enough, we recommend pull-request.
  • only 700 code lines
  • used by my other project
let mut interpreter = walrus_simple_interpreter::Interpreter::new(&module)?;
interpreter.set_interrupt_handler(|_, instr, _| {
    println!("Interrupt handler called");
    println!("Instr: {instr:?}");

    Ok(())
});
interpreter.call(fid, self, &[])?;

Dependencies

~5.5MB
~116K SLoC