-
Notifications
You must be signed in to change notification settings - Fork 3
/
statements.h
52 lines (45 loc) · 1.24 KB
/
statements.h
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
/* statements.h by William Ho */
#ifndef STATEMENTS_H
#define STATEMENTS_H
struct expr_node;
#define COMMON_NODE_ATTRIBUTES \
int nodetype
struct for_node {
COMMON_NODE_ATTRIBUTES;
struct stmt_node *next;
struct stmt_node *last;
struct stmt_node *init;
struct stmt_node *cond;
struct stmt_node *body;
struct expr_node *incr;
};
struct stmt_node {
COMMON_NODE_ATTRIBUTES;
struct stmt_node *next;
struct stmt_node *last;
struct expr_node *expr;
};
struct if_node {
COMMON_NODE_ATTRIBUTES;
struct stmt_node *next;
struct stmt_node *last;
struct expr_node *check;
struct stmt_node *then;
struct stmt_node *otherwise;
};
struct while_node {
COMMON_NODE_ATTRIBUTES;
struct stmt_node *next;
struct stmt_node *last;
struct expr_node *check;
struct stmt_node *body;
};
struct stmt_node *new_if(struct expr_node *ifnode, struct stmt_node *thennode,
struct stmt_node *elsenode);
void add_stmt_list(struct stmt_node *to, struct stmt_node *s);
struct stmt_node *new_stmt_list(struct expr_node *e);
struct stmt_node *new_for(struct stmt_node *init, struct stmt_node *cond,
struct expr_node *incr, struct stmt_node *body);
struct stmt_node *new_while(struct expr_node *check, struct stmt_node *body);
struct stmt_node *new_jump_stmt(int type);
#endif