diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-02 22:31:49 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-02 22:31:49 -0800 |
commit | 64feef1b9ea72adf7ba32998e9dca7d507607498 (patch) | |
tree | a409e61877bb51aa6fb2477175dabbf3dbccf298 /src/include/visitor.h |
a lot of stuff.
Diffstat (limited to 'src/include/visitor.h')
-rw-r--r-- | src/include/visitor.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/include/visitor.h b/src/include/visitor.h new file mode 100644 index 0000000..87f2853 --- /dev/null +++ b/src/include/visitor.h @@ -0,0 +1,26 @@ +#ifndef VISITOR_H +#define VISITOR_H +#include "./ast.h" +#include "./hash_table.h" +#include "./stack.h" + +typedef struct { + hash_table_t *symbol_table; + stack_t *stack_frame; + ast_t *root; +} visitor_t; + +void eval_error(visitor_t *v); + +visitor_t *init_visitor(ast_t *root); + +bool is_self_evaluating(ast_t *e); + +ast_t *eval_symbol(visitor_t *v, ast_t *e); + +ast_t *eval_list(visitor_t *v, ast_t *e); + +ast_t *eval_expr(visitor_t *v, ast_t *e); + +ast_t *eval(visitor_t *v); +#endif |