purrc — the compiler
🐱 Reads .purr, writes native code — via modern C++. 🐆
purrc is the cheatah compiler. It transpiles a .purr source file to modern C++, then invokes the system C++ compiler (-O3 -march=native) to produce a native loadable module that the cheatah runtime loads and runs.
purrc hello.purr -o hello.so # compile a program to a native module
cheatah hello.so # run itThe pipeline
hello.purr → [ lexer → parser → codegen ] → hello.gen.cpp → system C++ compiler → hello.soThe front end (compiler/) lexes, parses, and lowers cheatah to value-semantic C++ — no raw new/delete, structs to structs, interfaces to C++20 concepts, and so on (see cheatah ↔ C++). The generated translation unit exports purr_main; there is no main(). You can see exactly what it emits on the Transpiler page.
The three things purrc can produce
Which artifact you get is chosen by mode flags. Everything else on this page tunes one of these:
You want | Command | Output |
|---|---|---|
A runnable program |
| a loadable module the runtime runs |
An importable library (a |
| a signed |
A fast type-check (editors; no output) |
| nothing — just diagnostics |
How a built module is then found by an import is the Imports & module resolution page.
Flags
purrc takes exactly one .purr input (the first non-flag argument). All flags:
Mode — what to produce (mutually exclusive; default is "compile a program")
Flag | Effect |
|---|---|
| Emit an importable cheatah library module (a signed header, |
| Type-check only: syntax + type errors reported against the |
| Standalone: generate an Ed25519 keypair ( |
| Print the purrc version and exit. |
| Print usage and exit. |
Output & library shape
Flag | Effect |
|---|---|
| Output path. Defaults to |
| (with |
| (with |
| (with |
Resolution & linking
Flag | Effect |
|---|---|
| Add |
| Extra input for the final link (an archive path or a |
| Extra C++ compile flag, forwarded verbatim to the backend (e.g. |
Integrity sidecars (feed the runtime's opt-in verification)
Flag | Effect |
|---|---|
| Write a |
| Ed25519-sign the module with a code-signing key → |
| Write a |
| Sign the |
Generate keys with --keygen; the runtime page covers how these sidecars are checked.
Codegen control
Flag | Effect |
|---|---|
| Validate the generated C++ before compiling it (hook is wired; currently a no-op). |
| Keep unused locals — skip dead-local elimination. |
| Disable all generated-C++ optimizations (today this is exactly the dead-local pass, i.e. same as |
| Skip the hardware-crypto power-on self-test (trust CPUID for SIMD crypto). The self-test is on by default. |
Environment variables
purrc reads three environment variables at run time (the rest of its configuration — the C++ compiler, flags, stdlib root — is baked in by CMake at build time):
Variable | Effect |
|---|---|
| Whitespace-separated extra compile flags, appended like repeated |
|
|
| Path to a trust list of authorized Ed25519 signing keys; when set, imported library modules must carry a valid signature (strict, fail-closed). |
See also
The cheatah runtime — what loads and runs the
.sopurrc builds.Imports & module resolution — how
importfinds modules purrc emits.biome — the package manager that invokes purrc with the right roots.
