summaryrefslogtreecommitdiff
path: root/src/include/visitor.h
blob: de73248f7d2f9ee93c8759bac40437adeb66d780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef VISITOR_H
#define VISITOR_H
#include "./ast.h"
#include "./hash_table.h"
#include "./parser.h"
#include "./stack.h"

typedef struct {
  parser_t *p;
  hash_table_t *eval_table;
  stack_t *stack_frame;
  ast_t *root;
} visitor_t;

void eval_error(visitor_t *v, ast_t *e);

visitor_t *init_visitor(parser_t *p);

bool is_self_evaluating(ast_t *e);

bool is_built_in(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