Algebraic construction of compilers