Language reference

How to code in Woua

Overview

Woua programming language aims at creating WebAssembly programs. Woua syntax is inspired from Lisp syntax.

Syntax Basics

Whitespace and Comments

Identifiers and Naming

Literals

Numbers

SyntaxTypeExample
-?[0-9]+:i3242, -7
-?[0-9]+i64:i641000i64
0x…:i320xFF
-?[0-9]*\.[0-9]+:f323.14
'c':i32'A' → 65, \n' → 10

Strings

SyntaxTypeExample
"…":String"hello"

Booleans

Nil/Unit

Types

Primitive Types

Structs and Value Types

Reference Types

Type Annotations and Inference

Variables and Bindings

let, set!

Scoping Rules

Functions

defn

(defn add (a :i32 b :i32) :i32
  (+ a b))

Parameters and Return Types

Variadic Functions

Anonymous Functions (lambdas)

Macros

defmacro

(defmacro when (cond body)
  (if cond body 0))

Macro Expansion

Variadic Macros

(defmacro my-macro (fixed ...rest)
  ...)

Control Flow

if, cond

when, unless

loop, recur, while

match/case

Data Structures

Arrays/Vectors

Maps/Dictionaries

Sets

Pattern Matching

Modules and Imports

include, import, require

Interop

WASI/host calls

Foreign Function Interface (FFI)

Memory Management

Value vs Reference Semantics

Garbage Collection

Error Handling

try/catch, error values

Standard Library Overview

IO, Math, String, etc.

Compilation and Execution

Building

Running

WASM/WASI specifics

Appendix

Grammar

Reserved Words

Style Guide