ArkScript
A small, fast, functional and scripting language for video games
Constants.hpp
Go to the documentation of this file.
1/**
2 * @file Constants.hpp
3 * @author Alexandre Plateau ([email protected])
4 * @brief Constants used by ArkScript
5 * @date 2020-10-27
6 *
7 * @copyright Copyright (c) 2020-2025
8 *
9 */
10
11#ifndef INCLUDE_ARK_CONSTANTS_HPP_IN
12#define INCLUDE_ARK_CONSTANTS_HPP_IN
13
14#include <string_view>
15
16// clang-format off
17constexpr int ARK_VERSION_MAJOR = 4;
18constexpr int ARK_VERSION_MINOR = 0;
19constexpr int ARK_VERSION_PATCH = 0;
20// clang-format on
21constexpr std::string_view ARK_VERSION { "4.0.0" };
22constexpr std::string_view ARK_FULL_VERSION { "4.0.0-1ad14f4d" };
23
24#define ARK_COMPILER "AppleClang"
25#define ARK_CACHE_DIRNAME "__arkscript__"
26#define ARK_NO_NAME_FILE "FILE"
27
28#if defined(_WIN32) || defined(_WIN64)
29# define ARK_PLATFORM_NAME "Windows"
30#elif defined(__APPLE__) || defined(__MACH__)
31# define ARK_PLATFORM_NAME "Mac OSX"
32#elif defined(__linux__)
33# define ARK_PLATFORM_NAME "Linux"
34#elif defined(__FreeBSD__)
35# define ARK_PLATFORM_NAME "FreeBSD"
36#elif defined(__unix) || defined(__unix__)
37# define ARK_PLATFORM_NAME "Unix"
38#else
39# define ARK_PLATFORM_NAME "Other"
40#endif
41
42#include <cinttypes>
43#include <cstddef>
44
45namespace Ark
46{
47 // Compiler options
48 constexpr uint16_t FeatureImportSolver = 1 << 0;
49 constexpr uint16_t FeatureMacroProcessor = 1 << 1;
50 constexpr uint16_t FeatureASTOptimizer = 1 << 2; ///< This is disabled so that embedding ArkScript does not prune nodes from the AST ; it is active in the `arkscript` executable
51 constexpr uint16_t FeatureIROptimizer = 1 << 3;
52 constexpr uint16_t FeatureNameResolver = 1 << 4;
53
54 constexpr uint16_t FeatureDumpIR = 1 << 14;
55 /// This feature should only be used in tests, to disable diagnostics generation and enable exceptions to be thrown
56 constexpr uint16_t FeatureTestFailOnException = 1 << 15;
57
58 // Default features for the VM x Compiler x Parser
59 constexpr uint16_t DefaultFeatures =
64
65 constexpr std::size_t MaxNestedNodes = 1024; ///< Maximum number of nodes that can be nested while parsing code
66 constexpr std::size_t MaxMacroProcessingDepth = 256; ///< Controls the number of recursive calls to MacroProcessor::processNode
67 constexpr std::size_t MaxMacroUnificationDepth = 256; ///< Controls the number of recursive calls to MacroProcessor::unify
68 constexpr std::size_t VMStackSize = 4096;
69 constexpr std::size_t ScopeStackSize = 8192;
70}
71
72#endif
constexpr std::string_view ARK_VERSION
Definition Constants.hpp:21
constexpr int ARK_VERSION_MAJOR
Definition Constants.hpp:17
constexpr int ARK_VERSION_PATCH
Definition Constants.hpp:19
constexpr std::string_view ARK_FULL_VERSION
Definition Constants.hpp:22
constexpr int ARK_VERSION_MINOR
Definition Constants.hpp:18
constexpr uint16_t DefaultFeatures
Definition Constants.hpp:59
constexpr uint16_t FeatureImportSolver
Definition Constants.hpp:48
constexpr std::size_t VMStackSize
Definition Constants.hpp:68
constexpr uint16_t FeatureIROptimizer
Definition Constants.hpp:51
constexpr std::size_t MaxNestedNodes
Maximum number of nodes that can be nested while parsing code.
Definition Constants.hpp:65
constexpr uint16_t FeatureMacroProcessor
Definition Constants.hpp:49
constexpr std::size_t MaxMacroProcessingDepth
Controls the number of recursive calls to MacroProcessor::processNode.
Definition Constants.hpp:66
constexpr std::size_t ScopeStackSize
Definition Constants.hpp:69
constexpr uint16_t FeatureTestFailOnException
This feature should only be used in tests, to disable diagnostics generation and enable exceptions to...
Definition Constants.hpp:56
constexpr std::size_t MaxMacroUnificationDepth
Controls the number of recursive calls to MacroProcessor::unify.
Definition Constants.hpp:67
constexpr uint16_t FeatureASTOptimizer
This is disabled so that embedding ArkScript does not prune nodes from the AST ; it is active in the ...
Definition Constants.hpp:50
constexpr uint16_t FeatureDumpIR
Definition Constants.hpp:54
constexpr uint16_t FeatureNameResolver
Definition Constants.hpp:52