how to write a compiler