-
Notifications
You must be signed in to change notification settings - Fork 0
/
lexical.h
96 lines (87 loc) · 1.66 KB
/
lexical.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* @author Elio Yang
* @email jluelioyang2001@gamil.com
* @date 2021/8/23
*/
#ifndef ECC_LEXICAL_H
#define ECC_LEXICAL_H
#include "ecc-def.h"
#include "IS.h"
//L stands for logical or less
enum{
Number=64,
Function,
System,
Global,
Local,
Identifier,
Char,
Else,
Enum,
If,
Int,
Return,
Sizeof,
While,
Assign,
Cond,
Lor,
Land,
Or,
Xor,
And,
Eq,
Ne,
Lthan,
Gthan,
Leq,
Geq,
Shl,
Shr,
Add,
Sub,
Mul,
Div,
Mod,
Inc,
Dec,
Bracket
};
/*struct identifier{
int64_t token;
// used for judge the same
int64_t hash;
char *name;
// category like : global ,local etc.
int64_t category;
int64_t type;
// value or address(for function etc.)
int64_t value;
// used for global name equals local name
// save global
int64_t shadow_category;
int64_t shadow_type;
int64_t shadow_value;
};*/
enum {
Token,
Hash,// used for judge the same
Name,
Type,
Category,// category like : global ,local etc.
Value,// value or address(for function etc.)
ShadowType,
ShadowCategory,// used for global name equals local name ,save global
ShadowValue,
Size
};
//typed of vars/funcs
enum{
CHAR,
INT,
PTR
};
void get_next();
int64_t read_src(const char *filename);
void kw_parse();
#endif //ECC_LEXICAL_H