pull generic compilation into a reusable function
Add a const check pass to the compiler

Also updates everything to use compile() instead of the manual
sequence of compiler passes
compiler update
const check inside functions, too
update todo