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/block.xchecked dynamic storage for fixed-width elements.
lib/buffer.xgrowable text buffer with indentation support.
lib/common.xthe Var encoding every runtime module shares.
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/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/lisp.xthe Lisp runtime: reader, session, and evaluator.
lib/list-selectors.xoptional compound List selectors.
lib/list/list.xlinked list with Var elements.
lib/logger.xowned structured event delivery.
lib/macrovalue/macrovalue.xmacros as values that build and recognize code.
lib/map.xhash table mapping Var keys to Var values.
lib/match-cache.xcaches of prepared Match plans.
lib/match-plan.xlowering Match patterns to prepared plans.
lib/match/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/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/rewrite.xPattern registration for compiler rewrites.
lib/scope/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-escape.xescaped spelling of canonical strings.
lib/string-format.xchecked formatting of Var values into a String.
lib/string-number.xnumeric parsing from canonical byte strings.
lib/string/string.xcanonical byte strings and core text operations.
lib/symbol.ximmediate encoded names.
lib/symbolset.ximmutable ordered sets of compact Symbols.
lib/system-macros.xconvenience macros for text, timing, and processes.
lib/thread.xContext-backed native worker threads.
lib/type.xsemantic type values and their structural operations.
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/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/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/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. Every unit reaches it through the prelude’s varops.x; include meta.x explicitly where meta functions are written.
  • 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/rewrite.x - Register macro-pattern translators with the $rewrite decorator; include rewrite.x.
  • 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/system-macros.x - Compile-time convenience macros; explicitly include system-macros.x to use them.
  • lib/type.x - Structural operations on captured Type values, available at runtime and compile time; include type.x to use them.
  • 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/array-generics.x - Shared declaration templates for typed array operations.
  • lib/cleanup.x - Cleanup adoption templates used by runtime owners.
  • lib/clibc.x - C library prototypes for integer and string conversions, and string comparison, marked meta so compile-time code calls the native functions; it includes the C headers it declares from.
  • lib/cmath.x - C99 <math.h> prototypes, declared so a Var argument unboxes at a math call; the unit still includes <math.h>.
  • lib/datum.x - Values spelled as Lisp reader text, for interface files and the project meta helper’s messages.
  • lib/error-macros.x - Structured Error causes shared by runtime modules.
  • lib/error-private.x - Error transfer templates used by the exception machinery.
  • lib/error_init.x - Type-owned initialization shim that preserves Error’s pre-initialization boundary.
  • lib/func-errors.x - Structured callable errors shared by runtime modules.
  • lib/integer-ops.x - Integer conversion and arithmetic templates shared by runtime owners.
  • lib/lisp-init.x - The standard Lisp algorithms etc/init.xlisp binds by name into every Lisp session.
  • lib/lisp-targets.x - The native operations a Lisp session can bind, built outside the implicit prelude so the optional modules that supply them stay out of it.
  • lib/machine.x - Match wordcode, builder, and execution-state definitions.
  • lib/map-generics.x - Shared declaration templates for typed map operations.
  • lib/match-machine.x - Private Match wordcode decoder.
  • lib/native-scalar-types.x - The exact C scalar ledger and its compile-time projections.
  • lib/private-keywords.x - Keyword aliases used by runtime implementation code.
  • 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.
  • lib/var-adapters.x - Pointer converter templates shared by runtime owners.
  • lib/var-ledger.x - The Var tag tables and decoder table projected from lib/var-tags.x, in the one runtime unit that includes the ledger.
  • lib/var-tags.x - The Var tag ledger shared by runtime and compiler projections.