You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,7 @@
41
41
-`STORE_FROM_INDEX` and `SET_VAL_FROM_INDEX` instructions for parity with the super instructions not using load by index
42
42
-`INCREMENT_BY_INDEX` and `DECREMENT_BY_INDEX` instructions for parity with the super instructions not using load by index
43
43
-`STORE_TAIL_BY_INDEX`, `STORE_HEAD_BY_INDEX`, `SET_VAL_TAIL_BY_INDEX`, `SET_VAL_HEAD_BY_INDEX` super instructions added for parity with the super instructions not using load by index
44
+
-`RESET_SCOPE` instruction emitted at the end of a while loop to reset a scope so that we can create multiple variables and use `LOAD_SYMBOL_BY_INDEX`
44
45
45
46
### Changed
46
47
- instructions are on 4 bytes: 1 byte for the instruction, 1 byte of padding, 2 bytes for an immediate argument
Copy file name to clipboardExpand all lines: include/Ark/Compiler/Instructions.hpp
+50-46Lines changed: 50 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -142,162 +142,165 @@ namespace Ark::internal
142
142
// @role Create a new local scope
143
143
CREATE_SCOPE = 0x1d,
144
144
145
+
// @role Reset the current scope so that it is empty
146
+
RESET_SCOPE = 0x1e,
147
+
145
148
// @role Destroy the last local scope
146
-
POP_SCOPE = 0x1e,
149
+
POP_SCOPE = 0x1f,
147
150
148
-
FIRST_OPERATOR = 0x1f,
151
+
FIRST_OPERATOR = 0x20,
149
152
150
153
// @role Push #[code TS1 + TS]
151
-
ADD = 0x1f,
154
+
ADD = 0x20,
152
155
153
156
// @role Push #[code TS1 - TS]
154
-
SUB = 0x20,
157
+
SUB = 0x21,
155
158
156
159
// @role Push #[code TS1 * TS]
157
-
MUL = 0x21,
160
+
MUL = 0x22,
158
161
159
162
// @role Push #[code TS1 / TS]
160
-
DIV = 0x22,
163
+
DIV = 0x23,
161
164
162
165
// @role Push #[code TS1 > TS]
163
-
GT = 0x23,
166
+
GT = 0x24,
164
167
165
168
// @role Push #[code TS1 < TS]
166
-
LT = 0x24,
169
+
LT = 0x25,
167
170
168
171
// @role Push #[code TS1 <= TS]
169
-
LE = 0x25,
172
+
LE = 0x26,
170
173
171
174
// @role Push #[code TS1 >= TS]
172
-
GE = 0x26,
175
+
GE = 0x27,
173
176
174
177
// @role Push #[code TS1 != TS]
175
-
NEQ = 0x27,
178
+
NEQ = 0x28,
176
179
177
180
// @role Push #[code TS1 == TS]
178
-
EQ = 0x28,
181
+
EQ = 0x29,
179
182
180
183
// @role Push #[code len(TS)], TS must be a list
181
-
LEN = 0x29,
184
+
LEN = 0x2a,
182
185
183
186
// @role Push #[code empty?(TS)], TS must be a list or string
184
-
EMPTY = 0x2a,
187
+
EMPTY = 0x2b,
185
188
186
189
// @role Push #[code tail(TS)], all the elements of TS except the first one. TS must be a list or string
187
-
TAIL = 0x2b,
190
+
TAIL = 0x2c,
188
191
189
192
// @role Push #[code head(TS)], the first element of TS or nil if empty. TS must be a list or string
190
-
HEAD = 0x2c,
193
+
HEAD = 0x2d,
191
194
192
195
// @role Push true if TS is nil, false otherwise
193
-
ISNIL = 0x2d,
196
+
ISNIL = 0x2e,
194
197
195
198
// @role Throw an exception if TS1 is false, and display TS (must be a string). Do not push anything on the stack
196
-
ASSERT = 0x2e,
199
+
ASSERT = 0x2f,
197
200
198
201
// @role Convert TS to number (must be a string)
199
-
TO_NUM = 0x2f,
202
+
TO_NUM = 0x30,
200
203
201
204
// @role Convert TS to string
202
-
TO_STR = 0x30,
205
+
TO_STR = 0x31,
203
206
204
207
// @role Push the value at index TS (must be a number) in TS1, which must be a list or string
205
-
AT = 0x31,
208
+
AT = 0x32,
206
209
207
210
// @role Push the value at index TS (must be a number), inside the list or string at index TS1 (must be a number) in the list at TS2
208
-
AT_AT = 0x32,
211
+
AT_AT = 0x33,
209
212
210
213
// @role Push #[code TS1 % TS]
211
-
MOD = 0x33,
214
+
MOD = 0x34,
212
215
213
216
// @role Push the type of TS as a string
214
-
TYPE = 0x34,
217
+
TYPE = 0x35,
215
218
216
219
// @role Check if TS1 is a closure field of TS. TS must be a Closure, TS1 a String
217
-
HASFIELD = 0x35,
220
+
HASFIELD = 0x36,
218
221
219
222
// @role Push #[code !TS]
220
-
NOT = 0x36,
223
+
NOT = 0x37,
221
224
222
225
// @args constant id, constant id
223
226
// @role Load two consts (#[code primary] then #[code secondary]) on the stack in one instruction
224
-
LOAD_CONST_LOAD_CONST = 0x37,
227
+
LOAD_CONST_LOAD_CONST = 0x38,
225
228
226
229
// @args constant id, symbol id
227
230
// @role Load const #[code primary] into the symbol #[code secondary] (create a variable)
228
-
LOAD_CONST_STORE = 0x38,
231
+
LOAD_CONST_STORE = 0x39,
229
232
230
233
// @args constant id, symbol id
231
234
// @role Load const #[code primary] into the symbol #[code secondary] (search for the variable with the given symbol id)
232
-
LOAD_CONST_SET_VAL = 0x39,
235
+
LOAD_CONST_SET_VAL = 0x3a,
233
236
234
237
// @args symbol id, symbol id
235
238
// @role Store the value of the symbol #[code primary] into a new variable #[code secondary]
236
-
STORE_FROM = 0x3a,
239
+
STORE_FROM = 0x3b,
237
240
238
241
// @args symbol index, symbol id
239
242
// @role Store the value of the symbol #[code primary] into a new variable #[code secondary]
240
-
STORE_FROM_INDEX = 0x3b,
243
+
STORE_FROM_INDEX = 0x3c,
241
244
242
245
// @args symbol id, symbol id
243
246
// @role Store the value of the symbol #[code primary] into an existing variable #[code secondary]
244
-
SET_VAL_FROM = 0x3c,
247
+
SET_VAL_FROM = 0x3d,
245
248
246
249
// @args symbol index, symbol id
247
250
// @role Store the value of the symbol #[code primary] into an existing variable #[code secondary]
248
-
SET_VAL_FROM_INDEX = 0x3d,
251
+
SET_VAL_FROM_INDEX = 0x3e,
249
252
250
253
// @args symbol id, count
251
254
// @role Increment the variable #[code primary] by #[code count] and push its value on the stack
252
-
INCREMENT = 0x3e,
255
+
INCREMENT = 0x3f,
253
256
254
257
// @args symbol index, count
255
258
// @role Increment the variable #[code primary] by #[code count] and push its value on the stack
256
-
INCREMENT_BY_INDEX = 0x3f,
259
+
INCREMENT_BY_INDEX = 0x40,
257
260
258
261
// @args symbol id, count
259
262
// @role Decrement the variable #[code primary] by #[code count] and push its value on the stack
260
-
DECREMENT = 0x40,
263
+
DECREMENT = 0x41,
261
264
262
265
// @args symbol index, count
263
266
// @role Decrement the variable #[code primary] by #[code count] and push its value on the stack
264
-
DECREMENT_BY_INDEX = 0x41,
267
+
DECREMENT_BY_INDEX = 0x42,
265
268
266
269
// @args symbol id, symbol id
267
270
// @role Load the symbol #[code primary], compute its tail, store it in a new variable #[code secondary]
268
-
STORE_TAIL = 0x42,
271
+
STORE_TAIL = 0x43,
269
272
270
273
// @args symbol index, symbol id
271
274
// @role Load the symbol #[code primary], compute its tail, store it in a new variable #[code secondary]
272
-
STORE_TAIL_BY_INDEX = 0x43,
275
+
STORE_TAIL_BY_INDEX = 0x44,
273
276
274
277
// @args symbol id, symbol id
275
278
// @role Load the symbol #[code primary], compute its head, store it in a new variable #[code secondary]
276
-
STORE_HEAD = 0x44,
279
+
STORE_HEAD = 0x45,
277
280
278
281
// @args symbol index, symbol id
279
282
// @role Load the symbol #[code primary], compute its head, store it in a new variable #[code secondary]
280
-
STORE_HEAD_BY_INDEX = 0x45,
283
+
STORE_HEAD_BY_INDEX = 0x46,
281
284
282
285
// @args symbol id, symbol id
283
286
// @role Load the symbol #[code primary], compute its tail, store it in an existing variable #[code secondary]
284
-
SET_VAL_TAIL = 0x46,
287
+
SET_VAL_TAIL = 0x47,
285
288
286
289
// @args symbol index, symbol id
287
290
// @role Load the symbol #[code primary], compute its tail, store it in an existing variable #[code secondary]
288
-
SET_VAL_TAIL_BY_INDEX = 0x47,
291
+
SET_VAL_TAIL_BY_INDEX = 0x48,
289
292
290
293
// @args symbol id, symbol id
291
294
// @role Load the symbol #[code primary], compute its head, store it in an existing variable #[code secondary]
292
-
SET_VAL_HEAD = 0x48,
295
+
SET_VAL_HEAD = 0x49,
293
296
294
297
// @args symbol index, symbol id
295
298
// @role Load the symbol #[code primary], compute its head, store it in an existing variable #[code secondary]
296
-
SET_VAL_HEAD_BY_INDEX = 0x49,
299
+
SET_VAL_HEAD_BY_INDEX = 0x4a,
297
300
298
301
// @args builtin id, argument count
299
302
// @role Call a builtin by its id in #[code primary], with #[code secondary] arguments. Bypass the stack size check because we do not push IP/PP since builtins calls do not alter the stack
0 commit comments