-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpression.h
More file actions
53 lines (44 loc) · 799 Bytes
/
expression.h
File metadata and controls
53 lines (44 loc) · 799 Bytes
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
45
46
47
48
49
50
51
52
53
#pragma once
#include <stdint.h>
#include "main.h"
#include "slice2.h"
#include "hashmap.h"
//#include "statement.h"
enum type_of
{
t_not,
t_star,
t_divide,
t_mod,
t_plus,
t_minus,
t_l,
t_lt,
t_g,
t_gt,
t_eq,
t_neq,
t_and,
t_or,
t_num,
t_var,
t_func,
t_print,
t_error
};
typedef struct expression expression;
typedef union {
struct func *function;
Slice* name;
uint64_t value;
} character;
struct expression {
expression* left;
expression* right;
character* character;
enum type_of type;
};
void compile_expression(emitter_t*, expression*);
expression* preprocess_expression(expression *e);
void free_expression(expression*);
uint64_t eval_expr(Interpreter*, struct map*, expression*);