document and reorganize the compiler code

A first attempt to reorganize and document the code of the compiler. The aim is to make it easier to understand, and so to develop and to maintain.

There is still much more work to be done, but I'm looking for some feedback before moving forward.