added function calls, native function objects and runtime builtins

This commit is contained in:
cozis
2021-11-02 13:19:06 +00:00
parent 051966a3f3
commit 87e9f4775b
12 changed files with 389 additions and 18 deletions
+12 -3
View File
@@ -220,9 +220,19 @@ int main(int argc, char **argv)
RuntimeError error;
RuntimeError_Init(&error, runtime);
if(!add_builtins(runtime, (Error*) &error))
{
fprintf(stderr, "Couldn't load builtins: %s\n", error.base.message);
Debug_Free(dbg);
Source_Free(src);
Executable_Free(exe);
RuntimeError_Free(&error);
return 1;
}
Object *result = run(runtime, (Error*) &error, exe, 0, NULL, 0);
if(result == NULL || !Object_Print(result, stderr, (Error*) &error))
if(result == NULL)
{
fprintf(stderr, "RUNTIME ERROR: %s.\n", error.base.message);
@@ -238,8 +248,7 @@ int main(int argc, char **argv)
Runtime_Free(runtime);
return 1;
}
fprintf(stderr, "\n");
Runtime_Free(runtime);
Debug_Free(dbg);
}