Skip to content

Commit 2dc4817

Browse files
committed
docs(repl): add documentation about repl
1 parent 7021a25 commit 2dc4817

3 files changed

Lines changed: 51 additions & 2 deletions

File tree

content/docs/prologue/getting_started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ You will want to learn the language first: [Learning ArkScript](/docs/tutorials/
6868
6969
Then you can experiment with either:
7070
71-
- [try the online playground](https://playground.arkscript-lang.dev), so that you don't have to install anything
71+
- [try the online playground](https://playground.arkscript-lang.dev), so that you don't have to install anything,
7272
- [use Docker](/docs/prologue/building#using-docker), to avoid clutering your computer with dependencies and compilers,
73-
- or [install it on your machine](/docs/prologue/building#installing-from-a-release) via one of our releases
73+
- or [install it on your machine](/docs/prologue/building#installing-from-a-release) via one of our releases. You can quickly try code using [the REPL](/docs/reference/repl)
7474
7575
## I want to contribute!
7676

content/docs/reference/repl.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "REPL"
3+
slug: "repl"
4+
description: ""
5+
date: 2026-01-01T16:52:54+02:00
6+
lastmod: 2026-01-01T16:52:54+02:00
7+
draft: false
8+
weight: 505
9+
---
10+
11+
ArkScript REPL can be launched by calling `arkscript` without any file argument.
12+
13+
It will look for the `ARKSCRIPT_REPL_STARTUP` environment variable to optionally preload code. See [the getting started guide](/docs/prologue/building/#environment-var-setup) to configure it.
14+
15+
## REPL builtins
16+
17+
- `(repl:history)` returns the REPL history as a string
18+
- `(repl:save filename)` saves the REPL history to a file
19+
- `(repl:load filename)` loads a file into the REPL (copies its content to the current session, to avoid path problems with imports)
20+
21+
## REPL commands
22+
23+
- `help`: display this message
24+
- `quit`: quit the REPL
25+
- `save`: save the history to disk
26+
- `history`: print saved code
27+
- `reset`: reset the VM state
28+
29+
## REPL controls
30+
31+
- **Home**: move to start of line
32+
- **End**: move to end of line
33+
- **Control** + **Left**: move cursor one word left
34+
- **Control** + **Right**: move cursor one word right
35+
- **Control** + **Up**: show previous hint
36+
- **Control** + **Down**: show next hint
37+
- **Control** + **U**: delete current line
38+
- **Control** + **W**: delete last word
39+
- **Control** + **K**: delete until end of line
40+
- **Control** + **R**: incremental search
41+
- **Control** + **C**: abort line
42+
- **Control** + **L**: clear screen
43+
- **Control** + **D**: send EOF, quit REPL
44+
- **Control** + **T**: transpose characters (invert the 2 characters *before* the cursor*)
45+

hugo_stats.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@
681681
"parameter-36",
682682
"parameter-37",
683683
"parameter-38",
684+
"parameter-39",
684685
"parameter-4",
685686
"parameter-5",
686687
"parameter-6",
@@ -757,6 +758,9 @@
757758
"removeprefix",
758759
"removesuffix",
759760
"repeat",
761+
"repl-builtins",
762+
"repl-commands",
763+
"repl-controls",
760764
"repl-read-eval-print-loop",
761765
"replace",
762766
"results",

0 commit comments

Comments
 (0)