Project

wardite

0.0
The project is in a healthy, maintained state
A pure-ruby webassembly runtime
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Wardite

workflow gem version

A pure-ruby webassembly runtime.

  • Fully typed by RBS (with the aid of rbs-inline)
  • WASI (p1) support

Supported Instructions

ref: https://webassembly.github.io/spec/core/binary/instructions.html

  • Control Instructions
  • Parametric Instructions
  • Variable Instructions
  • Table Instructions
  • Memory Instructions (except data.drop)
  • Numeric Instructions (0x41 ... 0xC4)
  • Numeric Instructions (0xFC Operations)
  • Reference Instructions
  • Vector Instructions
  • end 0x0B

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add wardite

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install wardite

Usage

  • In your ruby code, instanciate Wardite runtime:
require "wardite"

path = ARGV[0]
method = ARGV[1]
args = ARGV[2..-1] || []

instance = Wardite::new(path: path)
if !method && instance.runtime.respond_to?(:_start)
  instance.runtime._start
else
  instance.runtime.call(method, args)
end
  • Wardite bundles wardite cli command:
$ wardite examples/test.wasm
#=> Test!

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bundle exec rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

Additionaly, you can run bundle exec rake check to generate rbs files from annotations and run steep check.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/udzura/wardite.

See also