ArkScript
A small, fast, functional and scripting language for video games
|
The src/
folder is divided in two subfolders:
arkreactor/
, the compiler and the runtimearkscript/
, the CLI and the REPLAll the builtin functions (and constants) are located in include/Ark/Builtins
. Those can be used with the bytecode instructions BUILTIN id
. Adding one will need to reference it in include/Ark/Builtins/Builtins.hpp
and in src/arkreactor/Builtins/Builtins.cpp
, and then implementing it accordingly under src/arkreactor/Builtins/[file].cpp
.
For more details on how to implement on, see The ArkScript builtins.
AST optimizer and Compiler are located under include/Ark/Compiler/
. This includes the Lexer, Parser, AST generation (using Nodes).
For more details on how it works, see ArkScript's compiler implementation details.
Is located under include/Ark/REPL/
. Basically it's an abstraction level over replxx
(external library for completion and coloration in the shell) and our virtual machine to run user inputs.
It lies under include/Ark/VM/
and all the folders under it.
shared_ptr
. Closures are functions with a saved scope, so they can retain information over multiple calls.arkm
files)variable id => value
, heavily optimized for our needsvariant
to store our types (our custom String, double, Closure, UserType and more), thus it must stay small because it's the primitive type of the virtual machine and the languagevariant
array<Value, 8192>
(the stack size is a define, thus it can be changed at compile time only)void*
user_data, retrievable by modules and C++ user functionssafeRun
which is enclosed in a try/catch to display tracebacks when errors occurcall
method (to call modules' functions and builtins)resolve
For more details, see Virtual Machine implementation details.
If you feel that this section is lacking information, please open an issue.