Implement CompileStateTracker object

This is to be swapped out with core, wherever core is used at compile time