Getting started

Prerequisites

You need two tools:

  • wasmtime — WASI-compatible WebAssembly runtime
  • wat2wasm — assembles .wat text modules to binary .wasm (part of the WABT toolkit)

Building the compiler

The woua compiler (wouac) is written in AssemblyScript.

cd wouac
npm install
./node_modules/.bin/asc assembly/index.ts --target release

This produces wouac/dist/wouac.wasm.

Compiling a program

wasmtime --dir . wouac/dist/wouac.wasm hello_world.woua -o hello_world.wat
wat2wasm hello_world.wat -o hello_world.wasm
wasmtime hello_world.wasm

Your first program

(include io)

(defn main ()
  (printf "hello %s!\n" (string "world")))

Save as hello.woua, compile and run — you should see:

hello world!