ArkScript
A small, fast, functional and scripting language for video games
|
Namespaces | |
namespace | Builtins |
Classes | |
class | Closure |
Closure management. More... | |
class | ConditionalExecutor |
Handles Conditional macros. More... | |
struct | ExecutionContext |
class | FunctionExecutor |
Handles function macros. More... | |
class | Future |
class | Lexer |
The lexer, in charge of creating a list of tokens. More... | |
struct | LineColorContextCounts |
class | MacroExecutor |
A class that applies macros in a Node. More... | |
class | MacroExecutorPipeline |
The class that initializes the MacroExecutors. More... | |
class | MacroProcessor |
The class handling the macros definitions and calls, given an AST. More... | |
class | MacroScope |
class | Node |
A node of an Abstract Syntax Tree for ArkScript. More... | |
class | Optimizer |
The ArkScript AST optimizer. More... | |
class | Parser |
The parser is responsible of constructing the Abstract Syntax Tree from a token list. More... | |
class | Scope |
A class to handle the VM scope more efficiently. More... | |
class | SharedLibrary |
Handling a shared library as an ArkScript plugin. More... | |
class | SymbolExecutor |
Handles Symbol macros. More... | |
struct | Token |
struct | type_uid |
struct | type_uid_impl |
struct | ValTableElem |
A Compiler Value class helper to handle multiple types. More... | |
Typedefs | |
using | Scope_t = std::shared_ptr< Scope > |
Scope handling. | |
using | PageAddr_t = uint16_t |
Enumerations | |
enum class | TokenType { Grouping , String , Number , Operator , Identifier , Capture , GetField , Keyword , Skip , Comment , Shorthand , Spread , Mismatch } |
enum class | NodeType { Symbol , Capture , GetField , Keyword , String , Number , List , Closure , Macro , Spread , Unused } |
The different node types available. More... | |
enum class | Keyword { Fun , Let , Mut , Set , If , While , Begin , Import , Quote , Del } |
The different keywords available. More... | |
enum | Instruction : uint8_t { NOP = 0x00 , SYM_TABLE_START = 0x01 , VAL_TABLE_START = 0x02 , NUMBER_TYPE = 0x01 , STRING_TYPE = 0x02 , FUNC_TYPE = 0x03 , CODE_SEGMENT_START = 0x03 , FIRST_COMMAND = 0x01 , LOAD_SYMBOL = 0x01 , LOAD_CONST = 0x02 , POP_JUMP_IF_TRUE = 0x03 , STORE = 0x04 , LET = 0x05 , POP_JUMP_IF_FALSE = 0x06 , JUMP = 0x07 , RET = 0x08 , HALT = 0x09 , CALL = 0x0a , CAPTURE = 0x0b , BUILTIN = 0x0c , MUT = 0x0d , DEL = 0x0e , SAVE_ENV = 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 , POP = 0x19 , LAST_COMMAND = 0x19 , 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 , AND_ = 0x33 , OR_ = 0x34 , MOD = 0x35 , TYPE = 0x36 , HASFIELD = 0x37 , NOT = 0x38 , LAST_OPERATOR = 0x38 , LAST_INSTRUCTION = 0x38 } |
The different bytecodes are stored here. More... | |
enum class | ValTableElemType { Number , String , PageAddr } |
Enumeration to keep track of the type of a C(ompiler)Value. More... | |
enum class | ErrorKind { VM , Module , Mutability , Scope , Type , Index , Arity } |
Functions | |
std::string | makeNodeBasedErrorCtx (const std::string &message, const Node &node) |
Construct an error message based on a given node. | |
std::string | makeTokenBasedErrorCtx (const std::string &match, std::size_t line, std::size_t col, const std::string &code) |
Construct an error message based on a given match in the code. | |
std::string | colorizeLine (const std::string &line, LineColorContextCounts &line_color_context_counts) |
Add colors to highlight matching parentheses/curly braces/square braces on a line. | |
bool | isPairableChar (const char c) |
Check if the character passed in can be paired (parentheses, curly braces, or square braces) | |
std::ostream & | operator<< (std::ostream &os, const std::vector< Node > &N) noexcept |
template<typename T > | |
Node | make_node (T &&value, std::size_t line, std::size_t col, const std::string &file) |
Node | make_node_list (std::size_t line, std::size_t col, const std::string &file) |
std::string | typeToString (const Node &node) noexcept |
NodeType | similarNodetypeFromTokentype (TokenType tt) |
bool | operator== (const Closure &A, const Closure &B) noexcept |
bool | operator< (const Closure &A, const Closure &B) noexcept |
void | makeContext (std::ostream &os, const std::string &code, std::size_t line, std::size_t col_start, std::size_t sym_size) |
void | swap (Node &lhs, Node &rhs) noexcept |
std::ostream & | operator<< (std::ostream &os, const Node &N) noexcept |
bool | operator== (const Node &A, const Node &B) |
bool | operator< (const Node &A, const Node &B) |
bool | operator! (const Node &A) |
std::ostream & | operator<< (std::ostream &os, const Parser &P) noexcept |
Variables | |
constexpr std::array< std::string_view, 13 > | tokentype_string |
constexpr std::array< std::string_view, 11 > | nodeTypes |
constexpr std::array< std::string_view, 10 > | keywords |
List of available keywords in ArkScript. | |
constexpr std::array< std::string_view, 25 > | operators |
constexpr std::array< std::string_view, 7 > | errorKinds |
auto | colors |
using Ark::internal::PageAddr_t = typedef uint16_t |
Definition at line 38 of file Closure.hpp.
using Ark::internal::Scope_t = typedef std::shared_ptr<Scope> |
Scope handling.
A scope is defined as a shared pointer to a list of local variables because a Closure could continue to leave when the local variables list has been closed by the virtual machine
Definition at line 37 of file Closure.hpp.
|
strong |
Enumerator | |
---|---|
VM | |
Module | |
Mutability | |
Scope | |
Type | |
Index | |
Arity |
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 27 of file Instructions.hpp.
|
strong |
The different keywords available.
Enumerator | |
---|---|
Fun | |
Let | |
Mut | |
Set | |
If | |
While | |
Begin | |
Import | |
Quote | |
Del |
Definition at line 58 of file Common.hpp.
|
strong |
The different node types available.
Enumerator | |
---|---|
Symbol | |
Capture | |
GetField | |
Keyword | |
String | |
Number | |
List | |
Closure | |
Macro | |
Spread | |
Unused |
Definition at line 28 of file Common.hpp.
|
strong |
|
strong |
Enumeration to keep track of the type of a C(ompiler)Value.
Enumerator | |
---|---|
Number | |
String | |
PageAddr |
Definition at line 26 of file ValTableElem.hpp.
std::string Ark::internal::colorizeLine | ( | const std::string & | line, |
LineColorContextCounts & | line_color_context_counts | ||
) |
Add colors to highlight matching parentheses/curly braces/square braces on a line.
line | the line of code to colorize |
line_color_context_counts | a LineColorContextCounts to manipulate the running counts of open pairings |
Definition at line 46 of file makeErrorCtx.cpp.
References isPairableChar(), Ark::internal::LineColorContextCounts::open_curly_braces, Ark::internal::LineColorContextCounts::open_parentheses, and Ark::internal::LineColorContextCounts::open_square_braces.
Referenced by makeContext().
|
inline |
Check if the character passed in can be paired (parentheses, curly braces, or square braces)
c |
Definition at line 67 of file makeErrorCtx.hpp.
Referenced by colorizeLine().
Node Ark::internal::make_node | ( | T && | value, |
std::size_t | line, | ||
std::size_t | col, | ||
const std::string & | file | ||
) |
Definition at line 251 of file Node.hpp.
References Ark::internal::Node::col(), Ark::internal::Node::line(), Ark::internal::Node::setFilename(), and Ark::internal::Node::setPos().
Referenced by Ark::internal::Parser::atom(), and Ark::internal::Parser::parseShorthand().
|
inline |
Definition at line 259 of file Node.hpp.
References Ark::internal::Node::col(), Ark::internal::Node::line(), List, Ark::internal::Node::setFilename(), and Ark::internal::Node::setPos().
Referenced by Ark::internal::Parser::parse(), and Ark::internal::Parser::parseShorthand().
void Ark::internal::makeContext | ( | std::ostream & | os, |
const std::string & | code, | ||
std::size_t | line, | ||
std::size_t | col_start, | ||
std::size_t | sym_size | ||
) |
Definition at line 13 of file makeErrorCtx.cpp.
References colorizeLine(), and Ark::Utils::splitString().
Referenced by makeNodeBasedErrorCtx(), and makeTokenBasedErrorCtx().
std::string Ark::internal::makeNodeBasedErrorCtx | ( | const std::string & | message, |
const Node & | node | ||
) |
Construct an error message based on a given node.
It opens the related file at the line and column of the node, and display context, plus underline the problem with a serie of ^.
message | |
node |
Definition at line 101 of file makeErrorCtx.cpp.
References ARK_NO_NAME_FILE, Ark::internal::Node::col(), Ark::internal::Node::filename(), Ark::internal::Node::line(), makeContext(), Ark::internal::Node::nodeType(), Ark::Utils::readFile(), Spread, Ark::internal::Node::string(), String, and Symbol.
Referenced by Ark::Compiler::compilerWarning(), Ark::Compiler::throwCompilerError(), Ark::internal::MacroProcessor::throwMacroProcessingError(), and Ark::internal::Optimizer::throwOptimizerError().
std::string Ark::internal::makeTokenBasedErrorCtx | ( | const std::string & | match, |
std::size_t | line, | ||
std::size_t | col, | ||
const std::string & | code | ||
) |
Construct an error message based on a given match in the code.
Mostly used by the Lexer and Parser since they don't have Nodes to work on
match | the identified token, causing a problem |
line | line of the token |
col | starting column of the token |
code | the whole code of the file |
Definition at line 119 of file makeErrorCtx.cpp.
References makeContext().
Referenced by Ark::internal::Parser::throwParseError(), and Ark::internal::Lexer::throwTokenizingError().
Definition at line 112 of file Closure.hpp.
|
noexcept |
|
noexcept |
Definition at line 597 of file Parser.cpp.
|
noexcept |
Definition at line 107 of file Closure.hpp.
Definition at line 27 of file Parser.hpp.
References Capture, GetField, Spread, and Symbol.
Referenced by Ark::internal::Parser::atom().
Definition at line 188 of file Node.cpp.
Referenced by Ark::internal::Node::operator=(), and Ark::internal::Node::swap().
|
inlinenoexcept |
Definition at line 267 of file Node.hpp.
References nodeTypes, and Symbol.
Referenced by Ark::internal::MacroProcessor::evaluate().
auto Ark::internal::colors |
|
constexpr |
Definition at line 20 of file ErrorKind.hpp.
Referenced by Ark::VM::throwVMError().
|
constexpr |
List of available keywords in ArkScript.
Definition at line 73 of file Common.hpp.
Referenced by Ark::internal::Lexer::isKeyword().
|
constexpr |
Definition at line 43 of file Common.hpp.
Referenced by Ark::JsonCompiler::_compile(), Ark::internal::MacroProcessor::evaluate(), and typeToString().
|
constexpr |
Definition at line 89 of file Common.hpp.
Referenced by Ark::Compiler::handleCalls(), Ark::internal::MacroProcessor::isConstEval(), Ark::Compiler::isOperator(), Ark::internal::Lexer::isOperator(), and Ark::internal::Parser::parse().
|
constexpr |
Definition at line 39 of file Token.hpp.
Referenced by Ark::internal::Lexer::feed(), and Ark::internal::Parser::throwParseError().