Take the 2-minute tour ×

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.

share|improve this question
There was once a Java project to implement the TeX parser, but AFAIK it got never finished. I'm sure the best place to look would be the book TeX: The Program. –  Martin Scharrer Jun 29 '11 at 8:58
add comment

1 Answer

up vote 8 down vote accepted

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.

share|improve this answer
add comment

Your Answer


