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

Namespaces

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...
 
class  CompilationError
 CompilationError thrown by the compiler. More...
 
class  Compiler
 The ArkScript bytecode compiler. More...
 
class  JsonCompiler
 
class  MacroProcessingError
 MacroProcessingError thrown by the compiler. More...
 
struct  mapping
 
class  OptimizerError
 OptimizerError thrown by the AST optimizer. More...
 
class  ParseError
 ParseError thrown by the parser. More...
 
class  PowError
 A pow error triggered when we can't do a pow b. More...
 
class  Repl
 
class  State
 Ark state to handle the dirty job of loading and compiling ArkScript code. More...
 
class  SyntaxError
 SyntaxError thrown by the lexer. More...
 
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
 
class  VM
 The ArkScript virtual machine, executing ArkScript bytecode. 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

template<typename... Args>
std::string string_format (const std::string &format, Args &&... args)
 
bool operator== (const UserType &A, const UserType &B) noexcept
 
bool operator< (const UserType &A, const UserType &B) noexcept
 
std::ostream & operator<< (std::ostream &os, const UserType &A) noexcept
 

Variables

constexpr uint16_t FeatureRemoveUnusedVars = 1 << 4
 
constexpr uint16_t FeatureShowWarnings = 1 << 5
 
constexpr uint16_t DefaultFeatures = FeatureRemoveUnusedVars | FeatureShowWarnings
 
constexpr std::size_t VMStackSize = 8192
 
const std::vector< std::string > KeywordsDict
 
const std::vector< std::pair< std::string, Replxx::Color > > ColorsRegexDict
 
const std::array< std::string, 13 > types_to_str
 
const Value Nil = Value(ValueType::Nil)
 ArkScript Nil value.
 
const Value False = Value(ValueType::False)
 ArkScript False value.
 
const Value True = Value(ValueType::True)
 ArkScript True value.
 

Typedef Documentation

◆ bytecode_t

using Ark::bytecode_t = typedef 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 27 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 

Definition at line 38 of file Value.hpp.

Function Documentation

◆ operator<()

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

Definition at line 16 of file UserType.cpp.

◆ operator<<()

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

Definition at line 21 of file UserType.cpp.

◆ operator==()

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

Definition at line 11 of file UserType.cpp.

◆ string_format()

template<typename... Args>
std::string Ark::string_format ( const std::string &  format,
Args &&...  args 
)

Definition at line 34 of file JsonCompiler.cpp.

Referenced by Ark::JsonCompiler::_compile().

Variable Documentation

◆ ColorsRegexDict

const std::vector<std::pair<std::string, Replxx::Color> > Ark::ColorsRegexDict

Definition at line 58 of file ConsoleStyle.hpp.

Referenced by Ark::Repl::cui_setup().

◆ DefaultFeatures

constexpr uint16_t Ark::DefaultFeatures = FeatureRemoveUnusedVars | FeatureShowWarnings
constexpr

Definition at line 52 of file Constants.hpp.

Referenced by main().

◆ False

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

ArkScript False value.

Definition at line 341 of file VM.hpp.

◆ FeatureRemoveUnusedVars

constexpr uint16_t Ark::FeatureRemoveUnusedVars = 1 << 4
constexpr

Definition at line 48 of file Constants.hpp.

Referenced by Ark::internal::Optimizer::feed(), and main().

◆ FeatureShowWarnings

constexpr uint16_t Ark::FeatureShowWarnings = 1 << 5
constexpr

Definition at line 49 of file Constants.hpp.

Referenced by Ark::Compiler::compilerWarning().

◆ KeywordsDict

const std::vector<std::string> Ark::KeywordsDict

Definition at line 21 of file ConsoleStyle.hpp.

Referenced by Ark::Repl::cui_setup().

◆ Nil

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

ArkScript Nil value.

Definition at line 339 of file VM.hpp.

◆ True

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

ArkScript True value.

Definition at line 343 of file VM.hpp.

◆ types_to_str

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

Definition at line 58 of file Value.hpp.

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

◆ VMStackSize

constexpr std::size_t Ark::VMStackSize = 8192
constexpr

Definition at line 54 of file Constants.hpp.

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