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
7extern "C" {
8void __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
19{
20 using namespace emscripten;
21 function("run", &run);
22}
23
24int main()
25{
26 return 0;
27}
Includes the needed files to start using ArkScript.
EMSCRIPTEN_BINDINGS(arkscript)
Definition main.cpp:18
void __attribute__((noinline)) EMSCRIPTEN_KEEPALIVE run(const std
Definition main.cpp:8
int main()
Definition main.cpp:24
Ark state to handle the dirty job of loading and compiling ArkScript code.
Definition State.hpp:33
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
The ArkScript virtual machine, executing ArkScript bytecode.
Definition VM.hpp:46
int run(bool fail_with_exception=false)
Run the bytecode held in the state.
Definition VM.cpp:443