This question already has an answer here:
Are there any alternate compiler implementations for the Tex language? I know that there are variants (Luatex for instance), but do they all share the same codebase with Tex/Pdftex? What about Xetex, is that a completely separated implementation in terms of code base? Does it target the exact same language, or are there differences in what they support?
Edits to clarify:
with "alternate implementation", I mean a program that shares little or no code with the standard pdftex. Something rewritten from scratch (possibly in another language).
I mean something that I can use to compile a real-world document in. If I understand correctly, Latex is a macro system based on Tex, so an alternate compatible implementation of Tex should be able to run these macros with little or no changes. I don't know what you mean with "any Tex format". Do you mean output formats?
The example I have in mind is multiple compilers for the same language (e.g., Cpython or Pypy). For instance, there are many C compilers around; the two main ones are GCC and Clang. You can literally take the same C program and compile it with either of them (with very few exceptions regarding nonstandard features). Clang is a relatively new implementation, that provided in some cases greater speed and better error messages.
The differences between TeX engines is certainly relevant, but I don't find any mention to the similarities/differences between these engines. Are they all minor improvements to the same codebase, or five completely separate implementations? Can I take the same file (a simple Latex document, for instance) and compile it with either of them without changes?