XIOM Language Documentation¶
Contents¶
| Section | Description |
|---|---|
| Getting Started | Installation, first program, CLI reference |
| Language Reference | Complete language reference -- all syntax, types, patterns in one document |
| Concepts | XIOM for programmers from other languages -- Java, C++, Python, Rust, Go |
| By Example | Progressive examples from Hello World to generics + contracts |
| Syntax | Full language syntax: variables, functions, control flow, expressions |
| Type System | Primitive types, compound types, structs, enums, type inference |
| Memory Model | Ownership, lexical scope borrowing, move semantics, unsafe |
| Unsafe | Confined unsafe blocks, guard heap, fault trapping, retry, FFI wrappers |
| Contracts | requires/ensures/invariant, contract collections, verification modes |
| Error Handling | Result, Option, ? operator, match exhaustion |
| Modules | module/use/pub, visibility, packages, method declarations |
| Generics | Comptime monomorphisation, inline type constraints, interface bounds |
| Pattern Matching | match, while let, destructuring, is tests |
| Derive | Compiler-generated Eq, Clone, Display, Hash, Ord |
| C FFI | Zero-cost C interoperability, extern blocks, unsafe |
| Compiler | Pipeline overview, CLI flags, build targets, WASM |
| Debugging | Source-level debugging with xiom-dbg: DAP clients, breakpoints, contract traps |
| Standard Library | Complete API reference for all 44 stdlib modules |
| Contributing | Contribution path, licensing and DCO sign-off, where things live |
| AI Coding Reference | Single-file AI prompt -- inject into any LLM to enable XIOM code generation |
Language Overview¶
XIOM is a compiled, statically typed, memory-safe systems programming language.
.xi source -> Lexer -> Parser -> Type Checker -> Borrow Checker
-> LLVM IR (+ Contracts + Derive + Generics)
-> clang -> native .exe / .wasm
Three Pillars¶
| SAFE | Ownership-based memory safety. No garbage collector. No null. Memory freed deterministically when the owner leaves scope. | | VERIFIED | Contracts (requires, ensures, invariant) are first-class language constructs enforced by the compiler. | | PRECISE | The grammar is unambiguous. One canonical form for every construct. No implicit coercions, hidden allocations, or surprising control flow. |
Quick Example¶
fn fib(n: Int) -> Int
requires: n >= 0
{
if n <= 1 { return n; }
return fib(n - 1) + fib(n - 2);
}
fn main() -> Int {
return fib(10); // -> 55
}
// Types with invariants and derive
type Health = {
current: Int;
maximum: Int;
invariant: current >= 0;
invariant: current <= maximum;
} derive[Clone, Display]
// Functions with contracts
fn divide(a: Float64, b: Float64) -> Float64
requires: b != 0.0
ensures: result * b == a
{
return a / b;
}
Getting Started¶
Ready to build with XIOM?
| Step | Resource |
|---|---|
| Install the compiler | Installation Guide |
| Write your first program | Getting Started Tutorial |
| Learn the language | Syntax, Type System, Memory Model |
| Browse the standard library | Stdlib Reference |
| Find or publish packages | Ecosystem & Packages |
Ecosystem¶
XIOM's ecosystem is organized across three tiers: first-party, first-party FFI bindings, and community.
| Resource | Description |
|---|---|
| Ecosystem & Packages | Planned packages, organization layout, and how to publish |
xiom:net |
First-party FFI HTTP client (libcurl) |
xiom:sql |
First-party FFI SQLite bindings |
xiom:serialize |
First-party JSON / binary serialization |
xiom:crypto |
First-party FFI OpenSSL bindings |
For the planned package ecosystem, see Ecosystem & Packages.
Evolution¶
XIOM's phases and release milestones are tracked on the website, not repeated here, so this guide always describes the language as it is today:
- History -- how the compiler and language evolved.
- Versions -- every published release, read from the download mirror.
- Roadmap -- current status and what is next.
The current release is always the tag published on the mirror. Self-hosting gates are cleared, but no self-hosted release has shipped yet.