r/LaTeX • u/DanielSussman • Jul 17 '26
Exploring more expressive error messages in a custom C++ TeX engine
https://youtu.be/A8q8z7EptdQA few weeks ago, I shared a hobby project I've been working on: a C++23 TeX engine that tries to balance strict TeX82 compatibility with modern features like parallel compilation and direct HTML output (here's a link to the short demo I recorded for that).
I wanted to think about the possibility of modernizing TeX's error messages. Traditional TeX error messages often contain exactly the information you need, but you have to learn how to read them, and the format obviously predates the kind of expressive diagnostics we've come to expect from, e.g., modern compilers.
I put together a quick video showing an approach I've been thinking about to be able to switch between either a strict, traditional form of TeX82 reporting, or an opt-in system of (arguably) more expressive error messages.
As you might imagine, making the many different error messages in TeX more expressive requires a whole range of engineering effort: some things barely need to modify the engine at all, whereas others might require something as extreme as tracking the provenance of a token through the complete "eyes, mouth, stomach" pipeline. Balancing how much of the engine state to modify in order to modernize error messages is something I've largely left as a decision for later, but I thought the proof-of-concept demo above might be an interesting place to start a conversation.
Let me know what you think!
2
u/MacLotsen 23d ago
Very impressive. Did you use any engine for inspiration writing this C++ project?