diff options
| author | mryouse | 2023-06-11 21:57:42 +0000 |
|---|---|---|
| committer | mryouse | 2023-06-11 21:57:42 +0000 |
| commit | 4dcd2fd24a2a09df4eaef5a425a168146ce96a4d (patch) | |
| tree | 28ee153b5d2f104a1a5bbda0b79b847b75d1576b | |
| parent | 2dd85b81098bd17d098d9acfb8567a2b5f54e9ab (diff) | |
add --no-core flag
| -rw-r--r-- | main.d | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -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); |
