# The lane command and its tests

> lane lex, parse and build; exit codes and diagnostics; and how the examples on this site are verified.

## The lane command

The compiler is called `lane`. The compiler is written in Lane and builds itself to a byte-identical result (the fixpoint), on Windows, Linux and macOS (arm64); a bootstrap compiler only starts the chain. See the [roadmap](/roadmap.md) for where it is going. Three commands exist, and all three exit 1 if a file has an error and 2 on a usage or I/O error.

```sh
lane lex <file.ln>
lane parse [-j <threads>] <file.ln>...
lane build [-j <threads>] [-o <out.exe>] <file.ln>
```

- `lane lex` prints one line per token: `<start> <end> <Kind> <text>`, with byte offsets, ending with the `Eof` token. Any other implementation of the lexer must print these bytes exactly.
- `lane parse` prints each file's syntax tree, one declaration per line, and diagnostics as `path:line:col: error: message` on standard error. Files are parsed in parallel and the output does not depend on the thread count.
- `lane build` compiles a program to an executable. Functions are compiled in parallel and the executable's bytes do not depend on the thread count.

Diagnostics are plain lines on standard error: `path:line:col: error: message`. The parser reports the first error in each top-level declaration and resumes after the `}` or `;` that ends it, so one run reports an error in every broken declaration.

A construct that the parser accepts but the compiler cannot build yet is refused with a "not supported ... yet" error, never compiled into something else. The dated Status section of the [agent docs](/docs/agents.md) lists what the current compiler builds.

The generated code is deliberately unoptimized: every value is computed into a register and every variable and temporary lives in a stack slot.

## How the examples here are verified

Every program on this site comes from the compiler's own test suite, which has 1668 programs: 556 that must build and run, and 1112 that the compiler must refuse. A test names the exact bytes the program must write to standard output, its exit code, and for a refusal the compiler's exit code and message. A test passes only when all of them match byte for byte.

The test runner is itself written in Lane. It builds each program, runs it with a time limit of 10 seconds in a clean environment, and reports the first differing byte with a window of what was expected and what was got. The same programs are meant to be built for every target and checked against the same expected bytes; that is how parity between instruction sets is intended to be tested (see [Targets](/targets.md)).

Where a page shows "Verified", the standard output, exit code or compiler message next to it was read from those expectations when this site was built, so the claim is checked at every build.
