Install
Fern is a Go-built compiler. Until prebuilt binaries land, build from source — one command.
Prerequisites
Section titled “Prerequisites”- Go 1.24+ (download). The compiler is a single Go module with no external dependencies.
- A C linker for native targets (
clangorgcc;ccis fine). Only needed to produce ELF / Mach-O executables; the WASM target needs no linker.
Build the toolchain
Section titled “Build the toolchain”git clone https://github.com/JakeChampion/langcd langgo build -o ~/.local/bin/fern ./cmd/fernfern is now on your PATH. Verify:
fern -helpCompanion binaries
Section titled “Companion binaries”| Binary | Build command | Purpose |
|---|---|---|
fern | go build ./cmd/fern | The main compiler + runner. |
fern-lsp | go build ./cmd/fern-lsp | Language server for editors. |
dump_arm64 | go build ./cmd/dump_arm64 | Disassemble an emitted .s file. |
dump_wat | go build ./cmd/dump_wat | Inspect a .wat module. |
Run hello, world
Section titled “Run hello, world”Save this as hello.fern:
function main(): i32 { print("hello, world"); return 0;}Run it under the interpreter:
fern -interp hello.fernOr compile to wasm and run under wasmtime:
fern -target wasm -o hello.wasm hello.fernwasmtime hello.wasm