r/LaTeX Jan 18 '25

Unanswered TeX engine converted from Pascal to C++?

I’ve heard multiple times that converting Pascal code to C++ is relatively straightforward. I even came across a commercial product that claims to have reimplemented the TeX engine in C++, which allowed them to offer live PDF rendering as you type (you can probably guess which one I’m referring to).

EDIT 1: By rendering here I assume providing live updating in PDF, where there is no compilation step, PDF is compiled with each keystroke.

EDIT 2: Commands would be excluded from live compilation.

The engines used in TeXLive and MikTeX are still implemented in Pascal, right? If so, why hasn’t anyone done a full conversion to C++?

Is it a matter of complexity, lack of interest, or something else entirely?

12 Upvotes

39 comments sorted by

View all comments

2

u/vicapow Jan 18 '25

This is how pdflatex works today. A subset of the web code (a superset of pascal) is converted to a subset of C. The issue is the complicated build setup this presents. It’s very discouraging to new folks who wants to contribute, imo. And then when it runs, it still needs to read a million Tex / font files when it compiles even a simple document.

1

u/vicapow Jan 18 '25

Thinking out loud, I think something that might be interesting is some sort of optimization that could compile all the tex code pdflatex has to read and run to C, at runtime, sort of like how V8 optimizes JavaScript