Vix++ is a thin language layer for Vix-powered C++ applications.
It keeps your code close to standard C++, but removes some of the friction around includes, build flow, and runtime usage.
use vix.core;
use std.iostream;
int main()
{
std::cout << "Hello from Vix++\n";
return 0;
}Vix++ transpiles .vix files into standard C++ files, then delegates the build and execution to the existing vix CLI.
main.vix
↓
vix++ transpiler
↓
.vix/build/vixpp/main.generated.cpp
↓
vix run/build/check
↓
binaryC++ is powerful, fast, and explicit. But the developer experience around includes, build systems, compiler flags, dependency wiring, and project setup can become heavy very quickly.
Vix already makes C++ easier to run:
vix run main.cppVix++ adds a small language layer on top:
vix++ run main.vixThe goal is simple: cleaner source, standard C++ output, Vix-powered build.
Vix++ does not replace C++. It improves the way you write and run C++ applications with Vix.
Vix and Vix++ have separate responsibilities.
Vix = runtime and build engine for standard C++
Vix++ = language frontend for .vix filesVix++ depends on the vix command being installed and available in your PATH. It does not link against the internal Vix CLI code.
Create main.vix:
use std.iostream;
int main()
{
std::cout << "Hello from Vix++\n";
return 0;
}Run it:
vix++ run main.vixVix++ generates:
// Generated by Vix++. Do not edit directly.
#include <iostream>
int main()
{
std::cout << "Hello from Vix++\n";
return 0;
}Then it calls:
vix run .vix/build/vixpp/main.generated.cppVix++ uses use declarations:
use vix.core;
use vix.json;
use std.vector;
use local.config;They are converted to C++ includes:
#include <vix/core.hpp>
#include <vix/json.hpp>
#include <vector>
#include "config.hpp"use vix.core; // → #include <vix/core.hpp>
use vix.http.server; // → #include <vix/http/server.hpp>use std.iostream; // → #include <iostream>
use std.vector; // → #include <vector>
use std.string; // → #include <string>use local.config; // → #include "config.hpp"
use local.services.user; // → #include "services/user.hpp"A .vix file is mostly normal C++. Only use declarations are special in the MVP.
use vix.core;
use std.string;
int main()
{
vix::App app;
return app.run();
}Rules:
usedeclarations must appear before regular C++ code- blank lines are allowed
//comments are allowed before and between imports- duplicate imports are emitted only once
- the rest of the file remains standard C++
vix++ run main.vix # run a .vix file
vix++ main.vix # shortcut for run
vix++ build main.vix # build a .vix file
vix++ check main.vix # check a .vix file
vix++ help # show help
vix++ version # show versionUse a custom Vix binary:
vix++ run main.vix --vix /usr/local/bin/vixUse a custom generated output directory:
vix++ run main.vix --build-dir .vix/generatedForward arguments to Vix:
vix++ build main.vix --out appgit clone https://github.com/vixcpp/vixpp
cd vixpp
vix build
ctest --test-dir build --output-on-failureThe binary is generated as build/vix++. Run an example:
./build/vix++ run examples/hello.vixuse std.iostream;
int main()
{
std::cout << "Hello from Vix++\n";
return 0;
}use vix.json;
use std.iostream;
int main()
{
using namespace vix::json;
auto user = o(
"id", 42,
"name", "Ada",
"tags", a("pro", "admin"));
std::cout << dumps(user, 2) << "\n";
return 0;
}use vix.core;
int main()
{
vix::App app;
app.get("/", [](vix::Request &, vix::Response &res){
res.json({"message", "Hello from Vix++"});
});
app.run(8080);
return 0;
}Vix++ is experimental. The first version focuses on:
.vixfilesuseimports- portable transpilation
- diagnostics
- generated standard C++
- delegation to Vix
- basic tests
It does not try to become a full new language yet.
fnsyntaxletsyntax- automatic package imports
- C++20 module generation
- project import maps
- formatting / linting
- watch mode
- REPL
vixpp/
├── include/vixpp/
│ ├── Diagnostic.hpp
│ ├── ImportResolver.hpp
│ ├── SourceFile.hpp
│ ├── Transpiler.hpp
│ ├── Runner.hpp
│ └── Version.hpp
│
├── src/
│ ├── Diagnostic.cpp
│ ├── ImportResolver.cpp
│ ├── SourceFile.cpp
│ ├── Transpiler.cpp
│ ├── Runner.cpp
│ └── main.cpp
│
├── examples/
├── tests/
├── docs/
└── cmake/Core parts: SourceFile loads .vix files, ImportResolver maps use declarations to C++ includes, Transpiler generates standard C++, Runner calls the installed vix CLI, and Diagnostics reports clear errors.
- Stay close to C++
- Generate readable C++
- Do not hide the runtime
- Do not replace Vix
- Keep imports predictable
- Make the build flow simpler
The developer should always be able to understand what Vix++ generates. Vix++ should make C++ easier to write without making it mysterious.
This project is licensed under the MIT License. See the LICENSE file for details.
Created by Gaspard Kirira
Vix.cpp: [https://github.com/vixcpp/vixpp]