A pure-ruby webassembly runtime.
- Fully typed by RBS (with the aid of rbs-inline)
- WASI (p1) support
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
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
- 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!
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
.
Bug reports and pull requests are welcome on GitHub at https://github.com/udzura/wardite.
- https://github.com/technohippy/wasmrb?tab=readme-ov-file
- Referencial implementation but no support with WASI
- Wardite aims to support full WASI (previwe 1)
- https://github.com/skanehira/chibiwasm
- Small and consise implementation in Rust
- Wardite was first built upon its development tutorial. Thanks!
- Many of test wat files under
examples/
are borrowed from chibiwasm project