A system for compiling queries into incremental demand-driven code