Compiler base reworked to new less global compiler

New compiler base
@stijn22 @nvanson @slemmen 

Ready for review, not ready for test