-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeGenerator.java
More file actions
77 lines (66 loc) · 3.22 KB
/
CodeGenerator.java
File metadata and controls
77 lines (66 loc) · 3.22 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
73
74
75
76
77
public enum CodeGenerator {
/**********************************************************
* START_DEFINE: Marks the beginning of a variable *
* definition or assignment. *
**********************************************************/
START_DEFINE,
/**********************************************************
* END_DEFINE: Marks the end of a variable definition or *
* assignment block. *
**********************************************************/
END_DEFINE,
/**********************************************************
* NO_OP: Represents a no-operation instruction, often *
* used for placeholders or to maintain structure. *
**********************************************************/
NO_OP,
/**********************************************************
* START_PAREN: Represents an opening parenthesis used to *
* group operations or expressions. *
**********************************************************/
START_PAREN,
/**********************************************************
* END_PAREN: Represents a closing parenthesis used to *
* end a grouped operation or expression. *
**********************************************************/
END_PAREN,
/**********************************************************
* LOAD: Loads a value from a variable or memory location *
* into a register for further operations. *
**********************************************************/
LOAD,
/**********************************************************
* STORE: Stores a value into a variable or memory *
* location from a register. *
**********************************************************/
STORE,
/**********************************************************
* ADD: Represents an addition operation between two *
* values. *
**********************************************************/
ADD,
/**********************************************************
* SUB: Represents a subtraction operation between two *
* values. *
**********************************************************/
SUB,
/**********************************************************
* MULT: Represents a multiplication operation between *
* two values. *
**********************************************************/
MULT,
/**********************************************************
* DIV: Represents a division operation between two *
* values. *
**********************************************************/
DIV,
ADDI, // Add Immediate
SUBI, // Subtract Immediate
LW, // Load Word
SLT, // Set Less Than
BNE, // Branch if Not Equal
SGN, // Set Greater Than
BLT, // Branch if Less Than
BEQ, // Branch if Equal
BGT // Branch if Greater Than
}