Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Module Reference

Reference pages list the functions and types in each runtime module. Start with the standard library overview to choose a type or find a function for a particular task.

The x2c C API collects the stable x2c_* entry points used by generated code, native callers, and compiler setup.

Modules

ModuleDescription
lib/args.xparse program arguments against a declarative spec.
lib/array.xdynamic contiguous arrays of Var elements.
lib/atom.xcanonical exact names.
lib/autodiff.xreverse-mode differentiation recorded on a runtime tape.
lib/block.xchecked dynamic storage for fixed-width elements.
lib/buffer.xgrowable text buffer with indentation support.
lib/common.xthe shared Var union and operations used by every module.
lib/context.xbounded runtime state and value export.
lib/diff.xline differences between two texts.
lib/digest.xSHA-256 digests of Strings and streams.
lib/dispatch.xtyped descriptors for runtime Var behavior.
lib/error.xhandler stack and accumulated errors.
lib/exception.xtransfer frames for x2c Error unwinding and cleanup.
lib/file.xFile I/O operations and stream handling.
lib/func.xgeneric native function binding.
lib/iter.xsingle-pass pull iterators.
lib/json.xJSON text to and from ordinary x2c values.
lib/lib.xdisjoint sets with union-find.
lib/lisp.xthe Lisp runtime: reader, session, and evaluator.
lib/list-selectors.xoptional compound List selectors.
lib/list.xlinked list with Var elements.
lib/logger.xowned structured event delivery.
lib/map.xhash table mapping Var keys to Var values.
lib/match-recursive.xoptional reference matcher.
lib/match.xpattern matching and transformation utilities for lists.
lib/meta.xthe compiler surface a meta function calls.
lib/mutex.xshared mutable-state coordination.
lib/path.xfilesystem locations and the operations on them.
lib/pool.xnested interning pools with region-backed object storage.
lib/process.xrun commands and pipelines without a shell.
lib/regex.xregular expressions over the bytes of a String.
lib/scope.xmemory allocation scope management.
lib/scripting.xthe modules every script unit includes.
lib/split.xString field splitting and repeatable typed cursors.
lib/string-classify.xbyte classification for canonical strings.
lib/string-number.xnumeric parsing from canonical byte strings.
lib/string.xcanonical byte strings and core text operations.
lib/symbol.ximmediate encoded names.
lib/symbolset.ximmutable ordered sets of compact Symbols.
lib/thread.xContext-backed native worker threads.
lib/typed-array.xpacked typed Arrays generated from shared methods.
lib/typed-list.xtyped cons chains generated from typed methods.
lib/typed-map.xtyped Maps generated from shared storage.
lib/var.xvariant type for dynamic typing.
lib/varconvert.xVar numeric conversion policy.
lib/varops.xboxed Var operators, updates, and truthiness.

Optional x2c modules

These modules ship with x2c but are not loaded by the standard prelude. Include one explicitly to use its declarations.

  • lib/args.x - Argument parsing against a declarative spec; explicitly include args.x to use it.
  • lib/autodiff.x - Runtime reverse-mode differentiation on a tape; explicitly include autodiff.x to use it.
  • lib/diff.x - Line differences between two texts; explicitly include diff.x to use them.
  • lib/digest.x - SHA-256 digests of Strings and streams; explicitly include digest.x to use them.
  • lib/json.x - JSON text to and from ordinary Map, Array, String, and number values; explicitly include json.x to use it.
  • lib/list-selectors.x - Compound selectors beyond caar, cadr, cddr, and caddr; explicitly include list-selectors.x to use them.
  • lib/match-recursive.x - Readable recursive Match reference; explicitly include match-recursive.x for differential testing.
  • lib/meta.x - Syntax builders and compiler operations for meta functions. Pure builders also run at runtime; operations that query the compiler remain compile-time only. Explicitly include meta.x where the functions are parsed.
  • lib/path.x - Filesystem operations on path Strings; explicitly include path.x to use them.
  • lib/process.x - Commands, pipelines, and background jobs without a shell; explicitly include process.x to use them.
  • lib/regex.x - Regular expressions over the bytes of a String; explicitly include regex.x to use them.
  • lib/scripting.x - The args.x, diff.x, digest.x, path.x, process.x, and regex.x modules that every script unit includes; include scripting.x to use all six.
  • lib/typed-array.x - Packed typed storage with a raw native bracket; explicitly include typed-array.x to use it.
  • lib/typed-list.x - Typed views over canonical List cells; explicitly include typed-list.x to use them.
  • lib/typed-map.x - Typed maps over native numeric or canonical String fields; explicitly include typed-map.x to use them.

Runtime-internal

These modules implement the runtime and are not public APIs.

  • lib/cmath.x - C99 <math.h> prototypes, declared so a Var argument unboxes at a math call; the unit still includes <math.h>.
  • lib/error_init.x - Type-owned initialization shim that preserves Error’s pre-initialization boundary.
  • lib/lisp-machine.x - Private compile-time Lisp wordcode decoder.
  • lib/machine.x - Shared Match and Lisp wordcode, builder, and execution-state definitions.
  • lib/match-machine.x - Private Match wordcode decoder.
  • lib/protocols.x - The built-in Cleanup, Block, Iter, and Var protocol declarations used to generate runtime dispatch adapters.
  • lib/scan.x - Allocation-free character scanners used by the tokenizer.
  • lib/static-init.x - Compiler-owned first-use static storage and initialization guards.
  • lib/thread-state.x - Native pthread-key storage for per-thread runtime state.
  • lib/tokenizer.x - Token stream used by the compiler and the Lisp reader.