mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 18:16:31 +00:00
71 lines
1.3 KiB
C++
71 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
namespace sliger {
|
|
|
|
// NOTICE: keep up to date with src/arch.ts
|
|
|
|
enum class Op : uint32_t {
|
|
Nop = 0x00,
|
|
PushNull = 0x01,
|
|
PushInt = 0x02,
|
|
PushBool = 0x03,
|
|
PushString = 0x04,
|
|
PushPtr = 0x05,
|
|
Pop = 0x06,
|
|
ReserveStatic = 0x07,
|
|
LoadStatic = 0x08,
|
|
StoreStatic = 0x09,
|
|
LoadLocal = 0x0a,
|
|
StoreLocal = 0x0b,
|
|
Call = 0x0c,
|
|
Return = 0x0d,
|
|
Jump = 0x0e,
|
|
JumpIfTrue = 0x0f,
|
|
Builtin = 0x10,
|
|
Duplicate = 0x11,
|
|
Swap = 0x12,
|
|
Add = 0x20,
|
|
Subtract = 0x21,
|
|
Multiply = 0x22,
|
|
Divide = 0x23,
|
|
Remainder = 0x24,
|
|
Equal = 0x25,
|
|
LessThan = 0x26,
|
|
And = 0x27,
|
|
Or = 0x28,
|
|
Xor = 0x29,
|
|
Not = 0x2a,
|
|
SourceMap = 0x30,
|
|
};
|
|
|
|
enum class Builtin : uint32_t {
|
|
Exit = 0x00,
|
|
IntToString = 0x01,
|
|
StringConcat = 0x10,
|
|
StringEqual = 0x11,
|
|
StringCharAt = 0x12,
|
|
StringLength = 0x13,
|
|
StringPushChar = 0x14,
|
|
StringToInt = 0x15,
|
|
ArrayNew = 0x20,
|
|
ArraySet = 0x21,
|
|
ArrayPush = 0x22,
|
|
ArrayAt = 0x23,
|
|
ArrayLength = 0x24,
|
|
StructNew = 0x30,
|
|
StructSet = 0x31,
|
|
StructAt = 0x32,
|
|
Print = 0x40,
|
|
FileOpen = 0x41,
|
|
FileClose = 0x42,
|
|
FileWriteString = 0x43,
|
|
FileReadChar = 0x44,
|
|
FileReadToString = 0x45,
|
|
FileFlush = 0x46,
|
|
FileEof = 0x47,
|
|
};
|
|
|
|
}
|