Theoretical/academical question - Is it possible to simulate, e.g., a (unicode) LuaTeX engine on an 8-bit Knuth TeX engine?

Question 1: Yes, if you assume that these engines have access to unbounded memory and time (not infinite, but expandable whenever more memory/time is needed), as one usually assumes when saying that computers are Turing-complete.

Question 2: No. Turing-machines are a mathematical model of computation, like register machines, lambda calculus and many others. TeX engines, real computers etc are realizations of a mixtures of different models.

Question 3: Yes, if you answer Question 1 with yes. Every Turing-complete formalism can simulate any other modulo some input/output transformations (otherwise it wouldn't be Turing-complete). This doesn't say anything about the practicability. E.g., you can use the TeX engine (with unbounded memory/time) to simulate an x86 architecture, which runs Linux, which runs XeTeX. However, I wouldn't want to delay my breakfast while waiting for the result of typesetting Hello, world!\bye.


A Turing-complete language is capable of computing all computible functions on integers.

It would be possible to represent a Unicode system in some format that the older system could compute, convert the inputs to their compatible representation, and then produce the representation of the output, all on on an older TeX engine, given sufficient time and memory. In fact, a Turing-compatible TeX engine could simulate the entire computer running LuaTeX.

This does not necessarily imply that a legacy TeX engine could read UTF-8 input and produce a Unicode PDF with embedded OpenType fonts. In theory, though, it could be the backend to a system that converts the input and the output of the legacy TeX engine to and from the compatibile representation, respectively.


Is it possible? Theoretically, but while TeX is Turing-complete, it is restricted in its memory capacity and you would probably run out of capacity before you got there. I'm guessing that one would need to re-implement TeX in TeX macros as part of the project as well as writing a full Lua interpreter also in TeX macros. The limitations of the TeX macro language are such that you would probably want to write a compiler that compiles some higher-level language such as C to TeX macros to do this. If you wrote this compiler in C, it could bootstrap itself to then run as TeX macros itself. But again, memory capacity is and always will be an issue.