Compilation (LLVM)¶
Q++ compiles directly to native executables via LLVM. There is no C backend—LLVM is the sole codegen path.
No separate LLVM download for end users. The installer and portable zip include everything: - qpp.exe — LLVM codegen is built in (statically linked); no LLVM DLLs required - lld-link.exe (Windows) / ld.lld (Linux) — Bundled linker - runtime.obj / runtime.o — Precompiled stdlib helpers
One download, no additional tools.
For End Users (Installer/Portable)¶
If you downloaded the installer or portable zip: no additional setup required. Run qpp build and it will compile your .q files to executables using the bundled tools.
For Developers (Building from Source)¶
Prerequisites¶
- LLVM 18 — Development libraries must be installed.
- Windows: Download the official tarball from llvm.org or
choco install llvm; setLLVM_SYS_181_PREFIXto the install path - macOS:
brew install llvm@18 -
Linux:
apt install llvm-18-dev(or equivalent) -
Build the compiler:
-
Linking — The compiler uses
lld(LLVM's linker). Either: - Use the installer/portable zip which bundles
lld-link.exe(Windows) orld.lld(Linux) -
Or have LLVM in PATH so
lld-link/ld.lldcan be found -
Runtime (optional) — For programs using
Placestr,vec,fmt, etc., build the runtime:runtime.obj(Windows) orruntime.o(Linux) next toqpp.exeor indist-runtime/.
Usage¶
Or for a specific file:
Emit LLVM IR only (no linking):
Supported Features¶
- Types:
i32,i64,f32,f64,bool,void,str, pointers - Functions: Parameters, return values, modules
- Expressions: Literals (int, float, bool, str), binary ops (including
%,&&,||), unary (-,!), variables, function calls,print/write/writeln - Statements: Variable declarations, assignments,
if/otherwise,send(return),for,loopwhile,defer,with, expression statements
Not yet supported: choose, Result type, ArrayInit, Foreach, TryCatch, structs/classes, InlineC, and others.