Commands can be issued as args to the executable
This commit is contained in:
parent
29aa001de8
commit
3e62d57166
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue