To be more precise (and add more detail than anyone asked for!):
- TeX is not written in Pascal itself, but in a literate-programming system called WEB [1,2] (a language basically created for writing the TeX program in!), which lets you mix Pascal source code with TeX documentation, and lets you write your program as a “web” of “sections”, each independently understandable, and referring to other sections (with macros etc). The “tangle” program converts the WEB source code to Pascal source code.
- The Pascal used in the TeX program is a limited subset [3] of Pascal (and specifically of what Knuth called “Pascal-H”, the Pascal implementation that was available to him on the DEC PDP-10 system used at Stanford SAIL).
- It is not exactly true that he does not rely on implementation details, but he's conscious about where he does so, and he's included a list of all such places in the index under “system dependencies” [4] — in most places he gives suggestions on what could be done if the compiler didn't work the same way.
- In the early days, when Pascal was the most common language available at the places TeX was usually run (universities, research labs, etc.), the Pascal code (generated by Tangle) was directly compiled into a Pascal program and run.
- With the rise of C (into the wider world outside Bell Labs), there arose both hand-translations of the WEB (or Pascal) source code, and programs to do this automatically.
- Today, major TeX distributions have their own Pascal(WEB)-to-C converters, written specifically for the TeX (and METAFONT) program. For example, TeX Live uses web2c[5], MiKTeX uses its own “C4P”[6], and even the more obscure distributions like KerTeX[7] have their own WEB/Pascal-to-C translators. One interesting project is web2w[8,9], which translates the TeX program from WEB (the Pascal-based literate programming system) to CWEB (the C-based literate programming system).
- The only exception I'm aware of (that does not translate WEB or Pascal to C) is the TeX-GPC distribution [10,11,12], which makes only the changes needed to get the TeX program running with a modern Pascal compiler (GPC, GNU Pascal).
[1]: http://literateprogramming.com/knuthweb.pdf
[2]: http://mirrors.ctan.org/info/knuth/webman.pdf
[3]: http://texdoc.net/texmf-dist/doc/generic/knuth/tex/tex.pdf#p... (section 3)
[4]: http://texdoc.net/texmf-dist/doc/generic/knuth/tex/tex.pdf#p... (entry “system dependencies”)
[6]: http://tug.org/interviews/schenk.html
[7]: https://tex.stackexchange.com/questions/111332/how-to-compil...
[8]: https://w3-o.cs.hm.edu/~ruckert/web2w/index.html
[9]: https://ctan.org/pkg/web2w
[10]: http://www.tex.ac.uk/FAQ-sysunix.html