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-2021
9
*
10
*/
11
12
#ifndef ARK_COMPILER_INSTRUCTIONS_HPP
13
#define ARK_COMPILER_INSTRUCTIONS_HPP
14
15
#include <cinttypes>
16
17
namespace
Ark::internal
18
{
19
/**
20
* @brief The different bytecodes are stored here
21
* @par Adding an operator
22
* It must be referenced as well under include/Ark/Compiler/Common.hpp, in
23
* the operators table. The order of the operators below <code>FIRST_OPERATOR</code>
24
* must be the same as the one in the operators table from the aforementioned file.
25
*
26
*/
27
enum
Instruction
: uint8_t
28
{
29
NOP
= 0x00,
30
SYM_TABLE_START
= 0x01,
31
VAL_TABLE_START
= 0x02,
32
NUMBER_TYPE
= 0x01,
33
STRING_TYPE
= 0x02,
34
FUNC_TYPE
= 0x03,
35
CODE_SEGMENT_START
= 0x03,
36
37
FIRST_COMMAND
= 0x01,
38
LOAD_SYMBOL
= 0x01,
39
LOAD_CONST
= 0x02,
40
POP_JUMP_IF_TRUE
= 0x03,
41
STORE
= 0x04,
42
LET
= 0x05,
43
POP_JUMP_IF_FALSE
= 0x06,
44
JUMP
= 0x07,
45
RET
= 0x08,
46
HALT
= 0x09,
47
CALL
= 0x0a,
48
CAPTURE
= 0x0b,
49
BUILTIN
= 0x0c,
50
MUT
= 0x0d,
51
DEL
= 0x0e,
52
SAVE_ENV
= 0x0f,
53
GET_FIELD
= 0x10,
54
PLUGIN
= 0x11,
55
LIST
= 0x12,
56
APPEND
= 0x13,
57
CONCAT
= 0x14,
58
APPEND_IN_PLACE
= 0x15,
59
CONCAT_IN_PLACE
= 0x16,
60
POP_LIST
= 0x17,
61
POP_LIST_IN_PLACE
= 0x18,
62
POP
= 0x19,
63
LAST_COMMAND
= 0x19,
64
65
FIRST_OPERATOR
= 0x20,
66
ADD
= 0x20,
67
SUB
= 0x21,
68
MUL
= 0x22,
69
DIV
= 0x23,
70
GT
= 0x24,
71
LT
= 0x25,
72
LE
= 0x26,
73
GE
= 0x27,
74
NEQ
= 0x28,
75
EQ
= 0x29,
76
LEN
= 0x2a,
77
EMPTY
= 0x2b,
78
TAIL
= 0x2c,
79
HEAD
= 0x2d,
80
ISNIL
= 0x2e,
81
ASSERT
= 0x2f,
82
TO_NUM
= 0x30,
83
TO_STR
= 0x31,
84
AT
= 0x32,
85
AND_
= 0x33,
86
OR_
= 0x34,
87
MOD
= 0x35,
88
TYPE
= 0x36,
89
HASFIELD
= 0x37,
90
NOT
= 0x38,
91
LAST_OPERATOR
= 0x38,
92
93
LAST_INSTRUCTION
= 0x38
94
};
95
}
96
97
#endif
Ark::internal
Definition:
Builtins.hpp:26
Ark::internal::Instruction
Instruction
The different bytecodes are stored here.
Definition:
Instructions.hpp:28
Ark::internal::FIRST_COMMAND
@ FIRST_COMMAND
Definition:
Instructions.hpp:37
Ark::internal::POP
@ POP
Definition:
Instructions.hpp:62
Ark::internal::TYPE
@ TYPE
Definition:
Instructions.hpp:88
Ark::internal::CODE_SEGMENT_START
@ CODE_SEGMENT_START
Definition:
Instructions.hpp:35
Ark::internal::CALL
@ CALL
Definition:
Instructions.hpp:47
Ark::internal::POP_JUMP_IF_FALSE
@ POP_JUMP_IF_FALSE
Definition:
Instructions.hpp:43
Ark::internal::LIST
@ LIST
Definition:
Instructions.hpp:55
Ark::internal::AND_
@ AND_
Definition:
Instructions.hpp:85
Ark::internal::EQ
@ EQ
Definition:
Instructions.hpp:75
Ark::internal::POP_LIST
@ POP_LIST
Definition:
Instructions.hpp:60
Ark::internal::SYM_TABLE_START
@ SYM_TABLE_START
Definition:
Instructions.hpp:30
Ark::internal::HALT
@ HALT
Definition:
Instructions.hpp:46
Ark::internal::MUT
@ MUT
Definition:
Instructions.hpp:50
Ark::internal::APPEND
@ APPEND
Definition:
Instructions.hpp:56
Ark::internal::BUILTIN
@ BUILTIN
Definition:
Instructions.hpp:49
Ark::internal::EMPTY
@ EMPTY
Definition:
Instructions.hpp:77
Ark::internal::LOAD_CONST
@ LOAD_CONST
Definition:
Instructions.hpp:39
Ark::internal::GT
@ GT
Definition:
Instructions.hpp:70
Ark::internal::NEQ
@ NEQ
Definition:
Instructions.hpp:74
Ark::internal::ISNIL
@ ISNIL
Definition:
Instructions.hpp:80
Ark::internal::ADD
@ ADD
Definition:
Instructions.hpp:66
Ark::internal::LAST_COMMAND
@ LAST_COMMAND
Definition:
Instructions.hpp:63
Ark::internal::LOAD_SYMBOL
@ LOAD_SYMBOL
Definition:
Instructions.hpp:38
Ark::internal::NOT
@ NOT
Definition:
Instructions.hpp:90
Ark::internal::TO_NUM
@ TO_NUM
Definition:
Instructions.hpp:82
Ark::internal::LE
@ LE
Definition:
Instructions.hpp:72
Ark::internal::FUNC_TYPE
@ FUNC_TYPE
Definition:
Instructions.hpp:34
Ark::internal::SAVE_ENV
@ SAVE_ENV
Definition:
Instructions.hpp:52
Ark::internal::CAPTURE
@ CAPTURE
Definition:
Instructions.hpp:48
Ark::internal::LET
@ LET
Definition:
Instructions.hpp:42
Ark::internal::OR_
@ OR_
Definition:
Instructions.hpp:86
Ark::internal::MUL
@ MUL
Definition:
Instructions.hpp:68
Ark::internal::APPEND_IN_PLACE
@ APPEND_IN_PLACE
Definition:
Instructions.hpp:58
Ark::internal::CONCAT
@ CONCAT
Definition:
Instructions.hpp:57
Ark::internal::SUB
@ SUB
Definition:
Instructions.hpp:67
Ark::internal::NOP
@ NOP
Definition:
Instructions.hpp:29
Ark::internal::STRING_TYPE
@ STRING_TYPE
Definition:
Instructions.hpp:33
Ark::internal::DIV
@ DIV
Definition:
Instructions.hpp:69
Ark::internal::GET_FIELD
@ GET_FIELD
Definition:
Instructions.hpp:53
Ark::internal::ASSERT
@ ASSERT
Definition:
Instructions.hpp:81
Ark::internal::AT
@ AT
Definition:
Instructions.hpp:84
Ark::internal::DEL
@ DEL
Definition:
Instructions.hpp:51
Ark::internal::LT
@ LT
Definition:
Instructions.hpp:71
Ark::internal::HEAD
@ HEAD
Definition:
Instructions.hpp:79
Ark::internal::CONCAT_IN_PLACE
@ CONCAT_IN_PLACE
Definition:
Instructions.hpp:59
Ark::internal::JUMP
@ JUMP
Definition:
Instructions.hpp:44
Ark::internal::TAIL
@ TAIL
Definition:
Instructions.hpp:78
Ark::internal::LAST_OPERATOR
@ LAST_OPERATOR
Definition:
Instructions.hpp:91
Ark::internal::TO_STR
@ TO_STR
Definition:
Instructions.hpp:83
Ark::internal::NUMBER_TYPE
@ NUMBER_TYPE
Definition:
Instructions.hpp:32
Ark::internal::MOD
@ MOD
Definition:
Instructions.hpp:87
Ark::internal::VAL_TABLE_START
@ VAL_TABLE_START
Definition:
Instructions.hpp:31
Ark::internal::GE
@ GE
Definition:
Instructions.hpp:73
Ark::internal::POP_LIST_IN_PLACE
@ POP_LIST_IN_PLACE
Definition:
Instructions.hpp:61
Ark::internal::FIRST_OPERATOR
@ FIRST_OPERATOR
Definition:
Instructions.hpp:65
Ark::internal::STORE
@ STORE
Definition:
Instructions.hpp:41
Ark::internal::HASFIELD
@ HASFIELD
Definition:
Instructions.hpp:89
Ark::internal::LAST_INSTRUCTION
@ LAST_INSTRUCTION
Definition:
Instructions.hpp:93
Ark::internal::POP_JUMP_IF_TRUE
@ POP_JUMP_IF_TRUE
Definition:
Instructions.hpp:40
Ark::internal::RET
@ RET
Definition:
Instructions.hpp:45
Ark::internal::LEN
@ LEN
Definition:
Instructions.hpp:76
Ark::internal::PLUGIN
@ PLUGIN
Definition:
Instructions.hpp:54
include
Ark
Compiler
Instructions.hpp
Generated on Sun Apr 23 2023 20:17:28 for ArkScript by
1.9.6