Reef Language

A modern systems programming language with language-level safe concurrency through Active Objects - data-race freedom by default.

Overview

Reef is a statically-typed systems programming language featuring Active Objects - a unique safety-first concurrency model inspired by A2 Oberon and proven in production for 20+ years. Reef combines the performance of systems languages with guaranteed data-race freedom.

Current Status: Active Development - Research project with working compiler, runtime, and standard library.

Core Strengths

Active Objects

Language-level safe concurrency. Each object runs in its own thread with automatic synchronization. Data-race freedom guaranteed.

Modern Type System

Generics with monomorphization, sum types, pattern matching with exhaustiveness checking, traits, and closures with escape analysis.

Clean Syntax

End-based blocks, Ruby/Crystal-like elegance, string interpolation, pattern matching with guards, and default parameters.

Systems Performance

Native compilation via C backend. Supports inline assembly for AMD64, ARM64, and RISC-V. Baremetal compilation for OS development.

Code Example

active object Counter
    value: int

    init()
        self.value = 0
    end init

    exclusive proc increment()
        self.value = self.value + 1
    end increment

    shared fn get(): int
        self.value
    end get
end Counter

proc main()
    let counter = new Counter()

    // Multiple threads can safely call these methods
    counter.increment()
    counter.increment()

    println("Count: ${counter.get()}")
end main

Technical Details

Compilation

Lexer, parser, type checker, and code generator produce readable C code. GCC/Clang compiles to native executables.

Runtime

~4,000 LOC in C. Mark-and-sweep GC with lazy sweeping (2M+ allocations/sec). Concurrent GC with <1ms pause times.

Standard Library

79 modules: collections, I/O, encoding (JSON, YAML, XML), crypto, compression, networking (TCP, UDP, HTTP), and more.

OS Development

reef-os library for kernel programming. CPU primitives, serial drivers, spinlocks, and Limine bootloader support.

Target Use Cases

  • Concurrent Systems - Web servers, message brokers, real-time systems
  • Systems Programming - Operating system kernels, device drivers, embedded systems
  • High-Performance Computing - Parallel processing, data stream processing
  • Safety-Critical Applications - No data races, type-safe, memory-safe