
TPC16 is a Turbo Pascal 7 command line compiler written from scratch in Turbo Pascal, published on turbo51.com. It isn’t Borland’s original source, which probably wasn’t written in Pascal. It’s source-code compatible with Borland’s TPC.EXE: the same syntax, and it produces the same 16-bit x86 units and executables. Map files and debug info in the EXE are the exceptions, as those aren’t implemented.
Being written in Turbo Pascal 7, the compiler can compile itself, in theory. TPC.EXE runs under DOS and runs out of memory on the larger units, so the build is done with BPC.EXE, the protected mode version, which has fewer memory limits. The result is TPC16.exe, which then compiles Turbo Pascal sources into binary compatible TPU or EXE files.
Most of the source is published with comments on the site, and a demo version of the compiler with everything except the unit sources is free to download. The complete source package is sold for a fee. There’s also TPC32, a 32-bit build of the same compiler that compiles under Delphi 7, drops the segment:offset limits and uses new symbol table management. TPC32 was the starting point for Turbo51, a Pascal compiler for 8051 microcontrollers.
See more at turbo51.com.