diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-08-23 20:58:50 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-08-23 20:58:50 +0200 |
commit | cac651cd88f8da1e5957b0cc13fa25d79e1887fc (patch) | |
tree | 38b2645803df92661b797a64f18772e691d3d8fd /main.c | |
parent | 44602cb35735575c15cfcb92779337778649df8a (diff) |
Many things
- two-letter AST union members
- AST_QUOTED
- AST_LAMBDA
- an interpreter that works
- function registering in the interpreter
- some builtins
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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); } |