# Convert TeX -> C++/Java -> PDF

Recently I've seen LaTeX sources and convinced those are very complicated and difficult for understanding. So my question is: Is that possible to convert LaTeX kernel sources to some widely used language like C++ or Java sources?

-
LaTeX is a set of macros for TeX. How exactly would one convert that to some arbitrary other language and expect it to work? You'd need TeX itself as well, and even then you have the whole business that (La)TeX mixing code and output, as the realities of typesetting make a clean division very hard. –  Joseph Wright Apr 7 '11 at 11:57
I should add that the LaTeX2e sources were written ~20 years ago, and are optimised for computer restrictions that are difficult to imagine today! –  Joseph Wright Apr 7 '11 at 11:57
A lot of the code for ConTeXt MkIV is written in lua. Even for the TeX part, ConTeXt is easier to read than LaTeX. –  Aditya Apr 7 '11 at 15:06
C++ and Java aren't inherently understandable, and LaTeX isn't inherently difficult. Understandibility is temporal and in the eye of the understander. We can help you understand LaTeX, but not to avoid it. –  Matthew Leingang Apr 7 '11 at 17:55

Sure, it is possible. But nobody finished the project by now ... Except the nts-System, written in Java, but without using the possibilities of Java. One of the last projects is ExTeX, written also in Java and also not finished ...

The real Problem is not to write it in C++ or whatelse, the problem is to finish it ... ;-)

-
LuaTeX is now fully written in C, but I don't think the question was a bout TeX the program bur rather about TeX macros that form LaTeX's kernel. –  Khaled Hosny Apr 7 '11 at 13:58
LuaTeX is the more or less the code from web2C, but not rewritten in C, which nobody would do (I suppose) –  Herbert Apr 7 '11 at 14:06
since luatex 0.50 all pascal code have been manually converted to C code, read Taco's article tug.org/TUGboat/tb30-3/tb96hoekwater-pascal.pdf –  Khaled Hosny Apr 7 '11 at 16:30
@Khaled: I know, but this is what I wanted to say: it is converted from WEB to C with the same behaviour of all procedures and algorithmn. Nothing new, except the use of Lua, –  Herbert Apr 7 '11 at 16:43
the question didn't ask about anything new either (besides luatex is not a 100% replication, the hyphenation subsystem have been rewritten based on libhnj, for example) –  Khaled Hosny Apr 7 '11 at 17:01

No. Tex has too crazy a semantics for that. In any case, converting sources in this way rarely increases comprehensibility.

-