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
15
namespace
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,
28
SYM_TABLE_START
= 0x01,
29
VAL_TABLE_START
= 0x02,
30
NUMBER_TYPE
= 0x01,
31
STRING_TYPE
= 0x02,
32
FUNC_TYPE
= 0x03,
33
CODE_SEGMENT_START
= 0x03,
34
35
FIRST_COMMAND
= 0x01,
36
LOAD_SYMBOL
= 0x01,
37
LOAD_CONST
= 0x02,
38
POP_JUMP_IF_TRUE
= 0x03,
39
STORE
= 0x04,
40
LET
= 0x05,
41
POP_JUMP_IF_FALSE
= 0x06,
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,
56
APPEND_IN_PLACE
= 0x15,
57
CONCAT_IN_PLACE
= 0x16,
58
POP_LIST
= 0x17,
59
POP_LIST_IN_PLACE
= 0x18,
60
POP
= 0x19,
61
LAST_COMMAND
= 0x19,
62
63
FIRST_OPERATOR
= 0x20,
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,
89
LAST_OPERATOR
= 0x38,
90
91
LAST_INSTRUCTION
= 0x38
92
};
93
}
94
95
#endif
Ark::internal
Definition:
Builtins.hpp:26
Ark::internal::Instruction
Instruction
The different bytecodes are stored here.
Definition:
Instructions.hpp:26
Ark::internal::FIRST_COMMAND
@ FIRST_COMMAND
Definition:
Instructions.hpp:35
Ark::internal::POP
@ POP
Definition:
Instructions.hpp:60
Ark::internal::TYPE
@ TYPE
Definition:
Instructions.hpp:86
Ark::internal::CODE_SEGMENT_START
@ CODE_SEGMENT_START
Definition:
Instructions.hpp:33
Ark::internal::CALL
@ CALL
Definition:
Instructions.hpp:45
Ark::internal::POP_JUMP_IF_FALSE
@ POP_JUMP_IF_FALSE
Definition:
Instructions.hpp:41
Ark::internal::LIST
@ LIST
Definition:
Instructions.hpp:53
Ark::internal::AND_
@ AND_
Definition:
Instructions.hpp:83
Ark::internal::EQ
@ EQ
Definition:
Instructions.hpp:73
Ark::internal::POP_LIST
@ POP_LIST
Definition:
Instructions.hpp:58
Ark::internal::SYM_TABLE_START
@ SYM_TABLE_START
Definition:
Instructions.hpp:28
Ark::internal::HALT
@ HALT
Definition:
Instructions.hpp:44
Ark::internal::MUT
@ MUT
Definition:
Instructions.hpp:48
Ark::internal::APPEND
@ APPEND
Definition:
Instructions.hpp:54
Ark::internal::BUILTIN
@ BUILTIN
Definition:
Instructions.hpp:47
Ark::internal::EMPTY
@ EMPTY
Definition:
Instructions.hpp:75
Ark::internal::LOAD_CONST
@ LOAD_CONST
Definition:
Instructions.hpp:37
Ark::internal::GT
@ GT
Definition:
Instructions.hpp:68
Ark::internal::NEQ
@ NEQ
Definition:
Instructions.hpp:72
Ark::internal::ISNIL
@ ISNIL
Definition:
Instructions.hpp:78
Ark::internal::ADD
@ ADD
Definition:
Instructions.hpp:64
Ark::internal::LAST_COMMAND
@ LAST_COMMAND
Definition:
Instructions.hpp:61
Ark::internal::LOAD_SYMBOL
@ LOAD_SYMBOL
Definition:
Instructions.hpp:36
Ark::internal::NOT
@ NOT
Definition:
Instructions.hpp:88
Ark::internal::TO_NUM
@ TO_NUM
Definition:
Instructions.hpp:80
Ark::internal::LE
@ LE
Definition:
Instructions.hpp:70
Ark::internal::FUNC_TYPE
@ FUNC_TYPE
Definition:
Instructions.hpp:32
Ark::internal::SAVE_ENV
@ SAVE_ENV
Definition:
Instructions.hpp:50
Ark::internal::CAPTURE
@ CAPTURE
Definition:
Instructions.hpp:46
Ark::internal::LET
@ LET
Definition:
Instructions.hpp:40
Ark::internal::OR_
@ OR_
Definition:
Instructions.hpp:84
Ark::internal::MUL
@ MUL
Definition:
Instructions.hpp:66
Ark::internal::APPEND_IN_PLACE
@ APPEND_IN_PLACE
Definition:
Instructions.hpp:56
Ark::internal::CONCAT
@ CONCAT
Definition:
Instructions.hpp:55
Ark::internal::SUB
@ SUB
Definition:
Instructions.hpp:65
Ark::internal::NOP
@ NOP
Definition:
Instructions.hpp:27
Ark::internal::STRING_TYPE
@ STRING_TYPE
Definition:
Instructions.hpp:31
Ark::internal::DIV
@ DIV
Definition:
Instructions.hpp:67
Ark::internal::GET_FIELD
@ GET_FIELD
Definition:
Instructions.hpp:51
Ark::internal::ASSERT
@ ASSERT
Definition:
Instructions.hpp:79
Ark::internal::AT
@ AT
Definition:
Instructions.hpp:82
Ark::internal::DEL
@ DEL
Definition:
Instructions.hpp:49
Ark::internal::LT
@ LT
Definition:
Instructions.hpp:69
Ark::internal::HEAD
@ HEAD
Definition:
Instructions.hpp:77
Ark::internal::CONCAT_IN_PLACE
@ CONCAT_IN_PLACE
Definition:
Instructions.hpp:57
Ark::internal::JUMP
@ JUMP
Definition:
Instructions.hpp:42
Ark::internal::TAIL
@ TAIL
Definition:
Instructions.hpp:76
Ark::internal::LAST_OPERATOR
@ LAST_OPERATOR
Definition:
Instructions.hpp:89
Ark::internal::TO_STR
@ TO_STR
Definition:
Instructions.hpp:81
Ark::internal::NUMBER_TYPE
@ NUMBER_TYPE
Definition:
Instructions.hpp:30
Ark::internal::MOD
@ MOD
Definition:
Instructions.hpp:85
Ark::internal::VAL_TABLE_START
@ VAL_TABLE_START
Definition:
Instructions.hpp:29
Ark::internal::GE
@ GE
Definition:
Instructions.hpp:71
Ark::internal::POP_LIST_IN_PLACE
@ POP_LIST_IN_PLACE
Definition:
Instructions.hpp:59
Ark::internal::FIRST_OPERATOR
@ FIRST_OPERATOR
Definition:
Instructions.hpp:63
Ark::internal::STORE
@ STORE
Definition:
Instructions.hpp:39
Ark::internal::HASFIELD
@ HASFIELD
Definition:
Instructions.hpp:87
Ark::internal::LAST_INSTRUCTION
@ LAST_INSTRUCTION
Definition:
Instructions.hpp:91
Ark::internal::POP_JUMP_IF_TRUE
@ POP_JUMP_IF_TRUE
Definition:
Instructions.hpp:38
Ark::internal::RET
@ RET
Definition:
Instructions.hpp:43
Ark::internal::LEN
@ LEN
Definition:
Instructions.hpp:74
Ark::internal::PLUGIN
@ PLUGIN
Definition:
Instructions.hpp:52
include
Ark
Compiler
Instructions.hpp
Generated on Sat May 25 2024 22:44:26 for ArkScript by
1.9.6