Scoria Language mark Scoria Language mark

Scoria Language

v0.2.0 · Free · macOS & Linux · Self-hosted, compiles via C

Scoria is a compiled, memory-safe systems programming language (.sco) that compiles via C to standalone native binaries without garbage collection. Mutation is explicit at both function parameters and call sites, and errors are ordinary values.

Language Tour

Four programs demonstrating tagged enums, explicit call-site mutation, error values, and structural interfaces.

Tagged enums with attached methods, exhaustive pattern matching, and formatted string interpolation.

shapes.sco Source
use std.math

enum shape {
    circle(float r)
    rect(float w, float h)

    float area() {
        switch ~ {
            circle(r): return math.pi * r * r
            rect(w, h): return w * h
        }
    }
}

main() {
    shape[] shapes = [circle(1.0), rect(2.0, 3.0)]
    for s in shapes {
        print("{s} has area {s.area():.2}")
    }
}
scoria run shapes.sco Output
circle(r: 1.0) has area 3.14
rect(w: 2.0, h: 3.0) has area 6.00

The Scoria Book

Twenty-three chapters and six appendices covering the language from installation and value semantics to raw C interop and the compiler internals.

Part 1 · Chapters 1–4

Warming Up

Installation, the scoria command, variables, control flow, text, lists, maps, and a complete first project.

Part 2 · Chapters 5–8

The Scoria Way

Copy-on-write value semantics, explicit & call-site mutation, maybe-values with none narrowing, and errors as values.

Part 3 · Chapters 9–16

Building Real Things

Structs and ~ methods, tagged enums with switch, structural interfaces, generics, lambdas, modules, and testing.

Part 4 & Appendices · Chapters 17–23

The Deep End & Reference

Shared and weak references, defer resources, trust raw pointers and C FFI, compiler internals, and cheat sheets.

Toolchain

The scoria executable packages compilation, incremental split-TU caching, -g debug builds, testing, formatting, trust auditing, and an LSP server in one self-hosted binary, with native support in Basalt IDE and 27 standard modules.

scoria run [-g] <file.sco> Compile via C and execute a Scoria program immediately.
scoria build [-g] <file.sco> Emit a standalone native binary with incremental .scoria-cache/ builds and #line debug info under -g.
scoria check <file.sco> Type-check and validate mutation and error contracts without linking.
scoria test [-g] [file.sco] Discover and execute isolated project test suites.
scoria fmt [--check] <files...> Format Scoria source files to canonical style.
scoria audit <file.sco> [--std] Report all trust blocks, raw pointers, and extern C functions.
scoria init / deps / new Initialize projects and inspect scoria.toml dependencies and C [build] flags.
scoria lsp Start the Language Server Protocol daemon for Basalt IDE and compatible editors.
scoria emit-c [-g] <file.sco> Inspect the generated C source output directly.
scoria version Print the installed compiler and toolchain version.