Implemented native C functions called from Toy scripts

There's only example functions for now, but I'll add type-specific
functions later.
This commit is contained in:
2026-04-16 21:14:42 +10:00
parent 3a0f11ebb4
commit 88100b128a
8 changed files with 93 additions and 4 deletions

View File

@@ -7,6 +7,8 @@
#include "toy_compiler.h"
#include "toy_vm.h"
#include "standard_library.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -337,6 +339,12 @@ int repl(const char* filepath, bool verbose) {
Toy_VM vm;
Toy_initVM(&vm);
//hacky test
if (vm.scope == NULL) {
vm.scope = Toy_pushScope(&vm.memoryBucket, NULL);
initStandardLibrary(&vm);
}
printf("%s> ", prompt); //shows the terminal prompt and begin
//read from the terminal