CLI Reference — scrii_repl
The interpreter ships as a single binary, scrii_repl, built via the super-build:
cmake --build build --target scrii_repl
# -> build/interpreter/scrii_repl
Synopsis
scrii_repl # start interactive REPL
scrii_repl <script file> # run a script file and exit
With a file argument the engine calls exec_file(path) — relative import() paths resolve against that file's directory. Errors print as STATUS: message and the process exits 1 on failure, 0 on success (scrii/interpreter/main.cpp:370).
Without arguments the process enters the interactive loop (scrii/interpreter/main.cpp:379).
REPL behavior
- Multi-line buffering — input is collected until braces/parens/brackets are balanced and strings/block comments are closed; the prompt switches from
>to...while the buffer is incomplete. Only then is the buffer handed toengine.exec(buffer). - Persistence — variables declared with
var/constpersist across prompts in the same engine. Restart the process for a fresh engine. - History — last 25 non-empty lines, navigable with Up/Down arrows. Duplicate consecutive entries are not stored twice.
- Editing — Emacs-style keys:
Ctrl-A(BOL),Ctrl-E(EOL),Ctrl-K(kill to EOL),Ctrl-U(kill to BOL),Ctrl-D/ EOF to exit,Tabinserts 4 spaces, Backspace/Delete work.
Interactive commands
| Command | Effect |
|---|---|
:quit, :exit | Leave the interpreter (main.cpp:401) |
:clear | Discard the current incomplete buffer and reset nesting state (main.cpp:407) |
:help | Print REPL help plus help() hint (main.cpp:79) |
help() (inside script) | List every builtin as name - description; help(std) / help(std.string) drills into modules (see Builtins) |
Ctrl-D | EOF — same as :quit |
> var x = 40 + 2
> print(x)
42
> :help
commands:
:quit, :exit leave the interpreter
:clear discard the current (possibly incomplete) script
:help show this text
type help() for a list of built-in functions and their descriptions
...
Exit codes
| Code | Meaning |
|---|---|
0 | Script ran cleanly (or REPL exited normally) |
1 | exec_file failed — status printed to stderr |
Use std.exit(code) inside a script to terminate with a custom code (see std.os).
See also
- Getting Started — building and first program
- Examples — runnable
examples/*.scrinvoked via this CLI - Embedding —
exec/exec_file/submitfrom C++ (same engine, no CLI)