Interactive REPL engine for Vix.
Vix Reply powers the interactive vix and vix repl experience. It provides a fast shell for expressions, variables, JSON values, runtime helpers, and real C++ snippets powered by the Vix run pipeline.
Start the REPL:
vixOr start it explicitly:
vix replPass arguments to the REPL:
vix repl -- --port 8080 --mode devInside the REPL:
Vix.args()
>>> println("Hello from Vix Reply")
Hello from Vix Reply
>>> 1 + 2 * 3
7
>>> name = "Vix"
name = "Vix"
>>> type(name)
string
Vix Reply can run real C++ snippets through vix run.
>>> :cpp
C++ mode. Type :run to execute or :cancel to exit.
cpp> #include <vix/print.hpp>
... int main() {
... vix::print("Hello from C++");
... }
Hello from C++
You can also start a small Vix HTTP server from the REPL:
>>> :cpp
cpp> #include <vix.hpp>
... using namespace vix;
...
... int main() {
... App app;
...
... app.get("/", [](Request&, Response& res) {
... res.send("Hello, world");
... });
...
... app.run(8080);
... }
Then test it:
curl http://localhost:8080- Interactive prompt
- Persistent history
- Line editing
- History navigation
- Basic math evaluation
- Variables and JSON values
- Function-style calls
- Runtime helpers through
Vix - Real C++ snippets powered by
vix run
help
version
pwd
cd <dir>
clear
history
history clear
exit
:cpp Enter C++ snippet mode
:run Run the current C++ snippet
:cancel Cancel C++ snippet mode
Vix Reply is not a full C++ interpreter.
C++ snippet mode writes the snippet to a temporary .cpp file and runs it through vix run. The code is validated by the real C++ compiler and uses the normal Vix build, diagnostics, and runtime behavior.
Full documentation is available here:
https://docs.vixcpp.com/cli/repl
#include <vix/reply/core/ReplFlow.hpp>
int repl_flow_run(const std::vector<std::string>& replArgs);The Vix CLI uses this entry point to implement:
vix repl- Interactive REPL prompt
- Persistent history
- Line editing
- History navigation
- Math evaluation
- Variables and JSON values
- Runtime helpers through
Vix - C++ snippet mode powered by
vix run - C++ snippets with normal Vix diagnostics
- Clean Ctrl+C behavior for long-running snippets
- Better autocomplete for variables and helpers
- Better multiline editing
- Snippet cache reuse
- Better C++ snippet session management
- More structured REPL diagnostics
- More runtime helpers
MIT