The language
The xc language reference: types, operators, control flow, classes, inheritance and protocols, ARC and the heap, closures and bound methods, threading, modules and shared libraries, and inline assembly.
xc (repo: xc) is a
compiler and toolchain for the xc language, a typed, class-based take on C.
It provides auto type inference, classes with inheritance and protocols,
automatic reference counting (ARC) with weak references, a heap with new /
delete, closures and bound methods, multiple return values with tuple
unpacking, exceptions (throws / try / catch), threading primitives, and a
Foundation-style standard library. It stays close enough to C to keep a familiar
syntax and inline assembly.
The compiler is built around a shared SSA-style intermediate representation. The front end lowers source to IR once. A shared optimiser runs on that IR: CSE, strength reduction, inlining, loop unrolling and rotation, if-conversion, tail-recursion elimination, and auto-vectorisation on capable targets. A per-architecture back end turns the optimised IR into native code, so a new target needs only a new back end.
The driver ships as xcc and behaves like a C compiler: xcc -o prog file.xc builds a native binary for the host, and -A <arch> cross-compiles to
another target. The compiler is also self-hosting: a second implementation
written in the xc language is byte-identical through every stage.
The toolchain drives several back ends from one language and one IR:
-static links them over musl instead, so they run on any distribution. (Up to 0.71 the static link is the default and -dynamic asks for glibc.)-A m68k for the 68000, -A 68030 for
the 030). GEMDOS .prg executables, run with xcc-sim-68k..wasm output.The language
The xc language reference: types, operators, control flow, classes, inheritance and protocols, ARC and the heap, closures and bound methods, threading, modules and shared libraries, and inline assembly.
Standard library
The Foundation-style class library: Number / String / Data / Array, Stdio, Math, Time, the Heap, sorting, and the lower-level system and memory helpers.
Using the compiler
Installing the toolchain, the full xcc CLI flag reference, optimisation
levels, per-target memory models, the allocator and ARC, linker scripts,
and migrating between releases.
Downloads
Get the latest xcc release, browse the historical archive, and read the
changelog.