ArkScript
A small, fast, functional and scripting language for video games
Instructions.hpp
Go to the documentation of this file.
1/**
2 * @file Instructions.hpp
3 * @author Alexandre Plateau ([email protected])
4 * @brief The different instructions used by the compiler and virtual machine
5 * @version 0.1
6 * @date 2020-10-27
7 *
8 * @copyright Copyright (c) 2020-2024
9 *
10 */
11
12#ifndef ARK_COMPILER_INSTRUCTIONS_HPP
13#define ARK_COMPILER_INSTRUCTIONS_HPP
14
15namespace Ark::internal
16{
17 /**
18 * @brief The different bytecodes are stored here
19 * @par Adding an operator
20 * It must be referenced as well under include/Ark/Compiler/Common.hpp, in
21 * the operators table. The order of the operators below <code>FIRST_OPERATOR</code>
22 * must be the same as the one in the operators table from the aforementioned file.
23 *
24 */
25 enum Instruction : uint8_t
26 {
27 NOP = 0x00,
32 FUNC_TYPE = 0x03,
34
37 LOAD_CONST = 0x02,
39 STORE = 0x04,
40 LET = 0x05,
42 JUMP = 0x07,
43 RET = 0x08,
44 HALT = 0x09,
45 CALL = 0x0a,
46 CAPTURE = 0x0b,
47 BUILTIN = 0x0c,
48 MUT = 0x0d,
49 DEL = 0x0e,
50 SAVE_ENV = 0x0f,
51 GET_FIELD = 0x10,
52 PLUGIN = 0x11,
53 LIST = 0x12,
54 APPEND = 0x13,
55 CONCAT = 0x14,
58 POP_LIST = 0x17,
60 POP = 0x19,
62
64 ADD = 0x20,
65 SUB = 0x21,
66 MUL = 0x22,
67 DIV = 0x23,
68 GT = 0x24,
69 LT = 0x25,
70 LE = 0x26,
71 GE = 0x27,
72 NEQ = 0x28,
73 EQ = 0x29,
74 LEN = 0x2a,
75 EMPTY = 0x2b,
76 TAIL = 0x2c,
77 HEAD = 0x2d,
78 ISNIL = 0x2e,
79 ASSERT = 0x2f,
80 TO_NUM = 0x30,
81 TO_STR = 0x31,
82 AT = 0x32,
83 AND_ = 0x33,
84 OR_ = 0x34,
85 MOD = 0x35,
86 TYPE = 0x36,
87 HASFIELD = 0x37,
88 NOT = 0x38,
90
91 LAST_INSTRUCTION = 0x38
92 };
93}
94
95#endif
Instruction
The different bytecodes are stored here.