aboutsummaryrefslogtreecommitdiff
path: root/src/include/doer.h
blob: 8f51266874e86850be9e1646f5d7d6c3d3d03a68 (plain) (blame)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef DOER_H
#define DOER_H

#include "util.h"
#include "tree.h"

typedef struct DOER {
   tree_t* tree;
} doer_t;

/* Creates a new parser. */
doer_t* doer_init(tree_t* tree);

/*
   Destroys a doer.
   - Does not free the `tree`.
*/
void doer_destroy(doer_t* doer);

/* Built-in function. */
typedef struct BLINF {
   void (*fp)(doer_t*);
   char name[24];
} blinf_t;

void doer_do_blin_print(doer_t* tree); // Built-in function `print`.
void doer_do_blin_printl(doer_t* tree); // Built-in function `print`.

void doer_do_block(doer_t* tree);
void doer_do_expr(doer_t* tree);
void doer_do_lint(doer_t* tree);
void doer_do_lstr(doer_t* tree);
void doer_do_tag(doer_t* tree);
void doer_do_darg(doer_t* tree);
void doer_do_carg(doer_t* tree);
void doer_do_def(doer_t* tree);
void doer_do_call(doer_t* tree);

const static blinf_t blinfs[] = {
   { doer_do_blin_print, "print" },
   { doer_do_blin_printl, "printl" }
};

#endif