Rewrite main type classes and data structures to better fit the new compilation model, and prepare future implementation of the macro expander.