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
16namespace 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 {
33 FUNC_TYPE = 0xF3,
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
constexpr uint8_t FirstOperator
Instruction
The different bytecodes are stored here.
constexpr std::array InstructionNames