cpp: refactored engine to be in cpp file as well

Doesn't build yet
cpp: Moved large functions to engine.cpp and options.cpp + compiles
builtins: fix for typechecking