-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparserDef.h
More file actions
72 lines (60 loc) · 1.46 KB
/
Copy pathparserDef.h
File metadata and controls
72 lines (60 loc) · 1.46 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef PARSERDEF_H
#define PARSERDEF_H
typedef struct token_struct * token;
typedef struct non_terminal_struct * non_terminal;
typedef struct rule_struct * rule;
typedef struct token_array_struct * token_array;
typedef struct non_terminal_array_struct * non_terminal_array;
typedef struct rule_array_struct * rule_array;
typedef struct parse_table_struct * parse_table;
typedef struct tree_node_struct * treenode;
typedef struct stack_node_struct * stack;
struct token_struct{
int ind;
char identity[100];
};
struct non_terminal_struct{
int ind;
char identity[100];
int * firstset;
int * followset;
rule_array rules;
};
struct rule_struct{
token head_token;
non_terminal head_non_terminal;
struct rule_struct * next;
};
struct token_array_struct{
int curr, size;
token * data;
};
struct non_terminal_array_struct{
int curr, size;
non_terminal * data;
};
struct rule_array_struct{
int curr, size;
rule * data;
};
struct parse_table_struct{
int rows, cols;
rule ** grid;
};
struct tree_node_struct{
token head_token;
non_terminal head_non_terminal;
non_terminal parent;
char * line_number;
char * lexeme;
treenode children[16];
};
struct stack_node_struct {
treenode head;
stack next;
};
extern token_array tokens;
extern non_terminal_array non_terminals;
extern parse_table table;
extern treenode root;
#endif