All Projects → mohanson → Pywasm

mohanson / Pywasm

Licence: mit
A WebAssembly interpreter written in pure Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pywasm

pywasm3
Python bindings for Wasm3, the fastest WebAssembly interpreter
Stars: ✭ 34 (-88.36%)
Mutual labels:  webassembly
Riscv Rust
RISC-V processor emulator written in Rust+WASM
Stars: ✭ 253 (-13.36%)
Mutual labels:  webassembly
Dragon Iss Docking Autopilot
Autopilot in Go for docking the SpaceX Dragon capsule in the simulator
Stars: ✭ 276 (-5.48%)
Mutual labels:  webassembly
Front-end-tutorial
🐼 最全的资源教程-前端涉及的所有知识体系,并在 Nice Front-end Tutorial 持续更新;
Stars: ✭ 1,655 (+466.78%)
Mutual labels:  webassembly
node-wasm-trace
Instruments wasm files and traces execution
Stars: ✭ 24 (-91.78%)
Mutual labels:  webassembly
Vmsg
🎵 Library for creating voice messages
Stars: ✭ 257 (-11.99%)
Mutual labels:  webassembly
lxgui
Portable, real time, modular and data-driven GUI C++ library.
Stars: ✭ 50 (-82.88%)
Mutual labels:  webassembly
Blazorfilereader
Library for creating read-only file streams from file input elements or drop targets in Blazor.
Stars: ✭ 278 (-4.79%)
Mutual labels:  webassembly
wasm-arrays
A couple of helper functions to make WebAssembly array parameters easy to use
Stars: ✭ 33 (-88.7%)
Mutual labels:  webassembly
Wasm Git
GIT for nodejs and the browser using https://libgit2.org compiled to WebAssembly with https://emscripten.org
Stars: ✭ 261 (-10.62%)
Mutual labels:  webassembly
wgpu-rust-renderer
A tiny WebGPU renderer written in Rust
Stars: ✭ 81 (-72.26%)
Mutual labels:  webassembly
x-img-diff-js
🎨 JavaScript library which compares 2 images and detect structural difference information using OpenCV(WebAssembly)
Stars: ✭ 43 (-85.27%)
Mutual labels:  webassembly
Wargo
Easy Rust to WebAssembly
Stars: ✭ 260 (-10.96%)
Mutual labels:  webassembly
Binaryen
Binaryen for Swift
Stars: ✭ 15 (-94.86%)
Mutual labels:  webassembly
Glas
WebGL in WebAssembly with AssemblyScript
Stars: ✭ 278 (-4.79%)
Mutual labels:  webassembly
golang-wasm
Golang-WASM provides a simple idiomatic, and comprehensive API and bindings for working with WebAssembly for Go and JavaScript developers
Stars: ✭ 57 (-80.48%)
Mutual labels:  webassembly
Cone
Cone Programming Language
Stars: ✭ 257 (-11.99%)
Mutual labels:  webassembly
Wasmer Ruby
💎🕸 WebAssembly runtime for Ruby
Stars: ✭ 286 (-2.05%)
Mutual labels:  webassembly
Wasabi
A dynamic analysis framework for WebAssembly programs.
Stars: ✭ 279 (-4.45%)
Mutual labels:  webassembly
Octopus
Security Analysis tool for WebAssembly module (wasm) and Blockchain Smart Contracts (BTC/ETH/NEO/EOS)
Stars: ✭ 261 (-10.62%)
Mutual labels:  webassembly

pywasm: A WebAssembly interpreter written in pure Python.

Build Status

A WebAssembly interpreter written in pure Python.

The wasm version currently in use is: WebAssembly Core Specification, W3C Recommendation, 5 December 2019. Just like Firefox or Chrome does.

Installation

$ pip3 install pywasm

Some simple examples

  1. First we need a wasm module! Grab our ./examples/fib.wasm file and save a copy in a new directory on your local machine. Note: fib.wasm was compiled from ./examples/fib.c by WasmFiddle.

  2. Now, compile and instantiate WebAssembly modules directly from underlying sources. This is achieved using the pywasm.load method.

import pywasm
# pywasm.on_debug()

runtime = pywasm.load('./examples/fib.wasm')
r = runtime.exec('fib', [10])
print(r) # 55

A brief description for ./examples

File Description
./examples/add.wasm Export i32.add function
./examples/env.wasm Call python/native function in wasm
./examples/fib.wasm Fibonacci, which contains loop and recursion
./examples/str.wasm Export a function which returns string
./examples/sum.wasm Equal difference series summation

Of course there are some more complicated examples!

Test

$ python3 ./test/test_spec.py

Tested in the following environments:

  • Python >= 3.6

Thanks

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].