x-lang Reference
Generated from source by make doc-x.
Bootstrap
Core
- x/core/alist — Association-list bootstrap: get/has?/del/put/keys and let-opts.
- x/core/arithmetic — Variadic +, -, *, /, % folded over the binary C primitives.
- x/core/boolean — Short-circuit logical AND and OR operatives.
- x/core/control — Conditional: evaluate test, then branch.
- x/core/doors — The engine’s hot doors – (int +), (str byte-ref), (obj ref), (ptr set!), (type of) and the rest a hot path in the library calls – each bound once under a name spelled from its coordinate, for every module to import instead of fetching its own.
- x/core/first-rest — first and rest guarded against nil, as compiled prims the boot sets the globals to.
- x/core/fn — Higher-order function combinators and callable reflection, homed on the Fn class.
- x/core/list — Boot-layer list plumbing; public list processing lives on the List class.
- x/core/logic — Boolean logic, structural equality, and derived comparisons.
- x/core/math — Integer arithmetic utilities and number predicates, homed on the Num class.
- x/core/op-guard — Non-numeric types (string, list, pair, vector) refuse the arithmetic operators with err:type instead of falling through to pointer arithmetic; symbols cannot (their type slot is the interning tree, not a registered type) and remain the documented residual; booleans refuse via type/bool.x.
- x/core/predicates — Test if a value is nil (the empty list).
- x/core/quasi — Quasiquote: template with unquote and splicing.
- x/core/syntax — Derived syntax forms: cond, case, when, unless, letrec.
Types
- x/type/array — Array: the growable container – amortized O(1) push!, O(1) indexed access, over a vector backing store.
- x/type/assoc — Association list operations, homed on the Assoc class.
- x/type/base — Base: execution-context / sandbox objects, via the Base class.
- x/type/block — Block-form methods: write a callback’s names and body at the call site.
- x/type/bool — BOOL: the boolean singletons as a real x-defined type – (Type of #t) answers, and arithmetic on booleans refuses through the op registry instead of falling through to machine math.
- x/type/buf — Tokenizer buffers (Buf) and the token stream (Tok): the low-level reader surface for custom types.
- x/type/char-io — UTF-8-aware write/display handlers for CHARACTER values, so a code point renders as its glyph.
- x/type/char — Character operations as the Char class.
- x/type/class — Object-oriented class system: classes-as-values, message passing, single inheritance.
- x/type/convert — Generic type conversion: the Convert class over the type system’s from/to alists.
- x/type/counter — A counting map, homed on the Counter class.
- x/type/deque — A double-ended queue, homed on the Deque class.
- x/type/dict — Dict: a mutable content-hashed table – the O(1) associative container.
- x/type/env — Env: environments as values – one pair (bindings . parent) – read by name.
- x/type/err-io — Write/display handlers for ERR, the engine’s raised-error value – the default wording of an engine error, and the stack a lang pushes its own over.
- x/type/err — Structured errors: the Err class, label taxonomy, errno translation.
- x/type/gen — Lazy generators: produce-on-demand sequences with the usual functional toolbox.
- x/type/generic — Generic functions over the class and type systems.
- x/type/hash — FNV-1a string hashing, homed on the Hash class.
- x/type/io — Input/output on the Io class: write/display (also bare), read/read-char, the to-string captures, and the REPL hooks.
- x/type/iter — Iterator protocol as the Iter class: build/new/make, drive next/empty?, consume ->list/for-each/fold.
- x/type/list — The list/sequence API, homed on the List class.
- x/type/module — Module: the module registry as data – names, loaded state, exports, owners and environments.
- x/type/obj — Raw object layer: construction, slot and metadata access, FFI handles, on the Obj class.
- x/type/path — Pure-string pathname manipulation on the Path class.
- x/type/pq — A binary-heap priority queue, homed on the Pq class.
- x/type/promise — Lazy evaluation: the delay form plus the Promise class.
- x/type/ptr — Raw pointers (Ptr) and the foreign-function interface (Ffi): the FFI surface for C interop.
- x/type/record — Lightweight named-field records over the class system.
- x/type/regex — Regular expressions with literal syntax; operations homed on the Regex class.
- x/type/set — Set: mutable membership with O(1) expected add/has?/del, plus the set algebra, on a Dict.
- x/type/str-utf8 — The low-level UTF-8 code-point layer for the STRING type: the list<->str transforms and the bare (s i) code-point indexing handler.
- x/type/str — String library: the Str8 / StrUtf8 protocol classes and byte equality.
- x/type/struct
- x/type/trait — Trait definition and predicate; the mixing happens in def-class.
- x/type/type — Type-system reflection: construction, lookup, struct navigation, and handler-stack wiring on the Type class.
- x/type/vector — Fixed-size indexed vectors; operations homed on the Vector class.
System
- x/sys/callback — C function pointers that call x functions: a stub per callback, for a C library that takes a function pointer.
- x/sys/cont — Continuations whose captured frames’ roots the collector marks while they wait.
- x/sys/date — Civil dates over unix time on the Date class: from-unix / to-unix / now / ->iso / leap-year?.
- x/sys/file — File I/O via POSIX syscalls, homed on the File class.
- x/sys/gc — Garbage collection control: collect/count/limit! and the mark/free/root hooks, on the Heap class.
- x/sys/host — Host: boot time, load, memory, CPU time, counters, disks, interfaces, interrupts, processes and users, the same records on Linux and Darwin.
- x/sys/linux — A window on the Linux console that answers Sdl’s messages: the picture on the framebuffer, keys from the kernel’s input devices, sound through ALSA’s playback device, all by syscalls.
- x/sys/opts — Command-line parsing against a declaration of flags and valued options, on the Opts class.
- x/sys/pact — Deferred cross-module registration: run a pairwise setup once every party has loaded, in any load order.
- x/sys/posix — POSIX system call wrappers, homed on the Sys class.
- x/sys/proc — Proc: run argv as a child process – wait for status, or capture stdout.
- x/sys/pty — Pty: pseudo-terminals, and a program run on one.
- x/sys/sdl — A window that shows an RGBA pixel buffer, with keyboard and window events and streams of sound, through the host’s SDL3 over the dlopen FFI.
- x/sys/socket — Blocking IPv4 TCP on the Socket class, over libc FFI.
- x/sys/stream — Output redirection as first-class Streams: to-fd/to-file/stdout/stderr, (s with thunk)/write/display/close, plus the with-fd / with-file helpers.
- x/sys/syslog — syslog(3)’s line and its send, over Socket’s unix datagram door.
- x/sys/web — A window in a browser tab: (Web open title w h scale) listens for a page, and Sdl’s other messages draw to it, play sound on it, and read its keys and gamepads.
Numeric Tower
- x/num/bigint — Arbitrary-precision integers, homed on the Bigint class.
- x/num/complex — Complex number arithmetic with rectangular and polar forms.
- x/num/decimal — Arbitrary-precision decimal floating-point, homed on the Decimal class.
- x/num/fixed-literal — The reader literal for fixed-point values, DIGITS[.DIGITS]qK: once this module is loaded, 0.75q16 reads as the integer 49152, the number times 2^16, rounded to the nearest and held to 32 bits signed. A form is read whole before it runs, so the import stands in a form before the first literal.
- x/num/fixed — Fixed-point arithmetic on plain integers: a value is a number times 2^k, k stated at each call, and products and quotients are exact through 64 bits on any word. x/num/fixed-literal adds a reader literal for the values, 0.75q16.
- x/num/float — IEEE 754 floating-point arithmetic, homed on the Float class.
- x/num/random — Pseudo- and hardware random number generation.
- x/num/rational — Exact rational number arithmetic, homed on the Rational class.
- x/num/tower — The numeric tower’s mixed-type arithmetic, homed on seven generics.
- x/num/u32 — 32-bit unsigned values on any word: u32 reads a word’s low 32 bits as the value, u32-bits takes the value back to the word’s bits, and u32-srl shifts those bits right logically.
Documentation
- x/doc/doc-gen — Documentation generator from x-lang source tokens; output format rides an emitter (x/doc/emit).
- x/doc/doc-prims — Retroactive documentation for C primitives, boot forms, and type system functions.
- x/doc/doc — Inline documentation system.
- x/doc/emit-man — roff (man page) emitter for the documentation generator.
- x/doc/emit — The documentation output protocol (DocEmit) and its Markdown implementation (DocMd).
- x/doc/registry — Doc: the documentation registry as data – one record per documented name.
- x/tool/asm-cache — The cache behind the compile-asm door: persistent emitted native code, over
- x/tool/asm-code — Native code buffers: map, relocate, protect and free – what a function’s bytes need, without the encoder.
- x/tool/asm-compile — JIT compiler: x-lang to native code via assembler.
- x/asm — Data-driven assembler with JIT execution via mmap; the buffers it emits into are x/tool/asm-code’s.
- x/tool/compile — Native code compiler: JIT assembler (default) with C compiler fallback.
- x/tool/compiled — Functions that have a compiled version: switched to interpreted before a state image is written and compiled again after one is loaded, with a list of which are compiled.
- x/tool/contract — Shared scaffold for the in-language gate ratchets, on the Contract class: the sorted recursive walk, sorted-list set ops (sort/uniq/only), the tool’s own argv behind the engine prefix, and the allocation guard.
- x/tool/cov — Library coverage analysis for x-bin-profile instrumented code.
- x/tool/fmt — Comment-preserving s-expression formatter on the Fmt class.
- x/tool/fn-compile — A program’s closures compiled where they stand, through compile-asm’s function world.
- x/tool/highlight — x-lang source and REPL transcripts as HTML, in Rouge token classes.
- x/tool/int-form-jit — Integer loops compiled by the JIT (ARM64 and x86-64 backends) from their int forms, adopted only after a library’s check finds they agree with the pure-x loops: what (Canvas jit!) and (Mixer jit!) build.
- x/tool/int-form — An integer (fn …) form, the kind compile-asm compiles, as the pure-x function it means: the twin a compiled loop is checked against.
- x/tool/jit-group — A compiled engine’s functions as one cache group: (jit-group KEY GEN USE) compiles GEN’s expressions and records a plan the next process pours them by, with nothing generated, printed or proven again; USE gets the functions and whether they were replayed.
- x/tool/link — Sections, symbols and relocations: lay objects out as one program, resolve and patch every name, and read and write object files.
- x/tool/lint — AST linter via the type-system write stacks: name-based def/use analysis + first/rest + tail-def-leak + pedantic (arity / non-callable / duplicate-def) checks.
- x/tool/obj-compiled — Compiles (obj ref), (obj set!), null?, and and or, and installs each into its own object, so every holder of any of them calls the compiled version.
- x/tool/pin — Pinning: freeze the modules a project imports, or the platform itself, inside the project.
- x/tool/profile — Performance profiling and smart garbage collection.
- x/tool/syntax — Syntax: lexical grammars and the renderers that draw their spans.
- x/platform/dirent — The shared getdents batch decoder.
- x/platform/socket — Socket constant lookup tables for Linux socketcall, protocol families, and socket types.
- x/platform/syscall — The platform layer: which OS and architecture this is, and the syscall numbers, stand-in calls, open flags and stat layout that follow from it.
Top-level
- x/rn — x/rn: Experimental hacking dialect built on x-lang.
- x/boot/engine — Boot: the engine seam – the one place the library names its engine, carrying both contract includes and the engine root.
- x/xe — x/xe: Stable full-stack dialect built on x-lang.