Implement hoisting in catenation compiler.

Closes #281.