Quick Start
Quick Start
> xxc is a systems language that is both compilable and interpretable:
> Go-like ergonomics, no tracing GC (deterministic ARC + value types),
> three backends byte-identical to each other, and an entire toolchain
> written in xxc itself. Related pages:
> Language Guide ·
> Standard Library Reference ·
Install
# Linux x64 / arm64
curl -fsSL https://magicdo.top/install/xxc.sh | bash
# Windows (PowerShell)
irm https://magicdo.top/install/xxc.ps1 | iex
Or grab the executable for your platform from the
download page. xxc is a single-file distribution with
zero runtime dependencies (the Linux builds are static ELF — no libc), drop
it on your PATH and go.
Three backends
xxc run hello.xxc # tree-walking interpreter — instant start, the oracle
xxc vm hello.xxc # bytecode VM — ~2.8x faster
xxc build hello.xxc # native compiler → ./hello runs directly
All three share one frontend; the differential gate matrix (Windows 58×2 /
aarch64 60×2 / Linux 61 / qemu 59) keeps their outputs byte-identical.
Your first program
fn main() {
print("Hello, xxc")
}
Save as hello.xxc, run on any backend:
$ xxc run hello.xxc
Hello, xxc
$ xxc build hello.xxc && ./hello
Hello, xxc
The language at a glance
struct Point { x: int; y: int } // value type: assignment copies
class Box { value: int } // reference type: deterministic ARC
fn inv(x: int) -> int ! { // ! marks a fallible function
if x == 0 { return error("zero") }
return 100 / x
}
fn main() {
a := Point{x: 1, y: 2}
b := a // independent copy; b.x never touches a.x
c := Box{value: 10}
d := c // shared instance, refcount +1
d.value = 77 // c.value is now 77
n := inv(5)? // ? propagates errors
m := inv(0) or { -1 } // or recovers in place
print(a.x, c.value, n, m) // 1 77 20 -1
}
Closures, enums + match, generics, interfaces, maps/tuples, string
interpolation — see the
Concurrency
fn worker(ch: int) {
ch <- 42
}
fn main() {
ch := chan(0) // rendezvous channel; chan(n) is buffered
spawn worker(ch)
got := <-ch
print("got", got) // got 42
}
The official binaries ship the worker-pool runtime built in:
XXC_CONC_WORKERS=4 ./hello runs on 4 workers, and printing is
line-atomic — concurrent tasks can never tear an output line. See the
What it builds, and cross-compilation
| Host | xxc build output |
|---|---|
| Windows x64 | PE executable |
| Linux x64 | static ELF (no libc, runs on any distro) |
| Linux aarch64 | native AArch64 ELF |
# Cross-compile a Linux ELF from Windows
XXC_TARGET=linux xxc build hello.xxc
Build products are self-contained single files — the same distribution
model as the compiler itself: the xxc you hold is everything.
Common environment variables
| Variable | Effect |
|---|---|
| XXC_ALLOC_LIMIT | allocation runaway guard (strict base-10 bytes, default 2GiB) |
| XXC_ARC_FREE | 1 = exercise the real free-at-zero release path |
| XXC_CONC_WORKERS | concurrency worker count |
| XXC_TARGET | linux = cross-compile a Linux ELF |
Next steps
- Language Guide — full syntax and semantics
- Standard Library Reference — every module and operator
- Concurrency Guide — spawn/channel/select
- Implementation & Bootstrap — the three backends and the self-hosted toolchain