diff --git a/src/Makefile b/src/Makefile index 2453986..d6ceea7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,3 +18,6 @@ run: install: cp ./$(exe) /usr/bin/pl + mkdir -p /usr/share/pebblisp/ + rm /usr/share/pebblisp/* + cp ./examples/* /usr/share/pebblisp/ diff --git a/src/examples/repl.pbl b/src/examples/repl.pbl new file mode 100755 index 0000000..0970ce9 --- /dev/null +++ b/src/examples/repl.pbl @@ -0,0 +1,12 @@ +#!/usr/bin/pl +(def repl (fn (_) ( + (prn "pebblisp::> ") + (def input (inp 0)) + (if (= input "q") () ( + (prn (eval input)) + (pch 10) + (repl 0) + )) +))) + +(repl 0) diff --git a/src/pebblisp.c b/src/pebblisp.c index 1e33f6d..2a7c02f 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -774,13 +774,7 @@ int readFile(const char *filename, struct Environment *env) { void repl(struct Environment *env) { - char input[200] = ""; - while(input[0] != 'q') { - printf("pebblisp>> "); - fgets(input, 100, stdin); - Object obj = parseEval(input, env); - printAndClean(&obj); - } + readFile("/usr/share/pebblisp/repl.pbl", env); } int main(int argc, const char* argv[])