Skip to content

Commit 164f5a0

Browse files
committed
chore: update docs regarding embedding and the __arkscript__ folder
1 parent 1f998b5 commit 164f5a0

5 files changed

Lines changed: 34 additions & 14 deletions

File tree

content/docs/guides/coding.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ for (std::size_t i = 0, end = container.size(); i < end; i++)
158158
```cpp
159159
/**
160160
* @file Lexer.hpp
161-
* @author Lex Plateau (lexplt.dev@gmail.com)
161+
* @author Lexy Plateau (lexplt.dev@gmail.com)
162162
* @brief Tokenize ArkScript code
163163
* @date 2020-10-27
164164
*
@@ -176,7 +176,7 @@ Snippet to recapitulate guidelines for headers:
176176
```cpp
177177
/**
178178
* @file Lexer.hpp
179-
* @author Lex Plateau (lexplt.dev@gmail.com)
179+
* @author Lexy Plateau (lexplt.dev@gmail.com)
180180
* @brief Tokenize ArkScript code
181181
* @date 2020-10-27
182182
*

content/docs/prologue/building.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ You can choose to build the project from source (which requires some knowledge l
2424
*This step is optional*
2525

2626
1. You can create an environment variable `ARKSCRIPT_PATH`, with the path to the installation directory of ArkScript, so that the standard library can be located without using `--lib <path>`.
27-
The environment variable should direct to a folder with the folder `lib/` inside. Multiple path can be provided if your installation separates the modules and the standard library, by separating the different paths with a single `;`.
27+
The environment variable should direct to a folder with the folder `std/` inside. Multiple path can be provided if your installation separates the modules and the standard library, by separating the different paths with a single `;`.
2828
2. You can create an environment variable `ARKSCRIPT_REPL_STARTUP`, with the path to a single `.ark` file that will be loaded each time you use the REPL. Useful to preload your favorite libraries!
2929

3030
## Installing from a release
@@ -112,8 +112,11 @@ Commands:
112112
```shell
113113
cmake . -Bbuild -DARK_BUILD_EXE=On
114114
cmake --build build --config Release
115+
115116
# needs administrator rights to install under /usr/bin
116117
sudo cmake --install build --config Release
118+
# OR install under a custom directory (it must exists, cmake won't create it)
119+
cmake --install build --config Release --prefix /opt/ArkScript
117120
```
118121

119122
### Building on MacOS
@@ -122,7 +125,15 @@ Requirements:
122125
- clang 16+
123126
- cmake >= 3.15
124127

125-
On MacOS versions prior to 10.15, `libc++` lacks `filesystem` in the standard library.
128+
```shell
129+
cmake . -Bbuild -DARK_BUILD_EXE=On -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
130+
cmake --build build --config Release
131+
cmake --install build --config Release # might need administrator rights
132+
```
133+
134+
---
135+
136+
On MacOS versions **prior to 10.15**, `libc++` lacks `filesystem` in the standard library.
126137

127138
You will need to:
128139
- Install a newer compiler using [Homebrew](https://docs.brew.sh/): `brew install gcc && brew link gcc`
@@ -131,9 +142,9 @@ You will need to:
131142
Commands:
132143

133144
```shell
134-
~/ark$ cmake . -Bbuild -DARK_BUILD_EXE=On -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-14
135-
~/ark$ cmake --build build --config Release
136-
~/ark$ cmake --install build --config Release # might need administrator rights
145+
cmake . -Bbuild -DARK_BUILD_EXE=On -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-14
146+
cmake --build build --config Release
147+
cmake --install build --config Release # might need administrator rights
137148
```
138149

139150
### Building for the web using emscripten
@@ -165,7 +176,9 @@ cmake --build build_emscripten -j 8
165176

166177
### Running the tests
167178

168-
To check that everything works, it is important to run the tests for the projects, and we have a multitude of them:
179+
To check that everything works, it is important to run the tests for the project. They can be compiled using `-DARK_TESTS`, building a `unittests` executable.
180+
181+
The kind of tests we have:
169182
- `tests/benchmarks`: benchmarks for the parser and VM with a few scripts to help identifying regressions
170183
- `tests/fuzzing`: a collection of scripts (in `tests/fuzzing/docker/`) and ArkScript source files under the different `corpus` / `corpus-cmin` / `corpus-cmin-tmin` directories (only the `corpus` directory is managed by us, the two others are generated automatically through scripts and AFL++). Fuzzers can be run automatically using the `start-afl-docker.sh` script, that starts a docker image, compile ArkScript and run the fuzzers inside tmux sessions. An `output/` folder is created at the root of the project with the fuzzers output
171184
- `tests/repl`: a short test for the REPL to ensure it still autocompletes correctly

content/docs/prologue/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ Everyone is welcome to contribute to the project, as long as you are respectful
7878
7979
## Using ArkScript in your company
8080
81-
I (Lex Plateau) am working pretty much alone on this project, and I try to do my best to leave it as bug free and as performant as possible. However, this is a side project for which I'm currently **not paid** to work on, thus I can't fix every bug or address every feature request in a timely manner.
81+
I (Lexy Plateau) am working pretty much alone on this project, and I try to do my best to leave it as bug free and as performant as possible. However, this is a side project for which I'm currently **not paid** to work on, thus I can't fix every bug or address every feature request in a timely manner.
8282
8383
Please reach out either by email (lexplt.dev@gmail.com) or via a [discussion](https://github.com/orgs/ArkScript-lang/discussions) before using the language in a company project, so that we can set up a support contract. If you don't want to set up a contract, your issues and support requests won't be prioritized (and possibly left unanswered).

content/docs/tutorials/embedding.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main()
7373

7474
// Run an ArkScript function from C++ code and retrieve the result:
7575
auto value = vm.call("foo", 5, 6.0);
76-
std::cout << value << "\n"; // prints 13
76+
std::cout << value.toString(vm) << "\n"; // prints 13
7777

7878
// If you just want to run a precompiled bytecode file:
7979
{
@@ -100,7 +100,7 @@ Ark::Value my_function(std::vector<Ark::Value>& args, Ark::VM* vm)
100100
throw std::runtime_error("my_function needs 4 arguments!");
101101

102102
if (!types::check(args, Ark::ValueType::Number, Ark::ValueType::Number, Ark::ValueType::Number, Ark::ValueType::Number))
103-
Ark::types::generateError(
103+
throw Ark::types::TypeCheckingError(
104104
"my_function",
105105
{ { Ark::types::Contract { {
106106
Ark::types::Typedef("a", ValueType::Number),
@@ -137,10 +137,10 @@ int main()
137137
vm.run();
138138

139139
auto bar = vm["bar"];
140-
std::cout << bar << "\n";
140+
std::cout << bar.toString(vm) << "\n";
141141

142142
auto egg = vm["egg"];
143-
std::cout << egg << "\n";
143+
std::cout << egg.toString(vm) << "\n";
144144

145145
return 0;
146146
}
@@ -205,7 +205,7 @@ int main()
205205
return Ark::Nil;
206206
});
207207
208-
state.doString("(begin (let a (getBreakfast)) (print a) (useBreakfast a))");
208+
state.doString("(let a (getBreakfast)) (print a) (useBreakfast a)");
209209
Ark::VM vm(&state);
210210
vm.run();
211211

content/docs/tutorials/language.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ aliases:
1919

2020
{{< highlight_scripts >}}
2121

22+
## Running code
23+
24+
Create a `file.ark` on your disk, and from a terminal, run `arkscript file.ark`.
25+
This will create a cache folder `__arkscript__/` with the compiled bytecode inside, that the VM will then run.
26+
27+
*Alternatively*, you can head to the [playground](https://playground.arkscript-lang.dev) to run your code online.
28+
2229
## The basics
2330

2431
In ArkScript, there are two main rules:

0 commit comments

Comments
 (0)