Skip to main content
Browse guides

CSSL Language Overview

A programming language being developed for Apocky projects.

What is CSSL

CSSL stands for Conscious Substrate System Language. It is a programming language under development for Apocky projects. A programming language is a structured way to write instructions that a compiler can turn into software. The CSSL compiler is named csslc. It currently uses Rust libraries to produce native program files.

Note
One language, three roles
CSSL source files contain program code. Files ending in .csl may also contain compact technical specifications. Code, specifications, and future goals should be identified separately.

Why a new language

The design goal is to make permission boundaries easier to express directly in program code. The proposed Σ-mask type checks are not yet a complete available language feature, so they are described below as planned. The permissions and data sharing guide explains the related design goals.

Sample · the smallest LoA program

This is Labyrinth of Apocalypse/main.cssl, the actual root module that csslc compiles into LoA.exe. Twelve lines of executable code. Every other tick of the engine is delegated to the loa-host staticlib, auto-linked by csslc's default-link mechanism.

Labyrinth of Apocalypse/main.cssl (excerpt)
module com.apocky.loa.main
// § FFI declaration · engine entry-point
extern "C" fn __cssl_engine_run() -> i32 ;
// § main · the pure-CSSL entry-point
fn main() -> i32 {
let exit_code: i32 = __cssl_engine_run() ;
exit_code
}

Sample · scene with FFI

A more representative file: a runtime-procgen city scene. Each extern "C" fn is a host-side staticlib symbol auto-linked at compile time.

scenes/city_central_hub.csl (excerpt)
module com.apocky.loa.scenes.city_central_hub
extern "C" fn scene_open(player_id: u64, world_seed: u128, city_id: u32) -> u32 ;
extern "C" fn scene_procgen_grid(handle: u32, biome_affinity: u32) -> u32 ;
extern "C" fn scene_procgen_npc_population(handle: u32, target_count: u32) -> u32 ;
fn on_scene_enter(player_id: u64, world_seed: u128) -> u32 {
let city: u32 = 1 ; // NeverhomeRise
let h: u32 = scene_open(player_id, world_seed, city) ;
let _g: u32 = scene_procgen_grid(h, city) ;
let _n: u32 = scene_procgen_npc_population(h, 4096) ; // ≥ 4096 NPCs @ 60fps
h
}

Available today — available now

  • module <path> declarations · single-module compile
  • fn name(args) -> T with i8/i16/i32/i64/i128/u8/u16/u32/u64/u128/f32/f64/bool
  • extern "C" fn for FFI to the loa-host + cssl-rt staticlibs
  • struct, let mut, control flow, expressions
  • Cranelift object-file emission · auto-default-link for cssl-rt + loa-host
  • Glyph-tolerant comments and docs (CSL3 dialect)

In progress and planned

Planned
csslc multi-module compile
The 10 sibling modules under Labyrinth of Apocalypse/systems/ and scenes/ are tracked in git but not yet ingested at compile time. The csslc build subcommand currently accepts one positional input. POD-4-D3 unlocks multi-module compile via --module-path or auto-discovery from a manifest. See /docs/cssl-modules.
Planned
Σ-mask in the type system
First-class Σ-masks at reference sites are a proposed way to check permissions during compilation. They are not described here as an available guarantee. See Permissions and data sharing.
Planned
Iterate-everywhere syntax
A planned syntax would combine several kinds of repetition into one form, with the compiler choosing GPU-shader vs CPU-SIMD vs streaming-KAN-edge as the lowering target.

Where to read more