summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/main.c b/main.c
index 239e938..fefeafc 100644
--- a/main.c
+++ b/main.c
@@ -3,6 +3,7 @@
#include <string.h>
#include <assert.h>
+#include "interpreter.h"
#include "parser.h"
#include "util.h"
@@ -82,5 +83,20 @@ int main(int argc,char **argv){
char *s=ast_stringify(pr.ast);
printf("%s\n",s);
free(s);
+
+ InterState *is=inter_make();
+ inter_register_prelude(is);
+ InterRet ir=inter_runcode(is,pr.ast);
+ if(ir.errstr){
+ fprintf(stderr,"\x1B[1;31m%s\x1B[0m\n",ir.errstr);
+ free(ir.errstr);
+ return 1;
+ }
+ s=ast_stringify(ir.ast);
+ printf("%s\n",s);
+ free(s);
+ ast_free(ir.ast);
+ inter_destroy(is);
+
ast_free(pr.ast);
}