fully refactored intermediate code generator. no support for arrays and structs.