Rewrite main type classes and data structures to better fit the new compilation model, and prepare future implementation of the macro expander.
This also fixes a bug that caused the parser to accept (define-library ... ) in expression-position.