-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtree.h
More file actions
43 lines (36 loc) · 850 Bytes
/
tree.h
File metadata and controls
43 lines (36 loc) · 850 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
#ifndef TREE_H
#define TREE_H
typedef struct Node Node;
typedef struct Param Param;
typedef struct Token Token;
struct Node{
char *token;
char *value;
Param *param;
char *type;
int function;
int line;
int column;
Node *child;
Node *brother;
};
struct Token{
int line;
int column;
char *id;
};
struct Param{
char *name;
char *type;
Param *next;
};
Node* root;
Node* create_node(char* token, char* value, int line, int col);
Token* create_token(int line, int column, char *id); /* Create token to return from lex */
void insert_first_child(Node *node, Node *child_node);
Node* insert_child(Node *node, Node *child_node);
Node* insert_brother(Node *node, Node *brother_node);
void print_tree(Node *root, int dots);
void print_annotated_tree(Node *node, int dots);
void clear(Node *root);
#endif //TREE_H