The main component of the XSLTC compiler is the class
This class uses three parsers to consume the input stylesheet(s):
is used to parse the stylesheet document and pass its contents to
the compiler as basic SAX2 events.
is a parser used to parse XPath expressions and patterns. This parser
is generated using JavaCUP and JavaLEX from Princeton University.
is a wrapper for the other two parsers. This parser is responsible for
using the other two parsers to build the compiler's abstract syntax tree
(which is described in more detail in the next section of this document).
Evey node in the AST extends the
SyntaxTreeNode base class
and implements the
translate() method. This method is
responsible for outputting the actual bytecodes that make up the
functionality required for each element, function, expression or pattern.
Some nodes in the AST require more complex code than others. The best
example is the
<xsl:stylesheet> element. The code that
represents this element has to tie together the code that is generated by
all the other elements and generate the actual class definition for the main
translet class. The
Stylesheet class generates the translet's
constructor and methods that handle all top-level elements.