Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I read on Wikipedia that the first version of TeX was written in SAIL. However, does anyone know what language later versions (i.e the current one) are implemented in?

share|improve this question
6  
The sources are written in a variety of Pascal. –  egreg Jan 25 '13 at 18:47
1  
LaTeX has been ported to javascript: manuels.github.com/texlive.js/website –  Chris Gregg Jan 26 '13 at 13:39
2  
add comment

2 Answers

up vote 26 down vote accepted

TeX was rewritten in Pascal. Actually, using a literate programming system called WEB, invented by Knuth himself. This system uses Pascal for the programming an TeX for the documentation.

The source code of TeX was published as a book: http://www.amazon.com/Computers-Typesetting-B-TeX-Program/dp/0201134373.

share|improve this answer
5  
Currently, TeXLive uses web2c to compile WEB source in C. Pascal is not longer used since many years... –  Paul Gaborit Jan 25 '13 at 22:45
1  
@zunbeltz The commented source is also available in TeX Live with texdoc tex. –  egreg Jan 25 '13 at 23:26
3  
@Kaz: TeX (& Co.) is written in WEB... The subset of Pascal produced by tangle is just used as an intermediate between WEB and C. –  Paul Gaborit Jan 26 '13 at 0:34
4  
@PaulGaborit: If you need to hack a TeX you still have to use Pascal (unless you are hacking LuaTeX which have been ported to C), so it is Pascal for most practical, the web2c translation can be seen as a compilation detail. And there is TeX-GPC where the Pascal code is directly compiled. –  Khaled Hosny Jan 26 '13 at 6:16
2  
@PaulGaborit: This tarball includes not only PDFTeX source code, but also the entire web2c system, kpathsea, a bunch of support libraries (zlib, xpdf, libpng, etc.) and even the source code for WEB and CWEB utilities. That is hardly the source code for TeX. –  Khaled Hosny Jan 26 '13 at 11:14
show 4 more comments

TeX is written in WEB (a literate programming language created by D. E. Knuth).

Originally, WEB source was translated into Pascal (a subset of Pascal) via tangle to produce executable and translated into TeX via weave to produce documentation of the code. Both programs have themselves been written in WEB.

Today, TeXLive uses web2c to translate directly WEB source into C... via the Pascal source produced by tangle (web2c is not a Pascal to C translator).

MikTeX must use a similar system to produce C/C++.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.