Skip to content

What is Sigil?

density = sovereignty

Sigil (also called CSSLCaveman Sigil Substrate Language) is a compiled, statically-typed systems programming language built for domains where invariant violations are catastrophic: GPU/graphics pipelines, real-time audio, physics simulation, and high-performance numerical code.

It is not a scripting language. It is not a transpiler. It compiles directly to native x86-64 and SPIR-V, without LLVM in the pipeline.

Sigil gives you a type system that can express where code runs (CPU vs. GPU), what effects it has (I/O, allocation, mutation), and what mathematical invariants hold on your data — all checked at compile time. A coordinate-space confusion that would silently produce wrong pixels in C++ becomes a type error in Sigil. A GPU shader that accidentally touches CPU memory becomes a type error. A gradient computation that diverges from its mathematical definition becomes a type error.

The compiler emits:

  • x86-64 machine code for CPU targets (via Cranelift JIT/AOT)
  • SPIR-V for GPU targets (Vulkan, compatible with modern GPU drivers)

There is no LLVM dependency. The backend is Cranelift, the same code generator used by Wasmtime. This keeps the compiler self-contained and fast.

Effects in Sigil are part of the type of every function. A function that does I/O has a different type than one that doesn’t. The effect row propagates automatically and is checked at every call site.

// This function is pure — no effects. The compiler can freely inline,
// reorder, and memoize it.
fn magnitude(v: Vec3) -> f32 {
(v.x * v.x + v.y * v.y + v.z * v.z).sqrt()
}
// This function has the !io effect — it touches the outside world.
fn log_magnitude(v: Vec3) !io {
println!("{}", magnitude(v));
}
// This function has !gpu — it runs on the GPU, not the CPU.
// Calling it from CPU-side code is a compile error.
#[shader(fragment)]
fn shade(uv: Vec2, sdf: Sdf) -> Vec4<Color> !gpu {
let d = sdf.eval(uv);
Vec4::splat(d.clamp(0.0, 1.0))
}

Differentiation is a first-class operation in the type system. You can take the derivative of any function that satisfies the Differentiable constraint. No external AD library, no tape-based overhead — the compiler handles it.

fn loss(params: &[f32]) -> f32 { /* ... */ }
// ∂loss/∂params — computed by the compiler, not at runtime
let grad = ∂loss;

This is a compile-time transformation. The generated gradient code is as efficient as hand-written backpropagation.

Sigil embeds a connection to an SMT solver (Z3) for invariant checking. You can annotate functions and types with properties that the compiler will attempt to prove:

// The compiler checks that this can never return a value outside [0, 1]
#[ensures(result >= 0.0 && result <= 1.0)]
fn normalize_score(raw: f32) -> f32 { /* ... */ }

When the solver can’t prove a claim automatically, it gives you a counterexample.

  • 31 Rust crates — a modular, layered architecture
  • Cranelift JIT and AOT backend (no LLVM)
  • Effect system baked into the type checker
  • Autodiff as a first-class IR transformation
  • Z3 integration for SMT-based verification
  • Public repository: github.com/Apocky/CSSL3

Not a graphics API. Sigil compiles to SPIR-V and runs inside your existing Vulkan setup. It doesn’t own the window, the swapchain, or the draw commands.

Not a game engine. Sigil is a language. It has no entity system, no scene graph, no asset pipeline. It gives you the expressive power to build those things correctly.

Not a research toy. The design goals are practical: compile fast, run fast, eliminate a specific class of production bugs. The effect system and autodiff are engineering tools, not academic novelties.

Not CSLv3. CSLv3 is a notation system — a dense formal language used for writing specs and reasoning about programs. It is not a compiled language. You’ll see CSLv3 notation in spec source blocks throughout this KB; it describes what the compiler does, it is not what you program in.

Why Sigil Exists — the LoA bug history that motivated the design