Research project · Active Development · v0.9.2

A systems language unlike the others.

Reef pairs Oberon's Active Objects with the expressiveness of Ruby and Crystal — compiled to native code, from userland to bare metal.

Get started Read the docs
counter.reef
module main

active object Counter
  count: int

  init()
    self.count = 0
  end init

  // exclusive: takes the write lock
  exclusive proc increment()
    self.count = self.count + 1
  end increment

  // shared: may run concurrently
  shared fn get(): int
    self.count
  end get
end Counter

proc main()
  let c = new Counter()
  c.increment()
  c.increment()
  println("Count: ${c.get()}")  // 2
end main

end module
Overview

Reef is a statically-typed systems programming language that combines three things which rarely appear together: the Active Object concurrency model from Oberon, the expressiveness of languages like Ruby and Crystal, and native compilation that runs anywhere from userland to bare metal.

Active Objects come from A2 Oberon and two decades of research at ETH Zürich. Each Active Object owns its state and guards it with a lock, so concurrent access is synchronized by the language rather than by programmer discipline.

Data-race freedom for Active Object state, enforced at compile time. exclusive methods hold the write lock and are mutually exclusive; shared methods hold a reader lock and may run concurrently — and the compiler rejects any attempt to mutate the object's state from a shared method.

The syntax is built for people, not for parsers: end-based blocks, string interpolation, pattern matching with guards, generics, sum types, and traits. Reef compiles to C and then to native code through GCC or Clang — with no VM and no runtime dependency, the same toolchain path, and the same optimizer, that C code takes.

Reef is pre-1.0: the language is stable enough to build real systems in, and we are still changing it.

Core strengths

Nothing else looks quite like this — safe concurrency, an expressive surface, and bare-metal reach in one language.

Active Objects

Language-level safe concurrency. Each object owns its state and guards it with a lock — exclusive takes the write lock, shared takes a reader lock and runs concurrently. The compiler rejects state mutation from a shared method. Objects declaring run() get their own thread.

Passive Objects

Heap classes with single inheritance and virtual methods — extends, override, inherited, and typecase. Not a monitor: that remains Active Objects. See the objects chapter.

Modern type system

Statically typed, with generics, sum types, traits, and pattern matching with guards. The type checker catches the mistakes before code generation ever runs.

Clean syntax

End-based blocks, string interpolation, and readable declarations. The surface is built for people, not for parsers — close to Ruby and Crystal in feel.

Native, no runtime

Reef compiles to readable C, then to native code through GCC or Clang — no VM, no language runtime beyond a small C library. The same optimizer path C takes; verify it with reefc --emit-c.

Under the hood

Compilation

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

Runtime

Portable C99 runtime and no Virtual Machine. A mark-and-sweep collector with concurrent marking and lazy sweeping — application threads keep running while it marks. Precise stack scanning via a shadow-frame chain: the collector knows exactly which slots hold pointers.

Standard library

20 packages, 158 modules: collections, I/O and filesystem, text processing, encoding (JSON, YAML, TOML, CSV, MessagePack, base64), hashing (SHA-256, SHA-1, MD5, HMAC, CRC32), compression (gzip, zlib, zip, lz4), networking (TCP, UDP, Unix sockets, DNS, HTTP, TLS), and ReefVision (desktop/widgets).

OS development

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

Examples

Eight programs that compile and run verbatim against the released v0.9.2 compiler — from a hashing CLI and a widget-tree Objects demo to a bare-metal kernel that boots under QEMU.

Hashing
reefsum

A checksum CLI — SHA-256 a file, matched against system sha256sum.

Encoding
json_pretty

Parses JSON to typed values and prints a key/value + type-count summary.

Networking
https_test

A TLS 1.3 GET over the system OpenSSL backend, returning 200 OK.

Compression
reefzip

A gzip round-trip through system zlib — recovers the original byte-for-byte.

Compute
mandelbrot

Renders a 400×300 fractal to a PPM image — shipped with a pre-rendered PNG.

Bare metal
kernel_limine

A freestanding kernel that boots to a serial banner under QEMU via Limine.

Concurrency
parallel_hash

Active Objects hashing files in parallel — deterministic output, regression-tested on every push.

Every entry shows full source and real output side by side.

Browse examples
License & availability

Open source under the Apache License 2.0 with the LLVM runtime-library exception. Programs you compile carry no attribution obligation from the embedded runtime, and may be combined with GPLv2 software. Apache-2.0 includes an explicit patent grant.

No contributor license agreement is required. Reef is developed by Leafscale, LLC; however, anyone can contribute, build on, and use Reef.

Full license & terms
Current release
v0.9.2
Platforms
Linux · macOS · FreeBSD · OpenBSD · NetBSD · illumos

Where Reef fits

Concurrent systems

Web servers, message brokers, pipeline and worker systems.

Systems programming

Operating-system kernels, device drivers, embedded systems.

High-performance computing

Parallel processing, data-stream processing.

Research & language design

A working testbed for Active Object concurrency on real hardware.

Build something on the reef.

Build the compiler from source, read the docs, and compile your first Active Object.

Install Reef Read the docs