Expand description
The main REPL event loop - input handling, rendering, and evaluation dispatch.
§State
| Variable | Purpose |
|---|---|
input_buf | The current line being typed |
accumulated | Multiline buffer - grows until is_complete is true |
cursor_pos | Cursor position in chars (not bytes) |
history | Submitted input history, navigated with ↑/↓ |
history_idx | Current position in history (None = live input) |
attached | Files evaluated into the env via :attach |
scroll_offset | Output scroll position (0 = bottom, higher = older) |
§Multiline input
Lines are accumulated into accumulated until is_complete returns true
and the last line does not end with { (a bare block opener waits for body).
The prompt switches from >> to .. while accumulating.
Esc cancels and clears the accumulator.
§Evaluation flow
Enter key
|
|- starts with ':' ──► handle_command
|
|- code input
|
|- not complete yet --> keep accumulating
|
|- complete --> eval_input --> output bufferFunctions§
- run_
repl - Runs the REPL event loop until the user exits with
Ctrl+Cor:exit.