Added writeCompileRun functionality for code generation