From 730a6d777530a33fbb8df86df8b16d842b12c283 Mon Sep 17 00:00:00 2001 From: mryouse Date: Wed, 7 Jun 2023 21:42:54 -0400 Subject: initial commit of the start of the core library --- main.d | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'main.d') diff --git a/main.d b/main.d index 7006a52..57a6dbc 100644 --- a/main.d +++ b/main.d @@ -24,6 +24,7 @@ import vm; void repl() { REPL = true; VM vm = new VM(); + interpret(getCore(), vm); while(true) { write("> "); @@ -33,17 +34,6 @@ void repl() { continue; } - /* - Parser parser = new Parser(input); - - Compiler compiler = new Compiler(ObjType.SCRIPT, &parser); - Function func = compiler.compile(); - */ - - /* - VM vm = new VM(func); - vm.run(); - */ interpret(input, vm); } } @@ -60,6 +50,10 @@ string readFile(string fname) { return to!string(ret); } +string getCore() { + return readFile("core.neb"); +} + int main(string[] args) { if (args.length <= 1) { repl(); @@ -71,9 +65,12 @@ int main(string[] args) { return 1; } + VM vm = new VM(); + interpret(getCore(), vm); + string data = readFile(fname); - interpret(data, new VM()); + interpret(data, vm); } return 0; } -- cgit v1.2.3