For sake of elegance, I wanted to compile directly the original Pascal code. It turned out that it's not possible as is. It took me some time to find on the web the hints to compile the Pascal source code of Knuth's tex. I found three solutions.
GNU Pascal
First, Knuth himself published in 2000 a port of tex to GNU Pascal. However, this version is limited to tex v3.14159 and requires a small additional heterogeneous piece of C code.
Second, Waldek Hebisch published a port gor GNU Pascal. It is nicely documented and published on CTAN. It supports the latest version of Knuth's tex (v3.1415926), and has a clean directory scheme for the additional files (eg. fonts). Since it has very limited dependencies to the GPC library (only one call to
execute
and one to installsignalhandler
that are easy to remove), it can be easily compiled in other runtime environments (and maybe with other compilers).FreePascal
Preferred Wolfgang Helbig has also ported TeX to FreePascal, see https://ctan.org/pkg/tex-fpc, with the latest version from 2020-11-24
See also running tex on a java virtual machine
Note:
tex-gpc.pas
is compatible with the pretty printer ptop only if you set the linesize to high values. For instance: ptop -l 250 tex-gpc.pas tex-gpc-pretty.pas