From 4dcd2fd24a2a09df4eaef5a425a168146ce96a4d Mon Sep 17 00:00:00 2001 From: mryouse Date: Sun, 11 Jun 2023 21:57:42 +0000 Subject: add --no-core flag --- main.d | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/main.d b/main.d index 57a6dbc..683eeb0 100644 --- a/main.d +++ b/main.d @@ -2,6 +2,7 @@ import std.stdio; import std.string; import std.file; import std.conv; +import std.getopt; /* import parser; @@ -21,10 +22,10 @@ import vm; */ -void repl() { +void repl(bool noCore) { REPL = true; VM vm = new VM(); - interpret(getCore(), vm); + interpret(getCore(noCore), vm); while(true) { write("> "); @@ -50,13 +51,20 @@ string readFile(string fname) { return to!string(ret); } -string getCore() { - return readFile("core.neb"); +string getCore(bool noCore) { + if (noCore) { + return ""; + } else { + return readFile("core.neb"); + } } int main(string[] args) { + bool noCore = false; + getopt(args, "no-core", &noCore); + if (args.length <= 1) { - repl(); + repl(noCore); } else { string fname = args[1]; @@ -66,7 +74,7 @@ int main(string[] args) { } VM vm = new VM(); - interpret(getCore(), vm); + interpret(getCore(noCore), vm); string data = readFile(fname); -- cgit v1.2.3