Z Zust
Zust BigFloat Mandelbrot GPU rendering

The dynamic language for AI-native software

The Language for the AI Era

Zust is a dynamic runtime language for agents, toolchains, and host systems: structured like Rust, hot-swappable like a script, and able to move toward Cranelift JIT, native host functions, and GPU backends.

AI-generation friendly Dynamic boundary Native JIT GPU-ready
Part 1

Zust Language

Rust-shaped, script-friendly. Dynamic absorbs AI output and host boundaries, then moves toward JIT, ROOT state, and GPU kernels when needed.

  • Clear structure with direct mutation and hot updates
  • Dynamic boundary for tools, JSON, and runtime objects
  • Scripts can become native functions and compute kernels
Part 2

Harness Principles

Keep agent-written code simple, short, and straight. Use the complete guide or take only the parts your project needs.

  • Simple / Short / Straight keeps programmers focused
  • Servers stay authoritative; clients send intent
  • Required data fails explicitly instead of hiding behind fallback

Why AI needs a new scripting layer

Models can write code. Systems need a runtime that can absorb it.

As agents generate workflows, data transforms, tool calls, and compute kernels in real time, the old write-compile-deploy loop becomes too rigid. Zust turns AI-generated intent into scripts that can be reviewed, hot-swapped, evolved, and compiled into native functions when performance matters.

01

Easier for AI to get right

Rust-shaped blocks, functions, structs, and `impl` give code a skeleton. Removing borrow checking and explicit `mut` makes generation and human editing more direct.

02

Built for tool orchestration

`Dynamic` covers maps, lists, bytes, typed vectors, JSON, and MessagePack. Agent context, tool results, and external API payloads can enter the runtime naturally.

03

More than glue code

`zust-vm` compiles modules with Cranelift and hands function pointers to host Rust. Start dynamic, then accelerate the paths that become important.

04

Toward GPU and computation

The same language surface is used for CPU JIT, SPIR-V, Metal, and Vulkan experiments. AI can generate not only business logic, but inspectable computation.

AI-native runtime layer

Future software will not be only “source code written by humans.” It will generate, evaluate, replace, and execute itself.

Zust aims to be the controllable language layer in the middle: more expressive than JSON workflows, more hot-swappable than a full systems language, and more durable than one-off prompts.

Open source on GitHub

Zust is an open repository, not a closed-door pitch deck.

The parser, compiler, VM, Dynamic model, GPU backends, LSP, and example scripts live in one workspace. Clone it, run it, inspect the implementation, or embed it in your own Rust system.

github.com zhuchuanjing/zust Read the source, examples, and development progress

Language overview

Start dynamic. Add structure when it matters.

`.zs` files support functions, generics, structs, `impl`, closures, imports, pattern bindings, expression-oriented control flow, loops, and compound assignment. The goal is compact scripts that still have a maintainable shape.

struct Point {
    x: f64,
    y: f64,
}

impl Point {
    pub fn len2(self: Point) {
        self.x * self.x + self.y * self.y
    }
}

pub fn demo() {
    let p = Point{x: 3.0, y: 4.0};
    p.len2()
}

Runtime and backends

One language, multiple execution paths

The workspace includes parser, compiler, VM, root, llm, SPIR-V, Metal, Vulkan, LSP, and editor integrations. Zust can be a scripting layer inside Rust apps or a high-level description for compute kernels.

pub struct BigFloat<N> {
    sign: bool,
    exp: i32,
    data: [u32; N],
}

impl BigFloat<N> {
    pub fn zero() {
        BigFloat<N>{
            sign: false,
            exp: 0,
            data: [0u32; N],
        }
    }

    pub fn add(self: BigFloat<N>, rhs: BigFloat<N>) {
        // same script shape, CPU JIT or GPU backend
        bigfloat_add(self, rhs)
    }
}

Memory Management

No GC, deterministic behavior

Zust keeps runtime allocations local to a thread VM. When a function call ends, useful values are moved out explicitly and temporary values are released at the call boundary. The model is simple, but it prevents most leaks caused by accumulated temporary objects in long-running services.

Read details No GC pauses Call-local temporaries Long-running services
thread VM local store
  -> call function
  -> create temporary Dynamic values
  -> return or move out useful values
  -> release call-local temporaries

Benchmarks

Zust vs Lua vs Python

`benchmark.md` summarizes 32 microbenchmarks from the `benches` directory, covering recursion, loops, numeric kernels, strings, list/map operations, structs, closures, sorting, and Mandelbrot. Across 28 valid comparisons, Lua took 7.7x Zust time, and Python took 28.7x.

View all code and results
Zust 1.0x

VM/JIT execution

Lua 7.7x

geometric mean time

Python 28.7x

geometric mean time

parser / compiler

Hand-written lexical analysis, recursive descent parsing, AST-to-IR compilation, symbol tables, and type inference.

vm / dynamic / root

Cranelift JIT, dynamic value model, addressable object tree, and storage abstraction.

vm-spirv / vm-metal / vulkan

GPU backends for SPIR-V generation, Metal source generation, and Vulkan dispatch.

llm / zust-lsp

Generic model-call helpers, `.zs` language server, and Zed editor extension.

memory / call-local store

Thread VM local storage, call-boundary cleanup, and deterministic memory behavior for long-running services.

Quick start

Embed Zust in a Rust project

The minimal flow imports source code, requests a compiled function pointer, and calls it as a native function. See `vm/examples/minimal_vm.rs` in the repository.

cargo check --workspace
cargo run -p vm --example minimal_vm
cargo run -p zusts
Source GitHub Repository Language Syntax and Dynamic Backends JIT / GPU / LSP