Xetal removes TeX commands and mathematical stuff (subject to command-line controls). It can also number the output lines. C, lex and yacc sources are supplied. The author is Raphael Cerf.