diff --git a/src/pebblisp.c b/src/pebblisp.c index 003dc15..8551dc9 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -468,17 +468,22 @@ int repl(struct Environment *env) } } -int main(void) +int main(int argc, const char* argv[]) { struct Environment env = defaultEnv(); + if(argc == 2) { + Object r = parseEval(argv[1], &env); + printAndClean(&r); + } else { #ifndef NO_REPL - repl(&env); + repl(&env); #else - Object r = parseEval("(def ad (fn (a) (+ 1 a)))", &env); - printAndClean(&r); - r = parseEval("(map ad (1 2 3))", &env); - //printAndClean(&r); + Object r = parseEval("(def ad (fn (a) (+ 1 a)))", &env); + printAndClean(&r); + r = parseEval("(map ad (1 2 3))", &env); + printAndClean(&r); #endif + } deleteEnv(&env); } #endif