---
title: "CSSL: Caveman Sigil Substrate Language | Apocky"
url: "https://www.apocky.com/cssl/"
description: "CSSL is a low-level systems language for general use: games, engines, tools or anything else. Effect rows, refinement types and automatic differentiation are part of the language, and it compiles without LLVM."
format: "The page above as markdown, made from its own text at build time. A map of the whole site for machines: https://www.apocky.com/llms.txt"
---

Language

# *CSSL*: Caveman Sigil Substrate Language

A low-level systems language for general use: games, engines, tools or anything else. What a function may do, what a value may hold and how it differentiates are written in the code, and the compiler reads them. It compiles to native code and GPU shaders without LLVM.

**Not CSL.** CSSL is the programming language. [CSL](https://www.apocky.com/csl/) is the notation used to write its specs and reasoning.

## Hello

The smallest program: a `main` that returns exit code 0. The compiler turns this into a working Windows executable.

```
module com.apocky.examples.hello_main

fn main() -> i32 {
    0i32
}
```

## Effect rows

After the return type, a slash and a row of effects say what the function may do: `IO` for input and output, `CPU` and `NoAlloc` for a function that runs on the CPU and should never allocate. Effects are part of the signature, so they show up wherever the function is used.

```
module demo.effects

// The effect row after "/" lists what a function may do.
fn log_line() -> i32 / {IO} { 0i32 }

fn mix(gain : f32) -> f32 / {CPU, NoAlloc} { gain }
```

## Refinements and derivatives

A type can carry a refinement: `f32'pos` is a positive real. A function marked `@differentiable` can be differentiated by the compiler: `bwd_diff` builds the reverse-mode derivative from the source, with no finite differences.

```
module demo.types

// 'pos: a refinement. r is a positive real.
fn shell(r : f32'pos) -> f32 { r }

@differentiable
fn sq(x : f32) -> f32 { x * x }

// Reverse-mode derivative, generated from the source.
fn slope(x : f32) -> f32 { bwd_diff(sq)(x).d_x }
```

## How it compiles

Source goes through a lexer and parser, a typed high-level IR, and a mid-level IR, then to a backend. On the CPU the default backend is Cranelift, with a native x86-64 backend as the alternative. For the GPU the compiler can emit SPIR-V, WGSL, DXIL or MSL. The compiler itself is written in Rust; there is no LLVM anywhere in it.

## Try it

You need Rust (the repository pins 1.85.0). On Windows, the build and the example below work as written.

```
git clone https://github.com/Apocky/CSSL3
cd CSSL3/compiler-rs
cargo build -p csslc
target/debug/csslc build ../examples/hello_main.cssl --emit=exe -o hello.exe
```

`csslc check file.cssl` parses and type-checks without emitting anything; `csslc help` lists the rest.

## Status

Stage 0: the compiler is written in Rust; the plan is for CSSL to compile itself later. The compiler builds and produces working executables, and 9 of the 12 example programs in the repository pass `csslc check`. The other 3 use syntax the parser does not accept yet (unit literals like `1ms` inside effect arguments, among others). Checked 2026-10-26.

Source: [github.com/Apocky/CSSL3](https://github.com/Apocky/CSSL3).
