I would like to know if there exists a LaTeX processor that works similar to SAXON for XML and XSLT documents. I would need it to extract some information from source code, and define its semantics.
LaTeX is completely open source and written in TeX, you can find a documented version of the sources as the file source2e
TeX is also open source, written in WEB, a literate programming language that produces both the (pascal, originally, but now C) source of the program and also a (TeX) document describing the source in complete detail. tex.web is also available in all TeX distributions, or you can get the fully typeset and indexed version as the published book TeX: The Program.
Given the clarification of your aims in comments I don't think the source of either LaTeX or TeX will help much.
I suspect that a more productive way forward would be to convert to XHTML using
then you see
In the meantime, I've found this project that could convert LaTeX elements into HTML+MathML, and also implements a LaTeX parser.