From 46040531fbd76a455fe3cd51c7347eee3bb12e58 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 24 Apr 2018 11:35:27 -0700 Subject: [PATCH] Add interpreter to libab. --- include/libabacus.h | 6 ++++++ src/libabacus.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/libabacus.h b/include/libabacus.h index 451d317..99615c2 100644 --- a/include/libabacus.h +++ b/include/libabacus.h @@ -5,6 +5,7 @@ #include "ht.h" #include "lexer.h" #include "parser.h" +#include "interpreter.h" #include "result.h" #include "table.h" #include "number.h" @@ -25,6 +26,11 @@ struct libab_s { * tokens to a tree. */ libab_parser parser; + /** + * The interpreter used + * to run a tree. + */ + libab_interpreter intr; /** * The table used to store top-level * things like functions and operators. diff --git a/src/libabacus.c b/src/libabacus.c index 965ed9e..6283853 100644 --- a/src/libabacus.c +++ b/src/libabacus.c @@ -12,6 +12,7 @@ libab_result libab_init(libab* ab) { if(result == LIBAB_SUCCESS) { libab_parser_init(&ab->parser, &ab->table); + libab_interpreter_init(&ab->intr, &ab->table, &ab->impl); result = libab_lexer_init(&ab->lexer); } @@ -164,5 +165,6 @@ libab_result libab_create_type(libab* ab, libab_ref* into, const char* type) { libab_result libab_free(libab* ab) { libab_ref_free(&ab->table); libab_parser_free(&ab->parser); + libab_interpreter_free(&ab->intr); return libab_lexer_free(&ab->lexer); }