Skip to main content

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 to engine.exec(buffer).
  • Persistence — variables declared with var/const persist 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, Tab inserts 4 spaces, Backspace/Delete work.

Interactive commands

CommandEffect
:quit, :exitLeave the interpreter (main.cpp:401)
:clearDiscard the current incomplete buffer and reset nesting state (main.cpp:407)
:helpPrint 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-DEOF — 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

CodeMeaning
0Script ran cleanly (or REPL exited normally)
1exec_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/*.scr invoked via this CLI
  • Embeddingexec/exec_file/submit from C++ (same engine, no CLI)