After looking at TeX, you may want to look at further extensions of it. The first major/widespread one was e-TeX.
A raw dump of the program is below; will annotate it later. Note that it may take quite a while to load.
Note: This page takes a long time to load fully, and may download about 60 megabytes.
To read the program, click on "Fetch modules" below.That's the end of this page. If you have any feedback about anything on this site, you can contact me here. To go back to the top-level page (if you are not on it already), click here.