![]() |
ArkScript
A small, fast, functional and scripting language for video games
|
Namespaces | |
namespace | Builtins |
namespace | bytecode |
namespace | ieee754 |
namespace | IR |
namespace | Language |
Classes | |
class | ASTLowerer |
The ArkScript AST to IR compiler. More... | |
class | BaseParser |
struct | CharPred |
class | Closure |
Closure management. More... | |
class | ClosureScope |
A class to store fields captured by a closure. More... | |
class | ConditionalExecutor |
Handles Conditional macros. More... | |
struct | Declaration |
struct | EntityWithOffset |
struct | ExecutionContext |
struct | FilePosition |
Describe a position in a given file ; handled by the BaseParser. More... | |
class | FunctionExecutor |
Handles function macros. More... | |
class | Future |
struct | Import |
class | ImportSolver |
struct | InstLoc |
class | IRCompiler |
class | IROptimizer |
struct | IsAlnum |
struct | IsAlpha |
struct | IsChar |
struct | IsDigit |
struct | IsEither |
struct | IsHex |
struct | IsInlineSpace |
struct | IsNot |
struct | IsSpace |
struct | IsSymbol |
class | LocalsLocator |
class | Logger |
class | MacroExecutor |
A class that applies macros in a Node. More... | |
class | MacroProcessor |
The class handling the macros definitions and calls, given an AST. More... | |
class | MacroScope |
class | NameResolutionPass |
struct | Namespace |
class | NamespaceScope |
class | Node |
A node of an Abstract Syntax Tree for ArkScript. More... | |
class | Optimizer |
The ArkScript AST optimizer. More... | |
struct | Package |
class | Parser |
class | Pass |
An interface to describe compiler passes. More... | |
class | ScopeResolver |
class | ScopeView |
A class to handle the VM scope more efficiently. More... | |
class | SharedLibrary |
Handling a shared library as an ArkScript plugin. More... | |
class | StaticScope |
class | SymbolExecutor |
Handles Symbol macros. More... | |
struct | type_uid |
struct | type_uid_impl |
class | utf8_char_t |
struct | ValTableElem |
A Compiler Value class helper to handle multiple types. More... | |
struct | Word |
Typedefs | |
using | PageAddr_t = uint16_t |
Enumerations | |
enum class | NodeType { Symbol , Capture , Keyword , String , Number , List , Spread , Field , Macro , Namespace , Unused } |
The different node types available. More... | |
enum class | Keyword { Fun , Let , Mut , Set , If , While , Begin , Import , Del } |
The different keywords available. More... | |
enum | Instruction : uint8_t { NOP = 0x00 , SYM_TABLE_START = 0xA1 , VAL_TABLE_START = 0xA2 , CODE_SEGMENT_START = 0xA3 , NUMBER_TYPE = 0xF1 , STRING_TYPE = 0xF2 , FUNC_TYPE = 0xF3 , FILENAMES_TABLE_START = 0xA4 , INST_LOC_TABLE_START = 0xA5 , LOAD_SYMBOL = 0x01 , LOAD_SYMBOL_BY_INDEX = 0x02 , LOAD_CONST = 0x03 , POP_JUMP_IF_TRUE = 0x04 , STORE = 0x05 , SET_VAL = 0x06 , POP_JUMP_IF_FALSE = 0x07 , JUMP = 0x08 , RET = 0x09 , HALT = 0x0a , CALL = 0x0b , CAPTURE = 0x0c , BUILTIN = 0x0d , DEL = 0x0e , MAKE_CLOSURE = 0x0f , GET_FIELD = 0x10 , PLUGIN = 0x11 , LIST = 0x12 , APPEND = 0x13 , CONCAT = 0x14 , APPEND_IN_PLACE = 0x15 , CONCAT_IN_PLACE = 0x16 , POP_LIST = 0x17 , POP_LIST_IN_PLACE = 0x18 , SET_AT_INDEX = 0x19 , SET_AT_2_INDEX = 0x1a , POP = 0x1b , DUP = 0x1c , CREATE_SCOPE = 0x1d , RESET_SCOPE = 0x1e , POP_SCOPE = 0x1f , FIRST_OPERATOR = 0x20 , ADD = 0x20 , SUB = 0x21 , MUL = 0x22 , DIV = 0x23 , GT = 0x24 , LT = 0x25 , LE = 0x26 , GE = 0x27 , NEQ = 0x28 , EQ = 0x29 , LEN = 0x2a , EMPTY = 0x2b , TAIL = 0x2c , HEAD = 0x2d , ISNIL = 0x2e , ASSERT = 0x2f , TO_NUM = 0x30 , TO_STR = 0x31 , AT = 0x32 , AT_AT = 0x33 , MOD = 0x34 , TYPE = 0x35 , HASFIELD = 0x36 , NOT = 0x37 , LOAD_CONST_LOAD_CONST = 0x38 , LOAD_CONST_STORE = 0x39 , LOAD_CONST_SET_VAL = 0x3a , STORE_FROM = 0x3b , STORE_FROM_INDEX = 0x3c , SET_VAL_FROM = 0x3d , SET_VAL_FROM_INDEX = 0x3e , INCREMENT = 0x3f , INCREMENT_BY_INDEX = 0x40 , DECREMENT = 0x41 , DECREMENT_BY_INDEX = 0x42 , STORE_TAIL = 0x43 , STORE_TAIL_BY_INDEX = 0x44 , STORE_HEAD = 0x45 , STORE_HEAD_BY_INDEX = 0x46 , SET_VAL_TAIL = 0x47 , SET_VAL_TAIL_BY_INDEX = 0x48 , SET_VAL_HEAD = 0x49 , SET_VAL_HEAD_BY_INDEX = 0x4a , CALL_BUILTIN = 0x4b , InstructionsCount } |
The different bytecodes are stored here. More... | |
enum class | ValTableElemType { Number , String , PageAddr } |
Enumeration to keep track of the type of a Compiler Value. More... | |
enum class | ErrorKind { VM , Module , Scope , Type , Index , Arity , DivisionByZero } |
Functions | |
bool | operator== (const Namespace &A, const Namespace &B) |
bool | operator< (const Namespace &, const Namespace &) |
const Node & | getTrueNode () |
const Node & | getFalseNode () |
const Node & | getNilNode () |
const Node & | getListNode () |
std::string | typeToString (const Node &node) noexcept |
void | serializeToVecLE (std::integral auto number, std::vector< uint8_t > &out) |
void | serializeToVecBE (std::integral auto number, std::vector< uint8_t > &out) |
void | serializeOn2BytesToVecLE (std::integral auto number, std::vector< uint8_t > &out) |
void | serializeOn2BytesToVecBE (std::integral auto number, std::vector< uint8_t > &out) |
template<std::integral T> | |
T | deserializeLE (std::vector< uint8_t >::const_iterator begin, std::vector< uint8_t >::const_iterator end) |
template<std::integral T> | |
T | deserializeBE (std::vector< uint8_t >::const_iterator begin, std::vector< uint8_t >::const_iterator end) |
bool | operator< (const Closure &A, const Closure &B) |
long | countOpenEnclosures (const std::string &line, char open, char close) |
Count the open enclosure and its counterpart: (), {}, []. | |
void | trimWhitespace (std::string &line) |
Remove whitespaces at the start and end of a string. | |
std::vector< std::string > | getAllKeywords () |
Compute a list of all the language keywords and builtins. | |
std::vector< std::pair< std::string, replxx::Replxx::Color > > | getColorPerKeyword () |
Compute a list of pairs (word -> color) to be used for coloration by the REPL. | |
replxx::Replxx::completions_t | hookCompletion (const std::vector< std::string > &words, const std::string &context, int &length) |
void | hookColor (const std::vector< std::pair< std::string, replxx::Replxx::Color > > &words_colors, const std::string &context, replxx::Replxx::colors_t &colors) |
replxx::Replxx::hints_t | hookHint (const std::vector< std::string > &words, const std::string &context, int &length, replxx::Replxx::Color &color) |
bool | operator== (const Node &A, const Node &B) |
bool | operator< (const Node &A, const Node &B) |
std::optional< std::filesystem::path > | testExtensions (const std::filesystem::path &folder, const std::string &package_path) |
bool | operator== (const ScopeView &A, const ScopeView &B) |
bool | operator== (const Closure &A, const Closure &B) |
bool | operator== (const ClosureScope &A, const ClosureScope &B) |
Variables | |
Ark::internal::IsSpace | IsSpace |
Ark::internal::IsInlineSpace | IsInlineSpace |
Ark::internal::IsDigit | IsDigit |
Ark::internal::IsHex | IsHex |
Ark::internal::IsAlpha | IsAlpha |
Ark::internal::IsAlnum | IsAlnum |
Ark::internal::IsSymbol | IsSymbol |
const IsChar | IsMinus ('-') |
constexpr std::array< std::string_view, 11 > | nodeTypes |
Node types as string, in the same order as the enum NodeType. | |
constexpr std::array< std::string_view, 9 > | keywords |
List of available keywords in ArkScript. | |
constexpr std::array | InstructionNames |
constexpr std::array< std::string_view, 7 > | errorKinds |
constexpr std::array | colors |
using Ark::internal::PageAddr_t = uint16_t |
Definition at line 27 of file Closure.hpp.
|
strong |
Enumerator | |
---|---|
VM | |
Module | |
Scope | |
Type | |
Index | |
Arity | |
DivisionByZero |
Definition at line 9 of file ErrorKind.hpp.
enum Ark::internal::Instruction : uint8_t |
The different bytecodes are stored here.
FIRST_OPERATOR
must be the same as the one in the operators table from the aforementioned file. Definition at line 26 of file Instructions.hpp.
|
strong |
The different keywords available.
Enumerator | |
---|---|
Fun | |
Let | |
Mut | |
Set | |
If | |
While | |
Begin | |
Import | |
Del |
Definition at line 74 of file Common.hpp.
|
strong |
The different node types available.
Enumerator | |
---|---|
Symbol | |
Capture | |
Keyword | |
String | |
Number | |
List | |
Spread | |
Field | |
Macro | |
Namespace | |
Unused |
Definition at line 43 of file Common.hpp.
|
strong |
Enumeration to keep track of the type of a Compiler Value.
Enumerator | |
---|---|
Number | |
String | |
PageAddr |
Definition at line 25 of file ValTableElem.hpp.
long Ark::internal::countOpenEnclosures | ( | const std::string & | line, |
char | open, | ||
char | close ) |
Count the open enclosure and its counterpart: (), {}, [].
line | data to operate on |
open | the open char: (, { or [ |
close | the closing char: ), } or ] |
Referenced by Ark::Repl::getCodeBlock().
T Ark::internal::deserializeBE | ( | std::vector< uint8_t >::const_iterator | begin, |
std::vector< uint8_t >::const_iterator | end ) |
Definition at line 56 of file IntegerSerializer.hpp.
Referenced by Ark::BytecodeReader::instLocations().
T Ark::internal::deserializeLE | ( | std::vector< uint8_t >::const_iterator | begin, |
std::vector< uint8_t >::const_iterator | end ) |
Definition at line 45 of file IntegerSerializer.hpp.
Referenced by Ark::BytecodeReader::values().
std::vector< std::string > Ark::internal::getAllKeywords | ( | ) |
Compute a list of all the language keywords and builtins.
std::vector< std::pair< std::string, replxx::Replxx::Color > > Ark::internal::getColorPerKeyword | ( | ) |
Compute a list of pairs (word -> color) to be used for coloration by the REPL.
const Node & Ark::internal::getFalseNode | ( | ) |
Definition at line 314 of file Node.cpp.
References Symbol.
Referenced by Ark::internal::MacroProcessor::evaluate().
const Node & Ark::internal::getListNode | ( | ) |
Definition at line 326 of file Node.cpp.
References Symbol.
Referenced by Ark::internal::FunctionExecutor::applyMacro(), Ark::internal::MacroProcessor::evaluate(), and Ark::internal::FunctionExecutor::unify().
const Node & Ark::internal::getNilNode | ( | ) |
Definition at line 320 of file Node.cpp.
References Symbol.
Referenced by Ark::internal::ConditionalExecutor::applyMacro(), and Ark::internal::MacroProcessor::evaluate().
const Node & Ark::internal::getTrueNode | ( | ) |
Definition at line 308 of file Node.cpp.
References Symbol.
Referenced by Ark::internal::MacroProcessor::evaluate().
void Ark::internal::hookColor | ( | const std::vector< std::pair< std::string, replxx::Replxx::Color > > & | words_colors, |
const std::string & | context, | ||
replxx::Replxx::colors_t & | colors ) |
Referenced by Ark::Repl::cuiSetup().
replxx::Replxx::completions_t Ark::internal::hookCompletion | ( | const std::vector< std::string > & | words, |
const std::string & | context, | ||
int & | length ) |
Referenced by Ark::Repl::cuiSetup().
replxx::Replxx::hints_t Ark::internal::hookHint | ( | const std::vector< std::string > & | words, |
const std::string & | context, | ||
int & | length, | ||
replxx::Replxx::Color & | color ) |
Referenced by Ark::Repl::cuiSetup().
Definition at line 88 of file Closure.hpp.
Definition at line 27 of file Namespace.hpp.
Definition at line 41 of file Closure.cpp.
|
noexcept |
Definition at line 38 of file ClosureScope.cpp.
Definition at line 21 of file Namespace.hpp.
References Ark::internal::Namespace::is_glob, Ark::internal::Namespace::name, and Ark::internal::Namespace::with_prefix.
Definition at line 84 of file ScopeView.cpp.
void Ark::internal::serializeOn2BytesToVecBE | ( | std::integral auto | number, |
std::vector< uint8_t > & | out ) |
Definition at line 37 of file IntegerSerializer.hpp.
Referenced by Ark::internal::IRCompiler::compile(), Ark::internal::IRCompiler::pushFileHeader(), Ark::internal::IRCompiler::pushFilenameTable(), Ark::internal::IRCompiler::pushInstLocTable(), Ark::internal::IRCompiler::pushSymbolTable(), and Ark::internal::IRCompiler::pushValueTable().
void Ark::internal::serializeOn2BytesToVecLE | ( | std::integral auto | number, |
std::vector< uint8_t > & | out ) |
Definition at line 30 of file IntegerSerializer.hpp.
void Ark::internal::serializeToVecBE | ( | std::integral auto | number, |
std::vector< uint8_t > & | out ) |
Definition at line 18 of file IntegerSerializer.hpp.
Referenced by Ark::internal::IRCompiler::pushInstLocTable().
void Ark::internal::serializeToVecLE | ( | std::integral auto | number, |
std::vector< uint8_t > & | out ) |
Definition at line 10 of file IntegerSerializer.hpp.
Referenced by Ark::internal::IRCompiler::pushValueTable().
std::optional< std::filesystem::path > Ark::internal::testExtensions | ( | const std::filesystem::path & | folder, |
const std::string & | package_path ) |
Definition at line 190 of file ImportSolver.cpp.
Referenced by Ark::internal::ImportSolver::findFile().
void Ark::internal::trimWhitespace | ( | std::string & | line | ) |
Remove whitespaces at the start and end of a string.
line | string modified in place |
Referenced by Ark::Repl::getLine().
|
inlinenoexcept |
node |
Definition at line 240 of file Node.hpp.
References nodeTypes, and Symbol.
Referenced by Ark::internal::ASTLowerer::compileExpression(), Ark::internal::ASTLowerer::compileFunction(), Ark::internal::ASTLowerer::compileLetMutSet(), Ark::internal::MacroProcessor::evaluate(), and Ark::internal::MacroProcessor::registerFuncDef().
|
constexpr |
Definition at line 8 of file Logger.cpp.
Referenced by Ark::Repl::cuiSetup(), and Ark::internal::Logger::Logger().
|
constexpr |
Definition at line 20 of file ErrorKind.hpp.
Referenced by Ark::VM::throwVMError().
|
constexpr |
Definition at line 309 of file Instructions.hpp.
Referenced by Ark::BytecodeReader::display(), and Ark::internal::IRCompiler::dumpToStream().
Ark::internal::IsAlnum Ark::internal::IsAlnum |
Ark::internal::IsAlpha Ark::internal::IsAlpha |
Ark::internal::IsDigit Ark::internal::IsDigit |
Ark::internal::IsHex Ark::internal::IsHex |
Ark::internal::IsInlineSpace Ark::internal::IsInlineSpace |
const IsChar Ark::internal::IsMinus('-') | ( | '-' | ) |
Referenced by Ark::internal::BaseParser::signedNumber().
Ark::internal::IsSpace Ark::internal::IsSpace |
Ark::internal::IsSymbol Ark::internal::IsSymbol |
|
constexpr |
List of available keywords in ArkScript.
Definition at line 88 of file Common.hpp.
Referenced by Formatter::format(), Formatter::formatVariable(), and Ark::internal::Node::repr().
|
constexpr |
Node types as string, in the same order as the enum NodeType.
Definition at line 59 of file Common.hpp.
Referenced by JsonCompiler::_compile(), Ark::internal::Parser::letMutSet(), and typeToString().