
🔍
repl.o
Read-Eval-Print Loop (REPL) with support for interactive sessions and remote connections.
Usage
Start interactive REPL:
$ tachyon -c 0 -f std/repl.o
Start REPL server with remote access:
$ tachyon -c 0 -f std/repl.o -- -p 2222
Start as daemon (no interactive REPL):
$ tachyon -c 0 -f std/repl.o -- -p 2222 -d
Command-line arguments
| Argument | Description |
|---|---|
| `-p PORT` | Open port for remote connections (e.g., `-p 2222`) |
| `-d` | Work as daemon (do not create interactive REPL) |
| `-desc TEXT` | Override ODESC description |
Main elements
| Name | Description / comments |
|---|---|
| .repl.version | REPL version number |
| .repl.prompt | REPL prompt string (default: "o") |
| .repl.connect[<address>] | Connect to remote REPL server |
| .repl.peval[<expr>;<esc>;<nullv>] | Protected eval with error handling |
| .repl.fmt[<x>] | Format value using current display settings |
Configuration options
| Name | Description / Default |
|---|---|
| .repl.opt.fetchMaxLen | Maximum vector/table length to send to client (default: 100000) |
Examples
Connect to remote REPL:
o)load[getenv[`OHOME];"repl"];
o)
o)// Connect to REPL server running on localhost:2222
o).repl.connect["127.0.0.1:2222"]
Connected to remote REPL
o)
o)// Execute commands on remote server
o)a: 1 + 2;
o)a
3
Start REPL server:
# Terminal 1: Start REPL server
$ tachyon -c 0 -f std/repl.o -- -p 2222
---
REPL server listening on port 2222
---
o)
# Terminal 2: Connect from another tachyon instance
$ tachyon
o)load[getenv[`OHOME];"repl"];
o).repl.connect["127.0.0.1:2222"]
Features
Error handling:
- Catches and formats runtime errors
- Shows stack traces with line numbers
- Highlights error location in code
- Displays native stack backtrace when available
Output formatting:
- Respects
\cconsole width settings - Formats tables and dictionaries for readability
- Handles special values (null, infinity)
- Color-coded error messages (when terminal supports it)
Remote REPL:
- Execute code on remote tachyon instance
- Serializes results back to client
- Supports all O data types
- Configurable data transfer limits
Auxiliary elements
| Name | Description |
|---|---|
| .repl.ps1 | Print prompt with ANSI colors |
| .repl.out | Output result and show prompt |
| .repl.sig[<esc>;<err>] | Format error message with stack trace |
| .repl.ltrim[<x>] | Trim whitespace from left |
| .repl.rtrim[<x>] | Trim whitespace from right |
| .repl.trim[<x>] | Trim whitespace from both sides |
| .repl.xbt | Format stack backtrace entry |
| .repl.enum2sym[<x>] | Convert enums to symbols |
| .repl.psend[<ipc>;<okerr>] | Protected IPC send |
| .repl.rapi.eval[<s>] | Remote API: evaluate expression |
Use cases
- Interactive development: - Test functions and expressions interactively - Debug code with immediate feedback - Explore data structures
- Remote execution: - Connect to production systems for monitoring - Execute maintenance scripts remotely - Inspect running processes
- Educational: - Learn O language interactively - Demonstrate language features - Experiment with code snippets
When using remote REPL, ensure proper network security. Remote REPL executes arbitrary code, so only allow connections from trusted sources.