Swam Build Status Codacy Badge

Swam is a WebAssembly interpreter written in Scala with the cats library. It passes all the official specification tests. It is under an Apache 2 license.

Cats Friendly Badge

Join the chat at https://gitter.im/satabin/swam

Getting Started

To build it, we use mill. Mill is not packaged for all Linux distributions, but you can use curl to install it (see Installation instructions in the doc).

You can also use the mill wrapper provided in this repository with the recommended mill version. It will download mill for you if you do not have it already, and run it. To use it, replace following mill commands by ./millw

If you want to run the specification tests, just type:

mill runtime.test

It you want to test swam in a REPL session, just type tostart an ammonite shell with runtime project in classpath.:

mill -i runtime.console

If you want a REPL session with both runtime and text, the easiest way is to start a session for the runtime.test project:

$ mill -i runtime.test.console

Architecture

This project defines several modules:

  • The core module is a library that makes it possible to manipulate binary representation of WebAssembly modules. In particular it contains:
    • a streaming parser for the binary format;
    • a compiler from text to binary format.
  • The runtime module is a non-web embedding to instantiate and run WebAssembly modules.
  • The text module is a library that makes it possible to manipulate text representation of WebAssembly modules. It is not included in the core module as text representation is more of a debug feature, and the runtime does not want to bring that dependency with it.

If you want more details, please refer to the website.