Compiler base reworked to new less global compiler

New compiler base
@stijn22 @nvanson @slemmen 

Ready for review, not ready for test
I'm assuming that these comments within the cases here are todo's i.e. they tell what code eventually will do in there?