ArkScript
A small, lisp-inspired, functional scripting language
main.cpp
Go to the documentation of this file.
1
#include <
Ark/Ark.hpp
>
2
#include <emscripten.h>
3
#include <emscripten/bind.h>
4
5
#include <string>
6
7
extern
"C"
{
8
void
__attribute__
((noinline)) EMSCRIPTEN_KEEPALIVE run(
const
std::string& code)
9
{
10
Ark::State
state;
11
state.
doString
(code);
12
13
Ark::VM
vm(state);
14
vm.
run
();
15
}
16
}
17
18
EMSCRIPTEN_BINDINGS
(arkscript)
19
{
20
using namespace
emscripten;
21
function(
"run"
, &run);
22
}
23
24
int
main
()
25
{
26
return
0;
27
}
Ark.hpp
Includes the needed files to start using ArkScript.
EMSCRIPTEN_BINDINGS
EMSCRIPTEN_BINDINGS(arkscript)
Definition
main.cpp:18
__attribute__
void __attribute__((noinline)) EMSCRIPTEN_KEEPALIVE run(const std
Definition
main.cpp:8
main
int main()
Definition
main.cpp:24
Ark::State
Ark state to handle the dirty job of loading and compiling ArkScript code.
Definition
State.hpp:33
Ark::State::doString
bool doString(const std::string &code, uint16_t features=DefaultFeatures)
Compile a string (representing ArkScript code) and store resulting bytecode in m_bytecode.
Definition
State.cpp:108
Ark::VM
The ArkScript virtual machine, executing ArkScript bytecode.
Definition
VM.hpp:46
Ark::VM::run
int run(bool fail_with_exception=false)
Run the bytecode held in the state.
Definition
VM.cpp:443
src
arkemscripten
main.cpp
Generated on Tue Jul 22 2025 07:51:49 for ArkScript by
1.12.0