TeX's input grammer can change during the TeX run, so I believe it is impossible to make an equivalent of LLVM (unless I misunderstand the concept of LLVM).
That is exactly what I am saying.
> TeX's input grammer can change during the TeX run, so I believe it is impossible to make an equivalent of LLVM
The important part is not the grammar, but the internal representation. I don't know enough about TeX to know much about its internal representation post-parsing.
IIRC it's a stream of tokens. A token can be a character, a built-in command, a macro etc. During processing of this token stream macros are "expanded", i.e. replaced with their definition (recursively). It is possible to control this expansion process using built-in commands.
Neither can C++[0], yet there still are C++ compilers out there. It does raise the bar significantly, though.
Unfortunately it doesn't have a (pure) TeX reader yet, but that could be implemented relatively easily.
Maybe this is something like what LuaTeX is trying to do? It's hard to tell from their web page.