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 /interpreter.h | |
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 'interpreter.h')
-rw-r--r-- | interpreter.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/interpreter.h b/interpreter.h index e643494..4434de2 100644 --- a/interpreter.h +++ b/interpreter.h @@ -3,8 +3,22 @@ #include "ast.h" +typedef struct InterRet{ + // Exactly one of ast and errstr is non-NULL. The non-NULL member + // needs to be free'd. + AST *ast; + char *errstr; +} InterRet; + +InterRet ir_ast(AST *ast); +InterRet ir_err(char *errstr); +InterRet ir_err_c(const char *errstr); + + typedef struct InterState InterState; InterState* inter_make(void); void inter_destroy(InterState *is); -void inter_runcode(InterState *is,AST *ast); //updates symbol id's +void inter_register(InterState *is,const char *name,lambdafunc_t cfunc); +void inter_register_prelude(InterState *is); +InterRet inter_runcode(InterState *is,AST *ast); //updates symbol id's |