aboutsummaryrefslogtreecommitdiff
path: root/main.d
diff options
context:
space:
mode:
Diffstat (limited to 'main.d')
-rw-r--r--main.d20
1 files 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);