ArkScript
A small, fast, functional and scripting language for video games
Ark Namespace Reference

Namespaces

namespace  Diagnostics
 
namespace  helper
 
namespace  internal
 
namespace  literals
 
namespace  types
 
namespace  Utils
 

Classes

class  AssertionFailed
 An assertion error, only triggered from ArkScript code through (assert expr error-message) More...
 
class  BytecodeReader
 This class is just a helper to. More...
 
struct  Code
 
struct  CodeError
 CodeError thrown by the compiler (parser, macro processor, optimizer, and compiler itself) More...
 
class  Error
 
struct  mapping
 
class  Repl
 
class  State
 Ark state to handle the dirty job of loading and compiling ArkScript code. More...
 
struct  Symbols
 
class  TypeError
 A type error triggered when types don't match. More...
 
class  UserType
 A class to be use C++ objects in ArkScript. More...
 
class  Value
 
struct  Values
 
struct  Version
 
class  VM
 The ArkScript virtual machine, executing ArkScript bytecode. More...
 
class  Welder
 The welder joins all the compiler passes. More...
 
class  ZeroDivisionError
 A special zero division error triggered when a number is divided by 0. More...
 

Typedefs

using bytecode_t = std::vector<uint8_t>
 

Enumerations

enum class  BytecodeSegment {
  All , Symbols , Values , Code ,
  HeadersOnly
}
 
enum class  ValueType {
  List = 0 , Number = 1 , String = 2 , PageAddr = 3 ,
  CProc = 4 , Closure = 5 , User = 6 , Nil = 7 ,
  True = 8 , False = 9 , Undefined = 10 , Reference = 11 ,
  InstPtr = 12 , Any = 99
}
 

Functions

bool operator== (const Value &A, const Value &B)
 
bool operator< (const Value &A, const Value &B)
 
bool operator!= (const Value &A, const Value &B) noexcept
 
bool operator! (const Value &A)
 
bool operator== (const UserType &A, const UserType &B)
 
bool operator< (const UserType &A, const UserType &B)
 
std::ostream & operator<< (std::ostream &os, const UserType &A)
 

Variables

constexpr uint16_t FeatureImportSolver = 1 << 0
 
constexpr uint16_t FeatureMacroProcessor = 1 << 1
 
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.
 
constexpr uint16_t FeatureIROptimizer = 1 << 3
 
constexpr uint16_t FeatureNameResolver = 1 << 4
 
constexpr uint16_t FeatureDumpIR = 1 << 14
 
constexpr uint16_t FeatureTestFailOnException = 1 << 15
 This feature should only be used in tests, to disable diagnostics generation and enable exceptions to be thrown.
 
constexpr uint16_t DefaultFeatures
 
constexpr std::size_t MaxMacroProcessingDepth = 256
 Controls the number of recursive calls to MacroProcessor::processNode.
 
constexpr std::size_t MaxMacroUnificationDepth = 256
 Controls the number of recursive calls to MacroProcessor::unify.
 
constexpr std::size_t VMStackSize = 8192
 
constexpr std::array types_to_str
 
const auto Nil = Value(ValueType::Nil)
 ArkScript Nil value.
 
const auto False = Value(ValueType::False)
 ArkScript False value.
 
const auto True = Value(ValueType::True)
 ArkScript True value.
 

Typedef Documentation

◆ bytecode_t

using Ark::bytecode_t = std::vector<uint8_t>

Definition at line 22 of file Common.hpp.

Enumeration Type Documentation

◆ BytecodeSegment

enum class Ark::BytecodeSegment
strong
Enumerator
All 
Symbols 
Values 
Code 
HeadersOnly 

Definition at line 28 of file BytecodeReader.hpp.

◆ ValueType

enum class Ark::ValueType
strong
Enumerator
List 
Number 
String 
PageAddr 
CProc 
Closure 
User 
Nil 
True 
False 
Undefined 
Reference 
InstPtr 
Any 

Used only for typechecking.

Definition at line 32 of file Value.hpp.

Function Documentation

◆ operator!()

bool Ark::operator! ( const Value & A)
inlinenoexcept

Definition at line 193 of file Value.hpp.

◆ operator!=()

bool Ark::operator!= ( const Value & A,
const Value & B )
inlinenoexcept

Definition at line 188 of file Value.hpp.

◆ operator<() [1/2]

bool Ark::operator< ( const UserType & A,
const UserType & B )
noexcept

Definition at line 16 of file UserType.cpp.

◆ operator<() [2/2]

bool Ark::operator< ( const Value & A,
const Value & B )
inlinenoexcept

