xulang-org/xu

Xu programming language: native self-hosting compiler, toolchain and runtime

Python

1

35 commits

updated Oct 17, 2026

See the code

See what people are saying

SourceMessageScoreDate

Show HN: Xu – A GC-free systems language

2

Oct 15, 2026

README

Xu Logo

The Xu Programming Language

Go-like Concurrency Meets C/Rust Zero-GC Performance
A compile-time memory-safe systems language engineered for high-throughput, low-latency, and modern applications.

English | 简体中文

Release License Docs Benchmarks SDK CI

🌐 Online Playground (No Install)  •  ⚡ 47-Task Benchmark Dashboard  •  🚀 30s Quick Start  •  📦 Download Installers


⚡ Xu at a Glance (Show, Don't Tell)

No complex boilerplate. No convoluted lifetime annotation gymnastics. Experience Xu's clean modern syntax in 15 lines of code:

@main
#errors

// Symbolic flow control: `<<` returns, `>>` throws; no nested Result/unwrap boilerplate
fn fetch_metric(task string) int {
    if task.len == 0 { >> errors.new("empty task name") }
    << task.len * 42
}

fn worker(task string, ch chan int) {
    val := fetch_metric(task) or (err) { << } // Mandatory safe local handling without `if err != nil`
    ch <- val                                 // Type-safe channel messaging
}

fn main() int {
    ch := chan int{cap: 2}
    xu worker("latency", ch) // Native `xu` keyword spawns lightweight coroutine
    xu worker("memory", ch)
    println(<-ch + <-ch)     // Fan-in channel aggregation
    << 0                     // Deterministic teardown, zero GC pauses, static AOT native build
}

Why Developers Love It:

  1. Symbolic Flow Control: << returns, >> throws, <<< exits. Goodbye verbose legacy keywords.
  2. Ergonomic Error Flow: Handled at the call site with or (err) { ... }. Eliminates screen-cluttering if err != nil and catastrophic runtime unwrap() panics.
  3. Native Lightweight Concurrency: xu worker() coroutines + chan channels provide effortless Go-like concurrency.
  4. Compile-time Static Safety: Tracked via ownership & borrow inference. Zero garbage collection (Zero-GC), zero pauses, and ultra-lean deterministic memory consumption.

🎯 Pain Points & "Why Xu?"

As software engineers building high-performance systems and services, we are constantly forced to choose between flawed trade-offs:

1. The Dilemmas We Solve

  • Pain Point 1: Garbage Collection Latency Spikes & Memory Bloat
    • Status Quo: Go and Java are productive, but GC pauses (STW) and unpredictable latency jitter are deal-breakers in low-latency gateways, trading engines, and embedded targets.
    • The Xu Fix: Zero GC Runtime. Pure AOT compilation. Ownership tracks memory at compile time and frees it deterministically on scope exit. Zero pauses, zero GC spikes.
  • Pain Point 2: The Battle with "Explicit Lifetime Annotation Hell"
    • Status Quo: C/C++ leaves you vulnerable to dangling pointers, memory corruption, and UAF bugs. Rust is safe, but explicit lifetime parameters ('a, 'b) and complex type gymnastics drastically slow down development speed.
    • The Xu Fix: Implicit Ownership Inference & Borrow Checking. No explicit lifetime annotations in application code. Natural value semantics for slices give you both safety and velocity.
  • Pain Point 3: Screen-Filling Boilerplate & Nested Error Wrappers
    • Status Quo: Go codebases are flooded with repetitive if err != nil. Rust wraps types inside multiple Result<T, E> / Option layers.
    • The Xu Fix: Symbolic >> combined with mandatory or (err) { ... }, providing lightweight, clean, and safe error propagation.
  • Pain Point 4: Fragmented Toolchains & Setup Friction
    • Status Quo: Stitching together CMake, Make, package managers, and platform linkers is notoriously fragile.
    • The Xu Fix: Single-Binary Closed Loop. Everything—compiler, test runner, formatter (xu fmt), documentation generator (xu doc), and self-rendered GUI setup wizards—is built right in.

2. Hardcore Technical Comparison

Key DimensionC / C++GoRustXu
Memory ManagementManual malloc/free
(Leaks & dangling pointers)
Runtime GC
(STW latency pauses & memory bloat)
Compile-time ownership
(Explicit lifetime 'a annotations)
Compile-time ownership
(Zero-GC / Deterministic drops)
Runtime OverheadZero-cost abstractionsHeavy (GC engine + scheduler runtime)Zero-cost abstractionsZero-cost (No GC engine / Pure native machine code)
Cognitive LoadVulnerable to UB & race conditionsSimple, but nil panics persistSteep learning curve (Borrow checker fights)Minimal (No lifetime annotations / Clean symbolic flow)
Concurrency ModelOS threads / External librariesCSP coroutines (go) + channels (chan)Threads / Async runtimes (Function coloring)Native lightweight coroutines (xu) + typed chan
Error HandlingError codes / Exceptions (Implicit)if err != nil (Cluttered boilerplate)Result<T, E> + ? operatorSymbolic flow: >> throw + or mandatory handling
Flow Controlreturn / break / continuereturn / break / continuereturn / Tail expressionsSymbolic flow: << return / >> throw / <- break
Toolchain CohesionFragmented (CMake/Make/Conan)Integrated out-of-the-boxIntegrated (Cargo)Single-binary loop (Built-in build/test/fmt/doc)
Cross-Platform SetupComplex toolchain & linker dependenciesOfficial installer / manual PATH configRequires rustup & external network scriptsStandalone GUI Setup wizards / One-click setup

🚀 Zero-Friction Quick Start

Option 1: Instant Browser Sandbox (Zero Install)

Jump directly into the xulang.org Online Playground. Powered by a client-side WebAssembly build of Xu, you can test and experiment with full language features instantly.

Xu provides standalone installers with embedded compilers and standard library sources that automatically register persistent system environment variables:

  • macOS / Linux (One command in terminal):

    # Detects architecture, downloads, and configures environment automatically
    curl -fsSL https://xulang.org/install.sh | bash
    

    Or download standalone binaries from Releases:

    chmod +x xu-setup-linux-x64 && ./xu-setup-linux-x64 -y
    
  • Windows (GUI Wizard or PowerShell):

    • GUI Wizard: Download xu-setup-windows-x64.exe from Releases and double-click to run the zero-dependency self-rendered wizard.
    • PowerShell One-Liner:
      irm https://xulang.org/install.ps1 | iex
      

Open a new terminal and type xu --version to run from anywhere.

Option 3: 30-Second Hello World

# 1. Create source file
cat << 'EOF' > main.xu
@main

fn main() int {
    println("Hello, World! Welcome to Xu.")
    << 0
}
EOF

# 2. Run immediately
xu run main.xu

# 3. Compile ahead-of-time to an optimized native binary
xu build main.xu -o myapp
./myapp

CLI Command Quick Reference

CommandDescription
xu run <file.xu>Rapid compilation and in-memory execution
xu build <file.xu> -o <bin>AOT compile to an optimized, standalone native binary
xu build --target wasm32 <file.xu>Cross-compile directly to WebAssembly
xu test <file.xu>Execute integrated unit tests and assertion suites
xu fmt <file.xu> -wAutomatically format code according to official guidelines
xu doc <dir> --publicExtract doc comments and generate clean API references
xu doctorDiagnostics tool checking native C linkers and SDK health

🗺️ Project Roadmap

Driven by continuous active iteration, Xu is rapidly evolving. Here is our current status and roadmap:

  • Static Native AOT Compilation: Direct emission of optimized machine code with fixed-point bootstrap verification (Gen2 == Gen3)
  • Compile-Time Ownership & Borrow Inference: Zero-GC runtime, deterministic deallocation, eliminating dangling pointers
  • Native Coroutines & Channels: xu keyword scheduling paired with typed chan communication
  • Symbolic Flow & Error Handling: << return, >> throw, and mandatory local or (err) { ... } guards
  • Universal Architecture Support: Windows / macOS / Linux / LoongArch64 / RISC-V 64 / WebAssembly
  • Standalone Native Setup Wizards: Zero-dependency self-rendered GUI wizards for Windows / macOS PKG / Linux installers
  • Production Infrastructure Packages: Native drivers for MySQL, Postgres, Redis, ClickHouse, Kafka, SQLite, etc.
  • Language Server Protocol (LSP): Deep VS Code & Neovim integration with real-time diagnostics and autocompletion
  • Interactive Source Debugger: Native breakpoint debugging, stack unwinding, and variable inspection
  • Deep Monomorphization & Inlining Optimizations: Cross-module automatic inlining and enhanced escape analysis
  • Central Package Registry: Cryptographically verified package distribution and automated dependency resolution

🌟 Join the Community & Support Xu

Xu is an open-source, forward-looking systems programming language. If you believe in Zero-GC extreme performance combined with ergonomic modern syntax, we invite you to join us!

  • ⭐ Star the Repo: If Xu resonates with your engineering philosophy, give us a Star on GitHub—it fuels our development!
  • 💬 Feedback & Discussions: Have feature requests or suggestions? Open a discussion or ticket on GitHub Issues.
  • 📊 Benchmark Insights: Explore deep CPU and memory benchmarks across 47 tasks at xulang.org/benchmarks.
  • 📚 Comprehensive Documentation: Read guides, syntax specifications, and tutorials at xulang.org.

License

The Xu programming language is open source under the MIT License.

xulang-org/xu

Xu programming language: native self-hosting compiler, toolchain and runtime

Python

1

35 commits

updated Oct 17, 2026

See the code

See what people are saying

SourceMessageScoreDate

Show HN: Xu – A GC-free systems language

2

Oct 15, 2026

README

Xu Logo

The Xu Programming Language

Go-like Concurrency Meets C/Rust Zero-GC Performance
A compile-time memory-safe systems language engineered for high-throughput, low-latency, and modern applications.

English | 简体中文

Release License Docs Benchmarks SDK CI

🌐 Online Playground (No Install)  •  ⚡ 47-Task Benchmark Dashboard  •  🚀 30s Quick Start  •  📦 Download Installers


⚡ Xu at a Glance (Show, Don't Tell)

No complex boilerplate. No convoluted lifetime annotation gymnastics. Experience Xu's clean modern syntax in 15 lines of code:

@main
#errors

// Symbolic flow control: `<<` returns, `>>` throws; no nested Result/unwrap boilerplate
fn fetch_metric(task string) int {
    if task.len == 0 { >> errors.new("empty task name") }
    << task.len * 42
}

fn worker(task string, ch chan int) {
    val := fetch_metric(task) or (err) { << } // Mandatory safe local handling without `if err != nil`
    ch <- val                                 // Type-safe channel messaging
}

fn main() int {
    ch := chan int{cap: 2}
    xu worker("latency", ch) // Native `xu` keyword spawns lightweight coroutine
    xu worker("memory", ch)
    println(<-ch + <-ch)     // Fan-in channel aggregation
    << 0                     // Deterministic teardown, zero GC pauses, static AOT native build
}

Why Developers Love It:

  1. Symbolic Flow Control: << returns, >> throws, <<< exits. Goodbye verbose legacy keywords.
  2. Ergonomic Error Flow: Handled at the call site with or (err) { ... }. Eliminates screen-cluttering if err != nil and catastrophic runtime unwrap() panics.
  3. Native Lightweight Concurrency: xu worker() coroutines + chan channels provide effortless Go-like concurrency.
  4. Compile-time Static Safety: Tracked via ownership & borrow inference. Zero garbage collection (Zero-GC), zero pauses, and ultra-lean deterministic memory consumption.

🎯 Pain Points & "Why Xu?"

As software engineers building high-performance systems and services, we are constantly forced to choose between flawed trade-offs:

1. The Dilemmas We Solve

  • Pain Point 1: Garbage Collection Latency Spikes & Memory Bloat
    • Status Quo: Go and Java are productive, but GC pauses (STW) and unpredictable latency jitter are deal-breakers in low-latency gateways, trading engines, and embedded targets.
    • The Xu Fix: Zero GC Runtime. Pure AOT compilation. Ownership tracks memory at compile time and frees it deterministically on scope exit. Zero pauses, zero GC spikes.
  • Pain Point 2: The Battle with "Explicit Lifetime Annotation Hell"
    • Status Quo: C/C++ leaves you vulnerable to dangling pointers, memory corruption, and UAF bugs. Rust is safe, but explicit lifetime parameters ('a, 'b) and complex type gymnastics drastically slow down development speed.
    • The Xu Fix: Implicit Ownership Inference & Borrow Checking. No explicit lifetime annotations in application code. Natural value semantics for slices give you both safety and velocity.
  • Pain Point 3: Screen-Filling Boilerplate & Nested Error Wrappers
    • Status Quo: Go codebases are flooded with repetitive if err != nil. Rust wraps types inside multiple Result<T, E> / Option layers.
    • The Xu Fix: Symbolic >> combined with mandatory or (err) { ... }, providing lightweight, clean, and safe error propagation.
  • Pain Point 4: Fragmented Toolchains & Setup Friction
    • Status Quo: Stitching together CMake, Make, package managers, and platform linkers is notoriously fragile.
    • The Xu Fix: Single-Binary Closed Loop. Everything—compiler, test runner, formatter (xu fmt), documentation generator (xu doc), and self-rendered GUI setup wizards—is built right in.

2. Hardcore Technical Comparison

Key DimensionC / C++GoRustXu
Memory ManagementManual malloc/free
(Leaks & dangling pointers)
Runtime GC
(STW latency pauses & memory bloat)
Compile-time ownership
(Explicit lifetime 'a annotations)
Compile-time ownership
(Zero-GC / Deterministic drops)
Runtime OverheadZero-cost abstractionsHeavy (GC engine + scheduler runtime)Zero-cost abstractionsZero-cost (No GC engine / Pure native machine code)
Cognitive LoadVulnerable to UB & race conditionsSimple, but nil panics persistSteep learning curve (Borrow checker fights)Minimal (No lifetime annotations / Clean symbolic flow)
Concurrency ModelOS threads / External librariesCSP coroutines (go) + channels (chan)Threads / Async runtimes (Function coloring)Native lightweight coroutines (xu) + typed chan
Error HandlingError codes / Exceptions (Implicit)if err != nil (Cluttered boilerplate)Result<T, E> + ? operatorSymbolic flow: >> throw + or mandatory handling
Flow Controlreturn / break / continuereturn / break / continuereturn / Tail expressionsSymbolic flow: << return / >> throw / <- break
Toolchain CohesionFragmented (CMake/Make/Conan)Integrated out-of-the-boxIntegrated (Cargo)Single-binary loop (Built-in build/test/fmt/doc)
Cross-Platform SetupComplex toolchain & linker dependenciesOfficial installer / manual PATH configRequires rustup & external network scriptsStandalone GUI Setup wizards / One-click setup

🚀 Zero-Friction Quick Start

Option 1: Instant Browser Sandbox (Zero Install)

Jump directly into the xulang.org Online Playground. Powered by a client-side WebAssembly build of Xu, you can test and experiment with full language features instantly.

Xu provides standalone installers with embedded compilers and standard library sources that automatically register persistent system environment variables:

  • macOS / Linux (One command in terminal):

    # Detects architecture, downloads, and configures environment automatically
    curl -fsSL https://xulang.org/install.sh | bash
    

    Or download standalone binaries from Releases:

    chmod +x xu-setup-linux-x64 && ./xu-setup-linux-x64 -y
    
  • Windows (GUI Wizard or PowerShell):

    • GUI Wizard: Download xu-setup-windows-x64.exe from Releases and double-click to run the zero-dependency self-rendered wizard.
    • PowerShell One-Liner:
      irm https://xulang.org/install.ps1 | iex
      

Open a new terminal and type xu --version to run from anywhere.

Option 3: 30-Second Hello World

# 1. Create source file
cat << 'EOF' > main.xu
@main

fn main() int {
    println("Hello, World! Welcome to Xu.")
    << 0
}
EOF

# 2. Run immediately
xu run main.xu

# 3. Compile ahead-of-time to an optimized native binary
xu build main.xu -o myapp
./myapp

CLI Command Quick Reference

CommandDescription
xu run <file.xu>Rapid compilation and in-memory execution
xu build <file.xu> -o <bin>AOT compile to an optimized, standalone native binary
xu build --target wasm32 <file.xu>Cross-compile directly to WebAssembly
xu test <file.xu>Execute integrated unit tests and assertion suites
xu fmt <file.xu> -wAutomatically format code according to official guidelines
xu doc <dir> --publicExtract doc comments and generate clean API references
xu doctorDiagnostics tool checking native C linkers and SDK health

🗺️ Project Roadmap

Driven by continuous active iteration, Xu is rapidly evolving. Here is our current status and roadmap:

  • Static Native AOT Compilation: Direct emission of optimized machine code with fixed-point bootstrap verification (Gen2 == Gen3)
  • Compile-Time Ownership & Borrow Inference: Zero-GC runtime, deterministic deallocation, eliminating dangling pointers
  • Native Coroutines & Channels: xu keyword scheduling paired with typed chan communication
  • Symbolic Flow & Error Handling: << return, >> throw, and mandatory local or (err) { ... } guards
  • Universal Architecture Support: Windows / macOS / Linux / LoongArch64 / RISC-V 64 / WebAssembly
  • Standalone Native Setup Wizards: Zero-dependency self-rendered GUI wizards for Windows / macOS PKG / Linux installers
  • Production Infrastructure Packages: Native drivers for MySQL, Postgres, Redis, ClickHouse, Kafka, SQLite, etc.
  • Language Server Protocol (LSP): Deep VS Code & Neovim integration with real-time diagnostics and autocompletion
  • Interactive Source Debugger: Native breakpoint debugging, stack unwinding, and variable inspection
  • Deep Monomorphization & Inlining Optimizations: Cross-module automatic inlining and enhanced escape analysis
  • Central Package Registry: Cryptographically verified package distribution and automated dependency resolution

🌟 Join the Community & Support Xu

Xu is an open-source, forward-looking systems programming language. If you believe in Zero-GC extreme performance combined with ergonomic modern syntax, we invite you to join us!

  • ⭐ Star the Repo: If Xu resonates with your engineering philosophy, give us a Star on GitHub—it fuels our development!
  • 💬 Feedback & Discussions: Have feature requests or suggestions? Open a discussion or ticket on GitHub Issues.
  • 📊 Benchmark Insights: Explore deep CPU and memory benchmarks across 47 tasks at xulang.org/benchmarks.
  • 📚 Comprehensive Documentation: Read guides, syntax specifications, and tutorials at xulang.org.

License

The Xu programming language is open source under the MIT License.