Commands can be issued as args to the executable

This commit is contained in:
= 2020-05-08 17:08:14 +01:00
parent 29aa001de8
commit 3e62d57166
1 changed files with 11 additions and 6 deletions

View File

@ -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);
#else
Object r = parseEval("(def ad (fn (a) (+ 1 a)))", &env);
printAndClean(&r);
r = parseEval("(map ad (1 2 3))", &env);
//printAndClean(&r);
printAndClean(&r);
#endif
}
deleteEnv(&env);
}
#endif