ArkScript
A small, lisp-inspired, functional scripting language
Instructions.hpp
Go to the documentation of this file.
1
/**
2
* @file Instructions.hpp
3
* @author Lexy Plateau (lexplt.dev@gmail.com)
4
* @brief The different instructions used by the compiler and virtual machine
5
* @date 2020-10-27
6
*
7
* @copyright Copyright (c) 2020-2026
8
*
9
*/
10
11
#ifndef ARK_COMPILER_INSTRUCTIONS_HPP
12
#define ARK_COMPILER_INSTRUCTIONS_HPP
13
14
#include <array>
15
16
namespace
Ark::internal
17
{
18
/**
19
* @brief The different bytecodes are stored here
20
* @par Adding an operator
21
* It must be referenced as well under include/Ark/Compiler/Common.hpp, in
22
* the operators table. The order of the operators below <code>FIRST_OPERATOR</code>
23
* must be the same as the one in the operators table from the aforementioned file.
24
*
25
*/
26
enum
Instruction
: uint8_t
27
{
28
SYM_TABLE_START
= 0xA1,
29
VAL_TABLE_START
= 0xA2,
30
CODE_SEGMENT_START
= 0xA3,
31
NUMBER_TYPE
= 0xF1,
32
STRING_TYPE
= 0xF2,
33
FUNC_TYPE
= 0xF3,
34
FILENAMES_TABLE_START
= 0xA4,
35
INST_LOC_TABLE_START
= 0xA5,
36
37
#define X(name, value) name = (value),
38
#include "Instructions.x"
39
40
#undef X
41
42
InstructionsCount
43
};
44
45
constexpr
uint8_t
FirstOperator
= Instruction::BREAKPOINT;
46
47
constexpr
std::array
InstructionNames
= {
48
#define X(name, value) #name,
49
#include "Instructions.x"
50
51
#undef X
52
};
53
54
static_assert
(
InstructionNames
.size() ==
static_cast<
std::size_t
>
(Instruction::InstructionsCount) &&
"Some instruction names appear to be missing"
);
55
}
56
57
#endif
Ark::internal
Definition
Builtins.hpp:26
Ark::internal::FirstOperator
constexpr uint8_t FirstOperator
Definition
Instructions.hpp:45
Ark::internal::Instruction
Instruction
The different bytecodes are stored here.
Definition
Instructions.hpp:27
Ark::internal::CODE_SEGMENT_START
@ CODE_SEGMENT_START
Definition
Instructions.hpp:30
Ark::internal::SYM_TABLE_START
@ SYM_TABLE_START
Definition
Instructions.hpp:28
Ark::internal::FUNC_TYPE
@ FUNC_TYPE
Definition
Instructions.hpp:33
Ark::internal::STRING_TYPE
@ STRING_TYPE
Definition
Instructions.hpp:32
Ark::internal::FILENAMES_TABLE_START
@ FILENAMES_TABLE_START
Definition
Instructions.hpp:34
Ark::internal::INST_LOC_TABLE_START
@ INST_LOC_TABLE_START
Definition
Instructions.hpp:35
Ark::internal::NUMBER_TYPE
@ NUMBER_TYPE
Definition
Instructions.hpp:31
Ark::internal::VAL_TABLE_START
@ VAL_TABLE_START
Definition
Instructions.hpp:29
Ark::internal::InstructionNames
constexpr std::array InstructionNames
Definition
Instructions.hpp:47
include
Ark
Compiler
Instructions.hpp
Generated on Sat Aug 29 2026 18:10:55 for ArkScript by
1.12.0