x-lang

x-lang Dialects

x-lang: computational expressions over a minimal, type-agnostic engine.

A dialect is a composition of x-lang library modules that determines what capabilities are loaded. The dialects are named after noble gases — the theme ties to the x-expr/Xe etymology, and read correctly it is self-teaching along the two axes that actually distinguish the entries:

Name Element Is
./x-bin, the engine binary: no libraries, substrate rather than a dialect
he helium light, fast boot, interactive; no tower — the default
xe xenon full numeric tower, POSIX, compiler; stable
rn radon xenon’s surface plus experimental/raw APIs; explicitly volatile

The rule that shapes the family: dialects may differ in what surface is loaded; they must never differ in what a shared spelling means. A + that means pointer arithmetic in one dialect, or a + that coerces "123" to a number, is not a dialect — it is a different language wearing the same clothes (that would be a lang, below). If radon ever grows ergonomic address math, it gets a distinct spelling (the Ptr class), not an overload.

The interpreter core has no knowledge of any dialect. Dialects are loaded by shell concatenation before user input. The shell wrapper (x.sh) selects a dialect with the -l flag:

sh x.sh                  # helium (default)
sh x.sh -l xe            # xenon
sh x.sh -l rn            # radon

Or directly:

cat lib/he.x - | ./x-bin     # helium
cat lib/xe.x - | ./x-bin     # xenon
cat lib/rn.x - | ./x-bin     # radon

In an installed tree (make install) the wrapper boots the same dialects from share/x/boot/ — one generated, amalgamated entry per dialect (the raw include chain flattened to a single stream) — and the library under share/x/lib/ is byte-identical to the repo’s. Repo checkouts always load the live entries above.

lib/x.x is a pointer, not a dialect: it is what a bare sh x.sh boots, and it currently points at helium. The default stays light on purpose — xenon’s boot runs eight runtime cc compilations (the compiled tokenizer analysers), which would make every newcomer run slow and host-toolchain-dependent. The pre-0.3.0 spellings x-and/x-or are retired (see the CHANGELOG); an unknown -l name fails with the wrapper’s inventory listing, which names the real entries.


helium (lib/he.x)

The light dialect. Loads lib/x-core.x, which bootstraps the module system and loads 40+ modules:

Helium provides everything needed for general-purpose programming: combinators, list processing, sorting, pattern matching, strings, vectors, lazy evaluation, and an interactive REPL. It has no numeric tower beyond built-in integers, no POSIX access, and no file I/O.


xenon (lib/xe.x)

Stable full-stack dialect. Includes all of helium’s surface, then adds:

Then loads the numeric tower with immediate analyser compilation (the shared block lib/x/boot/tower-compiled.x, included by every full-tower composition — x-base.x and the xenon/radon bodies):

  1. Bigint (x/num/bigint.x) — Arbitrary-precision integers. Analysers for bigint and int-capped types are compiled to native code immediately after loading.
  2. Regex (x/type/regex.x) — Regular expressions with #/pattern/ literal syntax. Uses a C-level analyser, no compilation needed.
  3. Float (x/num/float.x) — IEEE 754 floating-point. Analyser compiled after loading.
  4. Rational (x/num/rational.x) — Exact rationals. Analyser compiled after loading.
  5. Complex (x/num/complex.x) — Complex numbers with rectangular and polar forms. Analyser compiled after loading.
  6. Decimal (x/num/decimal.x) — Arbitrary-precision decimal floating-point, literal suffix d (1.5d). Analyser compiled after loading. Last on purpose: its conversions declare float, rational and complex, and its analyser only claims a digit run that ends in d, so it never contests a token the earlier readers want.

The analyser compilation pattern is the key design choice: each numeric type’s tokenizer analyser is compiled to native code right after the type loads, so subsequent source files (including later numeric types) are parsed through fast compiled analysers rather than interpreted ones.

Xenon does NOT include raw syscall access, file I/O, or socket constants.


radon (lib/rn.x)

Experimental/hacking dialect. Everything in xenon, plus:

Radon is the right choice for systems programming, kernel hacking, or any task that needs direct access to the operating system. It is chemically honest: heavy AND radioactive — full-featured and explicitly unstable. APIs here may change or vanish between releases.


Langs

Langs are loaded as additional libraries on top of a dialect, aliasing x-lang primitives and adding derived forms to emulate another language’s syntax. This is where same-spelling-different-meaning belongs: a lang may claim any spelling it likes, because it announces itself as a different language.

Lang Base Dialect Description
R5RS Scheme helium lambda, cons/car/cdr, define, cond, case
R7RS Scheme R5RS do, case-lambda, delay/force, values, define-record-type
Kernel helium $vau (operative-first), $define!, $lambda via wrap
ASH Shell helium POSIX shell syntax: pipes, redirections, if/while/for/case
Sweet Expressions helium SRFI-105/110: curly-infix + indentation-sensitive syntax

Langs are maintained as sibling projects and load by concatenation on top of a dialect:

cat lib/he.x path/to/r5rs.x - | ./x-bin

The interpreter core has no knowledge of any lang. All lang semantics are implemented in x-lang library code.