aboutsummaryrefslogtreecommitdiff
path: root/repl.c
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2014-05-14 22:27:34 +0300
committerOskari Timperi <oskari.timperi@iki.fi>2014-05-14 22:27:34 +0300
commitd45a5b21de22438c004e1db96a8f154da09cdc0e (patch)
treec2a7bd2a4d08de03ef5e11932d9a1abf85110c80 /repl.c
downloadlispish-d45a5b21de22438c004e1db96a8f154da09cdc0e.tar.gz
lispish-d45a5b21de22438c004e1db96a8f154da09cdc0e.zip
Initial commit
- tokenizing, parsing and basic eval support - arithmetic (+, -, *, /) - quote - atom for checking if the arg is an atom (i.e. not a list) - eq for checking equality - > for checking order - if - some unit testing - simple repl - mem management needs improvement :-)
Diffstat (limited to 'repl.c')
-rw-r--r--repl.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/repl.c b/repl.c
new file mode 100644
index 0000000..c9ddb6a
--- /dev/null
+++ b/repl.c
@@ -0,0 +1,27 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "parse.h"
+#include "eval.h"
+#include "list.h"
+#include "linenoise.h"
+
+int main(int argc, char **argv)
+{
+ char *line;
+
+ linenoiseSetMultiLine(0);
+
+ while ((line = linenoise("> ")) != NULL)
+ {
+ linenoiseHistoryAdd(line);
+
+ struct list *result = eval_str(line);
+
+ print_list(result, 0);
+
+ free(line);
+ }
+
+ return 0;
+}