Self-Hosted Systems Language

High-level type & effect theory.
Zero-overhead machine code.

Tess is a statically typed, self-hosted systems language with staged dependent types, capability-based memory regions, orphan-free interfaces, and cost-stratified algebraic effects—compiling directly to native x86_64/aarch64, WebAssembly, and SPIR-V 1.6 with no GC and no borrow checker.

Native: QBE 1.3 & C11 Web: Wasm32 + Multi-Memory + WasmFX GPU: SPIR-V 1.6
effects_and_regions.tess
State = /ctrl/State

sumSlice = fun $R: Region, xs: ptr R slice I32 -> I32
    with [/mem/Read R, State I32].
        i = local USize 0
        while i < xs.len.
            (State I32).put ((State I32).get () + xs[i])
            i <- i + 1
        (State I32).get ()

public main = fun () -> () with /ctrl/BuiltinEffects.
    :'Buf do
        scores: array 3 I32 = local [10, 20, 12]
        acc = local I32 0
        defer /io/stdout.println "done"

        total = do sumSlice scores[0 ..< 3] where
            (State I32).get () => acc
            (State I32).put v => acc <- v

        /io/stdout.println (/str/concat "total = " (/str/toString total))

Designed Around Clear Invariants

Expressive compile-time abstractions that erase cleanly down to predictable runtime representations.

Staged Dependent Types

Types, regions, effect rows, and tables are first-class compile-time values solved via Normalization by Evaluation and erased before codegen.

Capability Regions & DSTs

No aliasing exclusivity: multiple pointers and slices can alias freely inside static regions governed by /mem/Read, /mem/Write, and scoped :'Foo blocks.

Cost-Stratified Effects

Capability effects erase completely, unwinds lower to native setjmp/longjmp or Wasm EH, tail-resumptive handlers pass evidence directly, and yield/resume uses WasmFX or native fibers.

Interfaces & First-Class Patterns

Orphan-free lexical instance resolution via use, where, and newtype ... with, paired with composable first-class patt extractors.

Multi-Target Codegen

Shared Runtime MIR optimizer lowers to native x86_64/aarch64 (QBE 1.3 or C11), freestanding multi-memory Wasm32, and SPIR-V 1.6 Vulkan/WebGPU shaders.

Self-Hosted Toolchain & LSP

Zero-dependency compiler, pure-Tess build system (build.tess), formatter (tess fmt), Wasmtime REPL, and built-in LSP 3.17 server (tess-lsp).

Code Showcase

Every snippet below is valid Tess—open any tab directly in the browser Playground to run and inspect IR.

generators.tess
Yield = /ctrl/Yield

public cleanup_log: I32 = shared 0

stream = fun () -> I32 with [Yield I32, /mem/ReadWrite 'Static].
    defer cleanup_log <- cleanup_log + 1
    if (yield (Yield I32).emit 10).
        yield (Yield I32).emit 32
        0
    else
        1

public main = fun () -> I32 with /ctrl/BuiltinEffects.
    cleanup_log <- 0
    total = do stream () where
        (Yield I32).emit v resume => if v < 30. v + resume true else v

    /io/stdout.println (/str/concat "total   = " (/str/toString total))
    /io/stdout.println (/str/concat "cleanups = " (/str/toString cleanup_log))
    total + cleanup_log

Quick Start

Bootstrap the self-hosted compiler from its portable C11 Stage 0 seed with just cc, ar, and xz.

Cold Stage 0 Bootstrap
mkdir -p tess-out/bin
xz -dc ../tess-stage0/tess0.c.xz | ${CC:-cc} -std=c11 -O1 -x c - -lm -o tess-out/bin/tess-stage0
./tess-out/bin/tess-stage0 build
./tess-out/bin/tess build
Compile & Run Everywhere
./tess-out/bin/tess run --target=native examples/basics/hello.tess
./tess-out/bin/tess build --target=wasm32 --emit-abi examples/basics/interface.tess
./tess-out/bin/tess build --target=spirv32 --validate examples/shaders/sdf_raymarch.tess
./tess-out/bin/tess test --target=native --manifest package.tess