Quick start
Hello world, the flags you'll reach for daily, and the ahead-of-time path that turns a script into a self-contained binary — in one page.
Hello world
Save the following as hello.wren:
System.print("hello, world")
Run it:
wlift hello.wren
// hello, world
That's the whole loop. wlift parses the source,
builds MIR, runs the bytecode interpreter, and tiers up to
the Cranelift JIT for any hot function. No build step, no
config file.
A first class
class Counter {
construct new(start) {
_n = start
}
next {
_n = _n + 1
return _n
}
toString { "Counter(%(_n))" }
}
var c = Counter.new(0)
System.print(c.next) // 1
System.print(c.next) // 2
System.print(c) // Counter(2)
Wrenlift accepts the stock Wren syntax verbatim, plus a few small additions documented in the reference.
REPL
Omit the file argument to drop into the REPL:
$ wlift
> var greet = Fn.new {|name| "hello, %(name)" }
> greet.call("wren")
"hello, wren"
> .exit
CLI flags you'll reach for
| Flag | What it does |
|---|---|
--mode interpreter | Skip the JIT entirely. Useful for debugging. |
--mode tiered (default) | Interpret cold code, JIT-compile hot functions on the fly. |
--mode jit | Compile everything up front before executing. |
--aot <out> | Build a self-contained native binary. See below. |
--bundle <out> | Pack a source tree into a .hatch distribution package. |
--inspect | Print the manifest + section list of a .hatch file. |
--dump-mir · --dump-opt · --dump-asm | Dump MIR / optimised MIR / generated machine code. Compiler debug. |
--gc-stats | Print GC counters after the program finishes. |
--gc <strategy> | generational (default), arena, or mark-sweep. |
AOT — ship a single binary
wlift --aot compiles a source tree into a
self-contained executable that runs without the
wlift runtime installed.
wlift hello.wren --aot ./hello
./hello
// hello, world
The output is a real ELF / Mach-O / PE binary — ship it
the same way you'd ship any other native program.
Cross-compile by passing a target triple to
wlift --aot (see the
platform guides for
per-OS notes on packaging and code signing).
Running a published package
Packages from the
Hatch registry
ship as .hatch bundles. Pass one directly to
wlift:
wlift my-app.hatch
For a project with dependencies, use the
hatch CLI:
$ hatch run path/to/my-app
loading @hatch:http@0.3.4
loading @hatch:json@0.1.4
> standalone · serving :8080
Next steps
- Run Wrenlift in the browser — the
wlift.jsharness API. - Embed in a Rust app — add
wren_liftas a crate. - Built-in reference — what's available beyond stock Wren.