-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathThunder.st
131 lines (79 loc) · 2.73 KB
/
Thunder.st
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
Object subclass: Thunder [
| function |
function [
^ function
]
function: aSymbol return: aType [
function := IRFunction function: aSymbol return: aType
]
function: aSymbol parameters: anArray return: aType [
function := IRFunction function: aSymbol parameters: anArray return: aType
]
variable: aSymbol type: aType [
function variable: aSymbol type: aType
]
addInstruction: anInstruction [
function addInstruction: anInstruction
]
mov: anObject to: aSymbol [
self addInstruction: (Mov from: anObject to: aSymbol)
]
add: anObject and: anObject2 to: aSymbol [
self addInstruction: (Add add: anObject and: anObject2 to: aSymbol)
]
sub: anObject minus: anObject2 to: aSymbol [
self addInstruction: (Sub sub: anObject minus: anObject2 to: aSymbol)
]
mul: anObject by: anObject2 to: aSymbol [
self addInstruction: (Mul mul: anObject by: anObject2 to: aSymbol)
]
div: anObject by: anObject2 to: aSymbol [
self addInstruction: (Div div: anObject by: anObject2 to: aSymbol)
]
mod: anObject with: anObject2 to: aSymbol [
self addInstruction: (Mod mod: anObject with: anObject2 to: aSymbol)
]
and: anObject with: anObject2 to: aSymbol [
self addInstruction: (And and: anObject with: anObject2 to: aSymbol)
]
or: anObject with: anObject2 to: aSymbol [
self addInstruction: (Or or: anObject with: anObject2 to: aSymbol)
]
xor: anObject with: anObject2 to: aSymbol [
self addInstruction: (Xor xor: anObject with: anObject2 to: aSymbol)
]
lsh: anObject with: anObject2 to: aSymbol [
self addInstruction: (Lsh lsh: anObject with: anObject2 to: aSymbol)
]
rsh: anObject with: anObject2 to: aSymbol [
self addInstruction: (Rsh rsh: anObject with: anObject2 to: aSymbol)
]
load: aType from: anObject to: aSymbol [
self addInstruction: (Load load: aType from: anObject to: aSymbol)
]
store: aType value: anObject to: anObject2 [
self addInstruction: (Store store: aType value: anObject to: anObject2)
]
alloca: aType [
self addInstruction: (Alloca type: aType)
]
alloca: aType number: anObject [
self addInstruction: (Alloca type: aType number: anObject)
]
alloca: aType align: anObject [
self addInstruction: (Alloca type: aType align: anObject)
]
alloca: aType number: anObject align: anObject2 [
self addInstruction: (Alloca type: aType number: anObject align: anObject2)
]
cCall: aSymbol with: anArray [
]
call: aSymbol with: anArray [
]
ret [
self addInstruction: (Ret new)
]
ret: anObject [
self addInstruction: (Ret value: anObject)
]
]