diff options
Diffstat (limited to 'src/interp.c')
| -rw-r--r-- | src/interp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/interp.c b/src/interp.c index 9749b6d..5a4c9b6 100644 --- a/src/interp.c +++ b/src/interp.c @@ -41,6 +41,19 @@ HASH_TABLE_IMPL(SExpRef, SExpRef); #define UNBOUND ((SExpRef){-1}) +// for wasm +Interp *new_interp() { + Interp *ret = malloc(sizeof(Interp)); + Interp_init(ret); + return ret; +} + +// for wasm +void print_lisp_error(Interp *interp, SExpRef err) { + if (VALTYPE(err) != kErrSignal) return; + fprintf(stderr, "Error: %s", REF(err)->str); +} + void Interp_init(Interp *self) { self->recursion_depth = 0; self->gensym_cnt = 42; @@ -213,6 +226,7 @@ void Interp_init(Interp *self) { } } + SExpRef Interp_eval_string(Interp *interp, const char * str) { Parser_set_string(interp->parser, str); SExpRef sexp, ret; |
