-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperators.h
79 lines (61 loc) · 1.02 KB
/
operators.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
#ifndef __OPERATORS_H_
#define __OPERATORS_H_
#include <stdbool.h>
typedef enum
{
INFIX,
PREFIX,
POSTFIX,
}OperatorType;
typedef enum
{
UNKNOWN,
UNARY_ARITHMETIC,
BINARY_ARITHMETIC,
COMPARISION,
UNARY_LOGICAL,
BINARY_LOGICAL,
}OperatorCategory;
typedef enum
{
OPERATOR_ELEMENT,
OPERATOR_INDEX,
OPERATOR_CALL,
OPERATOR_POSTFIX_INCREMENT,
OPERATOR_POSTFIX_DECREMENT,
OPERATOR_DEREF,
OPERATOR_ADDRESS,
OPERATOR_PREFIX_INCREMENT,
OPERATOR_PREFIX_DECREMENT,
OPERATOR_PREFIX_PLUS,
OPERATOR_PREFIX_MINUS,
OPERATOR_MUL,
OPERATOR_DIV,
OPERATOR_IDIV,
OPERATOR_MOD,
OPERATOR_PLUS,
OPERATOR_MINUS,
OPERATOR_LT,
OPERATOR_GT,
OPERATOR_LE,
OPERATOR_GE,
OPERATOR_EQ,
OPERATOR_NE,
OPERATOR_ASSIGMENT,
OPERATOR_LAST,
}OperatorId;
typedef struct
{
const char* name;
OperatorType type;
int priority;
bool rightAssociative;
const char* chars;
const char* closing_bracket;
OperatorCategory category;
int int_opcode;
int uin_opcode;
int float_opcode;
}Operator;
extern Operator operators[];
#endif