VMClass* SourcecodeCompiler::CompileClass( const StdString& path, const StdString& file, VMClass* systemClass ) { VMClass* result = systemClass; StdString fname = path + fileSeparator + file + ".som"; ifstream* fp = new ifstream(); fp->open(fname.c_str(), std::ios_base::in); if (!fp->is_open()) { return nullptr; } if (parser != nullptr) delete(parser); parser = new Parser(*fp); result = compile(systemClass); VMSymbol* cname = result->GetName(); StdString cnameC = cname->GetStdString(); if (file != cnameC) { ostringstream Str; Str << "Filename: " << file << " does not match class name " << cnameC; showCompilationError(file, Str.str().c_str()); return nullptr; } delete(parser); parser = nullptr; delete(fp); #ifdef COMPILER_DEBUG Universe::ErrorPrint("Compilation finished\n"); #endif return result; }
void VMPrimitive::EmptyRoutine(Interpreter*, VMFrame*) { VMSymbol* sig = GetSignature(); Universe::ErrorPrint("undefined primitive called: " + sig->GetStdString() + "\n"); }
void _Symbol::AsString(VMObject* /*object*/, VMFrame* frame) { VMSymbol* sym = static_cast<VMSymbol*>(frame->Pop()); StdString str = sym->GetStdString(); frame->Push(GetUniverse()->NewString(str)); }