T3X
A tiny, portable, block-structured procedural language by Nils M Holm, with Pascal-like syntax and BCPL-inspired, almost typeless semantics.
Created by Nils M Holm
T3X is a small, portable, block-structured procedural language created by programmer and author Nils M Holm. Often summarized by its own documentation as “a minimal procedural language,” T3X pairs a Pascal-like surface syntax with semantics closer to BCPL: it is recursive, almost typeless, and object-oriented only to a modest degree. The language has existed in one form or another since the mid-1990s and remains actively developed today through a family of deliberately tiny, self-hosting compilers.
History & Origins
T3X grew out of a series of experiments by Nils M Holm in writing compact, self-compiling compilers. The lineage begins with T1, an early concept that was never fully implemented, followed by T2 in 1995 — the first working version, which generated 386 machine code and DOS executables. In 1997 the T3 compiler added Tcode and DOS/COM backends, and it was from this generation that the modern T3X language emerged the same year, with its compiler written in the predecessor T3 and additional backends for 386/a.out, DOS, and Tcode.
Holm announced T3X publicly on the comp.compilers newsgroup on April 29, 1998, describing it as “a very basic block-structured procedural language” and noting that “the T3X compiler is written in T3, its predecessor.” From there the language settled into a long series of releases, T3Xr2 through T3Xr8 (roughly 1999–2004), that progressively introduced an object system, interface classes, and 32-bit Tcode support.
Design Philosophy
T3X is a study in minimalism. Its guiding idea is that a genuinely useful procedural language, together with a compiler capable of compiling itself, can be kept extraordinarily small. The most minimal member of the family, T3X9, is on the order of 1,600 lines of source and compiles itself very quickly on modest hardware. This emphasis on smallness makes the whole system easy to understand end-to-end, which is a large part of its appeal for people interested in how compilers actually work.
The language borrows its two halves from two ancestors:
- Syntax from Pascal — block structure,
if/while/for-style control flow, and declaration-before-use give T3X a familiar, readable shape. - Semantics from BCPL — T3X is almost typeless, treating data primarily as machine words, and it inherits ideas such as generalized, nested array literals (a relative of BCPL’s tables).
Key Features
Almost Typeless
Like BCPL, T3X largely dispenses with a static type system. Variables are machine-word-sized cells, and the programmer is responsible for interpreting their contents. This keeps the language and its compiler small, at the cost of the compile-time type checking found in languages like Pascal or C.
Block-Structured and Recursive
T3X supports nested blocks, local declarations, and recursive procedures, giving it the structured-programming conveniences expected of a Pascal-family language.
Nested Array Literals
One of the features Holm highlighted from the outset is support for nested array literals — a generalization of BCPL-style tables — which lets programmers express structured constant data directly in source.
Modest Object Orientation
Later T3X releases added an object system with object declarations, making the language “to some degree object-oriented.” This remains lightweight rather than a full class hierarchy in the style of Java or C++.
The Tcode Abstract Machine
The original compilers targeted the Tcode machine, a 16-bit abstract machine defined independently of any particular hardware. Compiling to Tcode kept early T3X portable; later work added 32-bit Tcode as well as native backends. According to Holm’s documentation, native code generators have existed for a range of processors including the Z80, 8086, i386, x86-64, and Alpha AXP.
Evolution
Rather than a single evolving product, T3X is best understood as a family of related compilers, each exploring a slightly different point in the design space:
| Variant | Approx. Year | Target | Notes |
|---|---|---|---|
| T2 | 1995 | 386 / DOS | First working compiler in the lineage |
| T3 | 1997 | Tcode / DOS | Tcode and DOS/COM backends; basis of the T3X language |
| T3Xr2–r8 | 1999–2004 | Tcode, Unix, DOS | Object system, interface classes, 32-bit Tcode |
| T3X9 | 2017 | ELF (FreeBSD/386) | Minimal ~1,600-line subset, compiles to ELF directly |
| T3X/Z | 2019 | CP/M (Z80) | Generates .COM files; runs on vintage 8-bit hardware |
| T3X/86 | 2021 | DOS (8086) | Single-file compiler generating .COM files |
| T3X/0 | 2022 | Multiple | T3X9 plus flat modules and unsigned operators |
By 2024, the actively maintained T3X/0 had grown code generators for ARMv6, ARMv7, and x86-64, letting it cross-compile to modern targets while retaining the small, single-pass character of the T3X9 core.
Licensing
Nils M Holm has released his minimal compilers — including the T3X9 lineage, and his broader body of teaching code — into the public domain, using the Creative Commons Zero (CC0) dedication where public-domain status does not directly apply. This permissive stance is consistent with the language’s role as an educational and hobbyist tool.
Current Relevance
T3X occupies a niche shared by projects such as Holm’s own SubC (a small C89-subset compiler): languages and compilers small enough that a single person can read and understand the whole thing. Its practical audiences today are:
- Retrocomputing enthusiasts, who use T3X/Z and T3X/86 to write structured code for CP/M and DOS machines.
- Compiler-construction students, for whom a complete, self-hosting compiler in well under two thousand lines is a rare and valuable teaching artifact.
- Minimalism and bootstrapping hobbyists, who appreciate a language that compiles itself from a tiny source base.
Community contributions such as Hector Peraza’s T3XZ-RSX180 port — bringing the T3X/Z compiler to the RSX180 and RSX280 operating systems — show that the ecosystem, while small, remains genuinely active.
Why It Matters
T3X is unlikely to appear in a job listing, and that is rather the point. It demonstrates, concretely and repeatedly across three decades, that a real procedural language and a self-hosting compiler for it can be kept small enough to hold entirely in one’s head. In an era of ever-larger toolchains, the T3X family stands as a durable argument for radical minimalism — a Pascal-flavored, BCPL-spirited language whose greatest lesson is how little a working compiler actually needs to be.
Timeline
Notable Uses & Legacy
Self-Hosting Compilers
Each T3X compiler is written in T3X (or its predecessor T3) and bootstraps itself, making the language a compact, real-world demonstration of a self-hosting toolchain.
Retrocomputing (CP/M and DOS)
The T3X/Z and T3X/86 variants bring a modern block-structured procedural language to Z80 CP/M and 8086 MS-DOS systems, appealing to the vintage and retrocomputing community.
RSX180/RSX280 Port
A community port by Hector Peraza (T3XZ-RSX180) adapts Holm's T3X/Z compiler to the DEC-inspired RSX180 and RSX280 operating systems for the Z80/Z280.
Compiler Construction Education
Because a full T3X compiler fits in roughly 1,600 lines, the language is used to teach the mechanics of self-hosting compilers, from parsing to native code generation.