Skip to content

udzura/wardite

Repository files navigation

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

About

A pure-ruby webassembly runtime.

Resources

Stars

Watchers

Forks

Packages

No packages published