Compiling XQuery to Java bytecodes

Per Bothner

<per@bothner.com>

June 2004
Qexo and Kawa
Lazy or eager evaluation
Event-driven data
for $i in (10, 20) return <p>{$i+1}</p>

becomes

void main (Consumer output) {
  temp_1(10, output);  temp_1(20, output);
}
void temp_1 (Object i, Consumer output) {
  output.beginElement("p");
  output.writeItem(NumOps.add(i, 1));
  output.endElement("p"); }
Node representation
Compiler overview
  1. Parsing.
  2. QName expansion.
  3. Module import.
  4. Name resolution.
  5. Analysis and optimalization.
  6. Code generation.
  7. Output of bytecode to .class files or for immediate execution.
Expressions
Code generation
Compiling for-expressions
Compiling functions
Tail calls
Node constructors
Extensions
Web applications
Status