Definition at line 181 of file Value.hpp.

◆ operator<<()

std::ostream & Ark::operator<< ( std::ostream & os,
const UserType & A )
noexcept

Definition at line 21 of file UserType.cpp.

◆ operator==() [1/2]

bool Ark::operator== ( const UserType & A,
const UserType & B )
noexcept

Definition at line 11 of file UserType.cpp.

◆ operator==() [2/2]

bool Ark::operator== ( const Value & A,
const Value & B )
inlinenoexcept

Definition at line 169 of file Value.hpp.

Variable Documentation

◆ DefaultFeatures

uint16_t Ark::DefaultFeatures
constexpr
Initial value:
=
constexpr uint16_t FeatureImportSolver
Definition Constants.hpp:49
constexpr uint16_t FeatureIROptimizer
Definition Constants.hpp:52
constexpr uint16_t FeatureMacroProcessor
Definition Constants.hpp:50
constexpr uint16_t FeatureNameResolver
Definition Constants.hpp:53

Definition at line 60 of file Constants.hpp.

Referenced by main().

◆ False

const auto Ark::False = Value(ValueType::False)

ArkScript False value.

Definition at line 333 of file VM.hpp.

◆ FeatureASTOptimizer

uint16_t Ark::FeatureASTOptimizer = 1 << 2
constexpr

This is disabled so that embedding ArkScript does not prune nodes from the AST ; it is active in the arkscript executable.

Definition at line 51 of file Constants.hpp.

Referenced by Ark::Welder::computeAST(), and main().

◆ FeatureDumpIR

uint16_t Ark::FeatureDumpIR = 1 << 14
constexpr

Definition at line 55 of file Constants.hpp.

Referenced by Ark::Welder::generateBytecode(), and main().

◆ FeatureImportSolver

uint16_t Ark::FeatureImportSolver = 1 << 0
constexpr

Definition at line 49 of file Constants.hpp.

Referenced by Ark::Welder::computeAST(), and main().

◆ FeatureIROptimizer

uint16_t Ark::FeatureIROptimizer = 1 << 3
constexpr

Definition at line 52 of file Constants.hpp.

Referenced by Ark::Welder::generateBytecode(), and main().

◆ FeatureMacroProcessor

uint16_t Ark::FeatureMacroProcessor = 1 << 1
constexpr

Definition at line 50 of file Constants.hpp.

Referenced by Ark::Welder::computeAST(), and main().

◆ FeatureNameResolver

uint16_t Ark::FeatureNameResolver = 1 << 4
constexpr

Definition at line 53 of file Constants.hpp.

Referenced by Ark::Welder::computeAST().

◆ FeatureTestFailOnException

uint16_t Ark::FeatureTestFailOnException = 1 << 15
constexpr

This feature should only be used in tests, to disable diagnostics generation and enable exceptions to be thrown.

Definition at line 57 of file Constants.hpp.

Referenced by Ark::Welder::computeAST(), and Ark::Welder::generateBytecode().

◆ MaxMacroProcessingDepth

std::size_t Ark::MaxMacroProcessingDepth = 256
constexpr

Controls the number of recursive calls to MacroProcessor::processNode.

Definition at line 66 of file Constants.hpp.

Referenced by Ark::internal::MacroProcessor::applyMacro(), and Ark::internal::MacroProcessor::processNode().

◆ MaxMacroUnificationDepth

std::size_t Ark::MaxMacroUnificationDepth = 256
constexpr

Controls the number of recursive calls to MacroProcessor::unify.

Definition at line 67 of file Constants.hpp.

Referenced by Ark::internal::FunctionExecutor::unify().

◆ Nil

const auto Ark::Nil = Value(ValueType::Nil)

ArkScript Nil value.

Definition at line 331 of file VM.hpp.

Referenced by Ark::internal::Future::resolve().

◆ True

const auto Ark::True = Value(ValueType::True)

ArkScript True value.

Definition at line 335 of file VM.hpp.

◆ types_to_str

std::array Ark::types_to_str
constexpr
Initial value:
= {
"List", "Number", "String", "Function",
"CProc", "Closure", "UserType", "Nil",
"Bool", "Bool", "Undefined", "Reference",
"InstPtr"
}

Definition at line 52 of file Value.hpp.

Referenced by Ark::BytecodeReader::display(), Ark::types::displayContract(), Ark::VM::safeRun(), and Ark::types::typeListToString().

◆ VMStackSize

std::size_t Ark::VMStackSize = 8192
constexpr

Definition at line 68 of file Constants.hpp.

Referenced by Ark::VM::safeRun().