T3X9 | T3X/Z | T3X/86 | T3X/0 | T3Xr7 | XT3X | T3Xr8 | T3R3
T3X is a small, portable, procedural, block-structured, recursive, almost typeless, and to some degree object-oriented programming language. Its syntax is similar to Pascal, its semantics resembles BCPL's. The language is described in the book T3X – A Minimal Procedural Language, but here is a shorter introduction. Even more succinctly, here is the most minimal Hello World program (in T3X/0):
USE t3x: t; DO t.write(T3X.SYSOUT, "Hello, World!\n", 14); END
In fact T3X is a family of programming languages that share a common syntax, but offer different runtime environments and focus on different aspects of programming. All T3X compilers are small and fast and easily bootstrapped. Some of them support modules and separate compilation, some compile to machine code in a single step. The original compiler was targetted at the 16-bit Tcode machine, but native code backends for various processors exist.
T3X9 is the smallest, fastest, and most minimalistic one of the T3X compilers. It self-compiles its own code (about 1600 lines of T3X) in about 0.05 seconds on a 750MHz machine. It runs on FreeBSD and targets the 386 CPU. It is a statement rather than a production tool.
T3X9 is also a good language for a first course in compilers! The book Write Your Own Compiler discusses the full source code of T3X9 on little more than 100 pages!
T3X/Z is a port of the T3X9 compiler for Z80-based computers running CP/M. It is a two-pass compiler that fits in 44KB of memory and self-compiles in about seven minutes on a 4MHz Z80 CPU (when using a RAM disk). No external runtime library is needed, all intrinsic functions are generated by the compiler. The compiler compiles directly from T3X to COM.
T3X/86 is a port of the T3X9 compiler for 8086-based computers running {PC,MS,DR,whatever}-DOS. It is a single 25KB COM file that does not depend on any external tools or libraries. It self-compiles on an emulated 50MHz PC/XT in about 20 seconds and compiles directly from T3X to COM. If you want a compiler on your rescue floppy, this might be an option! :)
T3X/0 is a new (2022) member of the T3X familiy, offering flat (non-hierarchical) modules, some T3Xr7 libraries, unsigned operators, and "extern" functions for accessing C libraries on Unix. There are ports for the Tcode/0 machine, CP/M on the Z80, DOS on the 8086 (tiny model COM only), and Unix on various processors via assembly language. 48K bytes of TPA are required on CP/M. Self-compilation is possible on all supported platforms. It takes about 10 minutes on CP/M and less than a second on Unix. 14 different (cross) compilers can be built from the source code. [more details]
Version 7.2.3 of the T3X compiler was the last version targetting the original Tcode machine. It was published in 2003 and never worked on 64-bit platforms except for the DEC Alpha. The 7.x versions offer a cleaned-up package that should compile on modern systems, like the x86-64 (although in 32-bit mode).
The T3Xr7 compiler is an optimizing compiler that targets the Tcode machine, the 8086 processor under DOS, the 386 processor under various Unix systems, as well as the Alpha AXP 21064 CPU under NetBSD. It is self-hosting under all supported systems. The T3Xr7 language supports modules and separate compilation. The compiler package even contains a tiny text-mode IDE.
MODULE name(t3x);
and OBJECT t[t3x];
at the top of the program. There
are more examples in the source code archive.
The XT3X compiler is a version of T3X9 that is intended for writing simple, sprite-based video games as they were popular in the 1980's. It targets an extended Tcode9 machine that provides color graphics and sound and runs under X11.
T3X 8.1.7 (zip, ~500KB) was the last version of the T3X compiler back in the days. It provided support for 32-bit Tcode, thereby removing the 64KB code and 64KB data limits. The ports may suffer from bit rot, though, so you might want to try version 7.x instead.
T3r3 (zip, 67KB) was the last T3 compiler before the language was renamed T3X. This is really old and hackish code, but shows nicely where T3X has its roots.