Est. 1997 Intermediate

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

Paradigm Procedural, block-structured, almost typeless, partially object-oriented
Typing Almost typeless (machine-word oriented)
First Appeared 1997
Latest Version T3X/0 (2024)

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:

VariantApprox. YearTargetNotes
T21995386 / DOSFirst working compiler in the lineage
T31997Tcode / DOSTcode and DOS/COM backends; basis of the T3X language
T3Xr2–r81999–2004Tcode, Unix, DOSObject system, interface classes, 32-bit Tcode
T3X92017ELF (FreeBSD/386)Minimal ~1,600-line subset, compiles to ELF directly
T3X/Z2019CP/M (Z80)Generates .COM files; runs on vintage 8-bit hardware
T3X/862021DOS (8086)Single-file compiler generating .COM files
T3X/02022MultipleT3X9 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

1995
Nils M Holm builds T2, the first working compiler in the lineage, generating 386 machine code and DOS executables
1997
The T3 compiler adds Tcode and DOS/COM backends; the modern T3X language takes shape this year, with its compiler written in the predecessor T3
1998
Holm publicly announces T3X on the comp.compilers newsgroup (April 29, 1998), describing it as 'a very basic block structured procedural language'
1999-2004
The T3Xr2 through T3Xr8 releases add an object system (T3Xr6), interface classes (T3Xr7), and 32-bit Tcode support (T3Xr8)
2017
T3X9, an even more minimal subset written from scratch, compiles directly to ELF executables for FreeBSD/386
2019
T3X/Z is released, generating CP/M .COM files for the Z80 and self-compiling on vintage 8-bit hardware
2021
T3X/86 is released as a single-file compiler generating .COM files for DOS on the 8086
2022
T3X/0 arrives, extending the minimal T3X9 core with flat (non-hierarchical) modules and unsigned operators
2024
T3X/0 gains ARMv6, ARMv7, and x86-64 code generators, broadening its cross-compilation targets

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.

Language Influence

Influenced By

BCPL Pascal

Running Today

Run examples using the official Docker image:

docker pull
Last updated: