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();
|
struct Environment env = defaultEnv();
|
||||||
|
if(argc == 2) {
|
||||||
|
Object r = parseEval(argv[1], &env);
|
||||||
|
printAndClean(&r);
|
||||||
|
} else {
|
||||||
#ifndef NO_REPL
|
#ifndef NO_REPL
|
||||||
repl(&env);
|
repl(&env);
|
||||||
#else
|
#else
|
||||||
Object r = parseEval("(def ad (fn (a) (+ 1 a)))", &env);
|
Object r = parseEval("(def ad (fn (a) (+ 1 a)))", &env);
|
||||||
printAndClean(&r);
|
printAndClean(&r);
|
||||||
r = parseEval("(map ad (1 2 3))", &env);
|
r = parseEval("(map ad (1 2 3))", &env);
|
||||||
//printAndClean(&r);
|
printAndClean(&r);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
deleteEnv(&env);
|
deleteEnv(&env);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue