Minor refactoring
Change code order to satisfy type checker
Change order of definitions
Add explicit types to keep type checker happy
Code layout fixes
Reorder more definitions and add type decls
Add explicit type decl to please the type checker
Fix build ordering

Handle dependencies more intelligently. Note that this is still not
bullet-proof, and the implementation is inefficient
Detect access to globals with uninferred types
Detect access to attributes with uninferred types
Remove circular module dependency

Also cgen.py cannot be used as a script (this is not really useful any
more).
Refactor to simplify module dependencies

Also remove a circular module dependency.
Minor simplification
Minor refactoring
Move BasicTypes->mtypes: fewer cyclic dependencies
Fix module dependecy cycle detection

Also try to make it faster (though I didn't do any benchmarking really).

Closes #94 (though this is only the final implementation tweak).