An interactive REPL for Vulpin. Keeps a single VM alive for the whole
session — variables, functions and labels persist across inputs — and includes
live, as-you-type syntax highlighting, multi-line block support (?...;, @...&,
F...~, etc.), and a handful of REPL-only commands.
The REPL links directly against Vulpin's own VM/parser (vm.c/vm.h), vendored
as a plain clone rather than committed here, so grab that first:
git clone https://github.com/vulpin-lang/Vulpin vendor/VulpinThen build:
cd repl
make # -> ./vulpin-repl
make cleanRequires gcc and GNU readline (used only for history storage, e.g. on Arch:
sudo pacman -S readline; on Debian/Ubuntu: sudo apt install libreadline-dev).
./repl/vulpin-repl # start an interactive session
./repl/vulpin-repl script.vul # load & run a file first, then drop into the REPL
./repl/vulpin-repl --debug # dump the parsed AST for every accepted input
./repl/vulpin-repl -e 'G 1+2' # run one snippet non-interactively and exitInside the REPL, write Vulpin exactly as you would in a .vul file — see the
Vulpin README for the language
itself. A few examples:
vul> x=5
vul> G x
5
vul> @ i < 3
...> G i
...> i=i+1
...> &
0
1
2
Multi-line constructs (?/:/;, @/&, O/&, F/~, T/C/Y,
W/V/N/Z) are detected automatically — the prompt switches to ...> until
the block is closed, then the whole thing runs at once.
| Command | Effect |
|---|---|
:help |
show the command list |
:vars |
list variables assigned so far, with their current values |
:load <file> |
parse & run a .vul file into the current session |
:debug |
toggle AST dump for each accepted input |
:reset |
start a fresh VM, clearing all state |
:abort |
discard a pending, not-yet-closed multi-line input |
:quit / :q |
exit |
The input line has its own raw-mode editor (not GNU readline) so it can recolor
tokens live as you type: Left/Right/Home/End/Delete/Backspace,
Ctrl-A/Ctrl-E/Ctrl-K, Up/Down for history, Ctrl-C to clear the current
line, Ctrl-D on an empty line to exit. History persists across sessions in
~/.vulpin_history.
Colors are used automatically when stdout is a terminal, and skipped automatically when piped (e.g. in scripts or tests).