documents and reorganizes the compiler code

Closes #83