Starting with Loot the compiler should either return multiple values or a more structured result than just an Asm sequence so that compilation can be a single pass. The code would be more efficient and clearer and eliminate the functions that scan over a program and produce certain subexpressions (e.g. lambdas, datums).