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
Identifiers and Naming
Literals
Numbers
| Syntax | Type | Example |
-?[0-9]+ | :i32 | 42, -7 |
-?[0-9]+i64 | :i64 | 1000i64 |
0x… | :i32 | 0xFF |
-?[0-9]*\.[0-9]+ | :f32 | 3.14 |
'c' | :i32 | 'A' → 65, \n' → 10 |
Strings
| Syntax | Type | Example |
"…" | :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