CLI Reference
--step Mode
An interactive, educational debugger that walks through your algorithm one line at a time, showing live variable state at each step.
Usage
bash
pseudo run sort.pseudo --stepHow It Works
When --step is active, the interpreter pauses before executing each statement and prints:
- The current source line
- The canonical type (ASSIGN, WHILE_LOOP, SWAP, etc.)
- The condition value for loops and if statements
- The full variable state at that moment
- For swaps: the before and after state of the affected array
Step Output Examples
Assignment and loop
step output
═══ Step 1 ═══════════════════════════════════
Line: "i = 0"
Type: ASSIGN
State: { i: 0 }
═══ Step 2 ═══════════════════════════════════
Line: "while i < len(arr)"
Type: WHILE_LOOP cond = (i < 5) = TRUE
State: { i: 0 }
[Press Enter to continue, q to quit]Swap operation
step output - swap
═══ Step 7 ═══════════════════════════════════
Line: "swap arr[j] and arr[j+1]"
Type: SWAP
Before: arr = [5, 3, 8]
After: arr = [3, 5, 8]
State: { i: 0, j: 0 }
[Press Enter to continue, q to quit]Controls
| Key | Action |
|---|---|
Enter | Advance to next step |
q + Enter | Quit step mode, stop execution |
Teaching Example
Step mode is ideal for teaching algorithms. Run a bubble sort step by step to watch every comparison and swap:
sort.pseudo
func bubbleSort(arr)
for i from 0 to len(arr)
for j from 0 to len(arr) - i - 1
if arr[j] > arr[j+1]
swap arr[j] and arr[j+1]
return arr
bubbleSort([5, 2, 9, 1])bash
pseudo run sort.pseudo --stepSpecial statementsAssignments, swaps, and loops get special step output. All other statements use a default step view.
Combine with --analyze
After stepping through, add --analyze to also see the Big-O complexity:
bash
pseudo run sort.pseudo --step --analyze