# XS (xslang)

XS is a programming language whose pitch is a single 2.9 MB statically-linked binary that contains the compiler, language server, debugger, formatter, linter, test runner, profiler, and package manager — and runs unchanged on Linux, macOS, Windows, WASI, iOS, Android, ESP32, and Raspberry Pi. Same source, six backends, three transpile targets, zero runtime dependencies, 132 KLOC of C source (excluding BearSSL).

## What it claims

- Six execution backends from one source:
  - `xs --interp` — tree-walk interpreter for the REPL and AST-level plugin debugging.
  - `xs` (default) — bytecode VM, what normal runs go through.
  - `xs --jit` — register-allocating JIT for x86-64 and aarch64; opcodes outside its supported set fall back to the VM.
  - `xs --emit c` — C transpiler producing self-contained source for any reasonable C compiler.
  - `xs --emit js` — JavaScript transpiler for Node or browser; ships less than the WASM build if you only need one program.
  - `xs.wasm` — WASM build of the compiler itself, with a virtual filesystem so any XS program can be evaluated at runtime in the browser.

- Benchmarks (cold from disk, best of three, Linux x86-64):
  - Startup hello-world: 3 ms.
  - fib(30): `xs --jit` 31 ms, VM 138 ms, node 20 ~62 ms, cpython 3.13 ~71 ms.

- Both installers (sh for macOS/Linux, irm pipe for Windows) verify the GitHub release against published SHA-256 sums before running.

## Sample syntax

```
{- classic recursive fib, memoised -}
@memoize fn fib(n) {
    if n < 2 { return n }
    return fib(n - 1) + fib(n - 2)
}

println(fib(30))   -- 832040
```

Curly-brace, Haskell-style block comments `{- ... -}`, decorators (`@memoize`), expression-based `if` with implicit returns.

## Why it's notable

The set of claims is unusual together. Cross-target single-binary languages exist (Tcl, embedded JavaScript engines), JIT'd dynamic languages exist (Lua/LuaJIT, V8, SpiderMonkey), language-server-in-the-compiler exists in modern designs (Zig, Crystal). Bundling the whole toolchain — including the JIT and the LSP — into one 2.9 MB binary that targets ESP32 *and* macOS is the part worth looking at.

The compiler being 132 KLOC of C is on the small side for this surface area. Comparison points: Lua is ~30 KLOC C, V8 is millions, the Zig compiler is ~250 KLOC of Zig.

## Watchlist

Added to [[toolbox/watchlist]] — single-author project with limited public history at time of ingest. Things to re-check at the 90-day mark:

- Real-world adoption: does anyone outside the author ship code in this?
- Whether the iOS/Android/ESP32 claims hold up under scrutiny (mobile and microcontroller targets often imply ABI/runtime caveats).
- License posture — the site doesn't make this obvious, and a "use everywhere" language without a clear license is a no-go for serious adoption.

## Where it sits

Adjacent to [[ryelang-blog]] / [[rye-lang]] (small-binary embeddable language built around explicit capability whitelisting) and [[zig]] (the cross-platform-systems-language reference point). Each is making different choices about the cross-platform-plus-one-binary problem. XS bets on a much larger bundle (everything in one binary) than Rye does, and uses a more conventional syntax than Zig.

Site: [xslang.org](https://xslang.org) — version 1.2.32 at ingest.
