Add interpreter to libab.

This commit is contained in:
Danila Fedorin 2018-04-24 11:35:27 -07:00
parent a86938b574
commit 46040531fb
2 changed files with 8 additions and 0 deletions

View File

@ -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.

View File

@ -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);
}