[Tex/LaTex] Generate a parse tree for TeX

parsing

If I google for parse tree and TeX. All I'm getting are how to draw parse trees in TeX.

I want to know if there are programs that can parse TeX, and output a parse tree that's easy to manipulate.

Best Answer

TeX is not built along the classical compiler architecture of a scanner and a parser that builds a parse tree. (When TeX was invented these concepts where much less clear than they are today.) And since TeX does not use a parse tree internally you are unlikely to find a tool that represents TeX code accurately in such a way. If you are serious about manipulating TeX code I'd suggest you tell us what you want to achieve - maybe there is another way to do it. One tool I would consider looking at is Hevea.

Related Question