All are Riddle
All in Riddle
Riddle combines default move semantics with interprocedural escape analysis: values stay on the stack by default, and only promote to a non-moving conservative GC heap when outliving their frame. Enjoy modern expressive syntax, deterministic RAII destructors, and dual execution targets.
struct Point {
x: i32,
y: i32,
}
fun distance_squared(point: Point) -> i32 {
point.x * point.x + point.y * point.y
}
fun main() {
let point = Point { x: 3, y: 4 };
let value = distance_squared(point);
print(value)
} - lifetime annotations
- 0 lifetime annotations
- runtime ABI exports
- 5 runtime ABI exports
- compiler pipeline stages
- 9 compiler pipeline stages
- native backend & MIR interpreter
- C11 native backend & MIR interpreter
Language
Ownership, move semantics, escape analysis, and multi-language comparisons
Core Features
Language Features
Ownership semantics, escape analysis, and deterministic destructors cooperate to ensure memory safety without manual lifetime burden.
Move Semantics & Borrow Checking
Variable assignment, function argument passing, and returns transfer value ownership by default. The compile-time Move Checker statically enforces no use-after-move, validates mutable vs shared borrow conflicts, and prohibits reassignments or transfers while a borrow remains active — with zero runtime reference-counting overhead.
struct Foo {
x: i32,
y: i32,
}
fun main() {
let a = Foo { x: 1, y: 1 };
let b = a;
print(a); // error[E0100]: use of moved value: `a`
print(b);
} Scalars, shared references, raw pointers, and named function items implement Copy by default; &mut T and closures do not.
- User-defined struct and enum types opt into copy semantics via
std::marker::Copy; the compiler verifies that all fields and payloads are Copy-compatible - Fine-grained field-level partial moves are supported;
matchdestructuring tracks ownership per field, leaving untouched sibling fields fully accessible -
Option<T>andResult<T, E>inherit Copy conditionally, remaining Copy only when all inner payload types implementCopy
References Without Lifetimes
Riddle dispenses with explicit lifetime parameters like `'a`. An interprocedural fixpoint escape analysis calculates leaked arguments and return-source dependencies for each function. Non-escaping values remain on the call stack as SSA values or stack allocations; only values whose reference lifetime outlives their current frame are automatically promoted to a non-moving conservative GC heap.
struct Foo {
x: i32,
y: i32,
}
fun make_ref() -> &Foo {
let foo = Foo { x: 1, y: 2 };
&foo // reference escapes the call frame; foo is allocated on the GC heap
} | Escape Analysis Inference | Emitted MIR Instruction |
|---|---|
| Non-escaping local requiring no stable address | SSA register form, no allocation emitted |
| Non-escaping local with address taken, mutation, or ref capture | Alloca, allocated on the stack frame |
| Escaping local whose reference outlives the call frame | HeapAlloc, allocated on conservative GC heap |
| Closure capture context | Allocated as Alloca or HeapAlloc based on capture escape status |
RAII Cleanup with Drop Flags
Types implementing `std::ops::Drop` have their destructors automatically invoked when the owner variable goes out of scope. Whether a value is heap-promoted by escape analysis affects only its physical storage location, never deferring its deterministic destruction timing. Compiler-synthesized drop flags guarantee moved values are never double-freed.
struct FileHandle {
raw: i32,
}
impl Drop for FileHandle {
fun drop(&mut self) {
// close file descriptor and release external resources
}
} Local variables, function arguments, pattern bindings, loop iteration elements, struct fields, and closure capture contexts are all covered by deterministic destructors.
- Compile-time safety invariants: simultaneous implementation of
DropandCopyis rejected, direct invocation of.drop()is forbidden, and partial moves out of explicit Drop types are prohibited -
forloops maintain distinct destruction scopes for current elements, iterator state, and earlybreak/returnexits
Monomorphized Generics & Traits
Traits support default method implementations, associated type definitions, supertraits, and transitive bounds. Generic code is completely monomorphized by the C backend, eliminating virtual dispatch overhead. Const generics allow values like array lengths to participate directly in compile-time type verification.
trait Summary {
fun title(&self) -> &str;
fun summarize(&self) -> &str {
self.title()
}
}
struct Buffer<T, const N: usize> {
data: [T; N],
} Trait default implementations are utilized when unoverridden; explicit impl overrides take precedence.
- Supports
<T: A + B>trait bounds andwhereclauses; impl bounds are strictly verified against the Paterson condition - Operators map to standard traits via
#[lang = "..."]; scalar arithmetic lowers directly into native C operators without wrapper functions -
==/!=map toPartialEq, ordered comparisons map toPartialOrd, with full support for heterogeneous right-hand-side impls
Recursive Pattern Matching
`match` expressions perform recursive exhaustiveness verification across enums, booleans, `()`, integers, tuples, and structs. When matching discrete integers or ranges, the compiler pinpoints any missing coverage by emitting the exact continuous interval gap rather than a vague error.
fun classify(n: i32) -> i32 {
match n {
x if x < 0 => -1,
0 => 0,
_ => 1,
}
} Missing exhaustiveness is reported via diagnostic E0039 with uncovered value intervals.
- Supports or-patterns (
A | B => ...) and match guards; guard failure falls through to subsequent branches without contributing to static exhaustiveness - Full support for unit, tuple, and struct enum variants; payload bindings are accessible inside guard conditions and arm expressions
Native C FFI & Unsafe Boundaries
Declarations inside `unsafe extern "C"` blocks are unsafe by default, allowing audited safe APIs to be explicitly exposed via `safe fun`. The C backend adheres to standard platform ABIs, generating clean external symbol declarations without injecting proprietary wrapper logic.
unsafe extern "C" {
safe fun abs(x: i32) -> i32;
fun malloc(size: usize) -> *mut u8;
}
fun main() {
let value = abs(-42);
let pointer = unsafe { malloc(16) };
} Raw pointer dereferences and indexing must take place inside an unsafe block.
-
&strparameters in C FFI imports map directly toconst char*, while exported functions retain{ ptr, len }fat pointer layouts - Differentiates standard function pointers from
unsafe fun(...) -> Tfunction types, supporting safe upward implicit coercion
Comparative Analysis
Language Design Trade-offs
An objective comparison of Riddle alongside Rust, Go, and Kotlin across syntax and core semantics.
| Riddle | Rust | Go | Kotlin | |
|---|---|---|---|---|
| Function Declaration | fun add(x: i32) -> i32 | fn add(x: i32) -> i32 | func add(x int) int | fun add(x: Int): Int |
| Immutable Binding | let value = 1; | let value = 1; | value := 1 | val value = 1 |
| Mutable Binding | let mut value = 1; | let mut value = 1; | direct reassignment | var value = 1 |
| Memory Model | Move semantics + static borrow checking; only frame-escaping values enter Conservative Non-Moving GCDefault lightweight runtime using mark-sweep without moving objects in memory; only escaping values are allocated here. | Move semantics + borrow checking; explicit lifetime parameters required | Full-lifecycle GC management; no value move semantics | JVM / native GC management across all values |
| Lifetime Annotations | Not required; inferred via interprocedural escape analysis | Explicit lifetime parameters required ('a) | Not applicable | Not applicable |
| Recoverable Errors | Option<T> / Result<T, E> and ? operator | Option<T> / Result<T, E> and ? operator | Multiple return values with explicit error checks | Null-safety operators and exception handling |
| Behavioral Abstraction | trait + impl static monomorphization | trait + impl monomorphization and trait objects | Implicit structural interfaces | Object-oriented interfaces and class inheritance |
| Build & Package Tooling | clue + Clue.toml | Cargo + Cargo.toml | go CLI + go.mod | Gradle / Maven |
| Compilation Backends | Standard C11 emission + built-in MIR interpreter | LLVM IR / native machine code | Go compiler proprietary native backend | JVM Bytecode / LLVM / JavaScript |
Same Ownership Discipline, Distinct Storage Placement
Riddle and Rust share move-by-default semantics for non-Copy types and strictly differentiate immutable &T from exclusive &mut T borrows. Riddle removes explicit lifetime annotations by employing interprocedural Escape AnalysisInterprocedural fixpoint analysis determining whether a reference outlives its frame, dictating stack allocation vs promotion to the GC heap. to detect whether references escape their caller frame, promoting only escaping values to the Conservative Non-Moving GCDefault lightweight runtime using mark-sweep without moving objects in memory; only escaping values are allocated here.. The GC manages physical storage, while move and borrow rules remain uncompromisingly enforced.
Modern Pragmatic Syntax with Orthogonal Primitives
The syntax draws extensively from modern languages: trailing expressions, struct, enum, trait, impl, match, if let, let else, and bracket closures [x -> x + 1]. Callable abstractions are cleanly unified around impl Fn(...) -> T or dyn Fn(...).
Clue: Purpose-Built Build & Package Management
Clue.toml adopts an intuitive manifest format supporting path, git, and sparse registry dependencies locked deterministically in Clue.lock. It provides first-class support for inspecting intermediate C sources and leveraging global build caches.
For in-depth architectural comparisons and migration syntax cheat sheets, see the documentation. Migrating from Rust or Kotlin to Riddle
Compiler Diagnostics
Precise Compiler Diagnostics
Every diagnostic includes a unique error code, multi-label span highlights, context notes, and actionable suggestions.
error[E0300]: cannot borrow `point` as mutable because it is also borrowed as immutable
--> src/main.rid:8:19
|
7 | let shared = &point;
| ------ first borrow occurs here
8 | let mutable = &mut point;
| ^^^^^^^^^^
|
= note: a mutable borrow cannot overlap an existing shared borrow error[E0100]: use of moved value: `token`
--> src/main.rid:6:10
|
5 | take(token);
| ----- value moved here
6 | take(token);
| ^^^^^
|
= note: borrow with `&` if the original value must remain usable error[E0013]: unknown method `or_insert` on type Entry<&str, i32>
--> src/main.rid:7:9
|
7 | entry.or_insert(0);
| ^^^^^^^^^^^^^^^^^^
|
= note: check the impl block and receiver type The official error code index documents every E-prefixed code with detailed explanations and fixes; riddlec, riddle run, and LSP share the identical diagnostic engine. Explore the Error Code Index
Get Started & Toolchain
Quickstart, standard workflow, complete toolchain suite, and editor support
Quick Start
Quick Start Guide
Manage toolchain versions effortlessly with ridup, or extract standalone binaries from GitHub Releases.
- 1
Install Toolchain
Install ridup via Cargo and configure your active channel;
ridup showdisplays the active toolchain and its resolution source.cargo install --git https://github.com/riddle-lang/ridup ridup toolchain install stable ridup default stable - 2
Create and Run a Project
Scaffold a new project with
clue, compile, and execute the resulting native binary.clue new hello cd hello clue check clue build clue run
clue build preserves the generated C code in .clue/build/hello.c. When CC is set, Clue strictly uses that compiler; otherwise it auto-detects clang, gcc, cc, or Windows clang-cl / cl. For instant single-file testing without a C compiler, run riddle run hello.rid to execute directly via the built-in MIR interpreter.
Project Workflow
Clue Project Workflow
clue manages scaffolding, dependency resolution, multi-target compilation, global caching, and API documentation.
- 01
Scaffold Project
Generates
Clue.toml,src/main.ridentrypoint, and a default.gitignore.clue new hello - 02
Static Check
Performs parsing, type inference, escape analysis, and borrow checking without generating C.
clue check - 03
Build Binary
Emits C11 and links an optimized native binary, preserving
.clue/build/hello.c.clue build - 04
Build & Run
Executes the compiled native executable immediately after building.
clue run - 05
Generate Docs
Extracts HIR and doc-comments into an offline static HTML documentation site.
clue doc
- Library build artifacts are cached globally under
$CLUE_HOMEbased on content hashes for cross-project reuse - Sibling dependencies within the same package build concurrently using multi-threaded
-jexecution - Path, git, and sparse registry dependencies resolve into a deterministic
Clue.lock, constrained by--lockedand--offlineflags -
--target,RIDDLE_TARGET, andClue.toml[build].targetoverride the host platform in strict order
Toolchain Suite
One Manager, Four Tools
Composed of the ridup version manager alongside four primary binaries: clue, riddlec, riddle, and riddle-lsp. Precompiled packages are available on GitHub Releases, or buildable from source with Cargo.
ridup
Toolchain & Target Manager
Installs, updates, and switches between Riddle toolchain channels (stable, nightly, and canary) side by side. It manages Riddle releases and target components; system C compilers are detected independently by clue.
ridup toolchain install stable | nightly | canary
-
stableandnightlychannels pull GitHub Release archives, verifying SHA-256 checksums before updating -
canaryfetches latest main commits and compiles locally viacargo build --workspace --release, requiring only Rust and Cargo - Use
ridup toolchain link dev <path>to link a local build directory as a registered custom toolchain - Switch toolchains via
riddle-toolchain.toml, theRIDUP_TOOLCHAINenvironment variable, orclue +dev build - Symlinking or copying ridup as
clue,riddlec,riddle, orriddle-lspenables transparent command proxying - Downloads and canary builds respect standard proxy variables including
HTTPS_PROXY
riddlec
Compiler Driver
Handles parsing, HIR/MIR lowering, type and borrow checking, and C11 code generation in a single binary.
riddlec [--verbose] [--backend c] [--target <triple>] [--emit mir] [--output <file>] <file>...
-
--backend coutputs standard C11 code calling the minimalrgcruntime ABI -
--emit mirprints the full SSA MIR representation of the program for inspection -
--target <triple>selects target platforms, overridable byRIDDLE_TARGETorClue.toml - Automatically bundles the core standard library from
std/lib.rid - Omitting
--backend cruns frontend type and borrow checks without MIR lowering for fast feedback
riddle
Developer CLI
Common developer workflows: code formatting, single-file MIR execution, and interactive REPL exploration.
riddle fmt <file>... | riddle run <file.rid> | riddle repl
-
riddle fmtformats source files or stdin, supporting--check,--emit,--tab-size, and--hard-tabs -
riddle run <file.rid> [-- args] [--seed N]executes a file directly via the built-in MIR interpreter without a C compiler -
riddle replprovides an interactive environment with persistent definitions and instant expression evaluation - Shares the identical formatting engine used by
riddle-lsp
clue
Build System & Package Manager
Manages Riddle projects: creation, checking, compilation, testing, and static HTML API doc generation. Produces native executables, .rlib / .rmeta metadata, and static or dynamic libraries.
clue init | new | check | build | run | doc [--target <triple>]
- Respects explicit
CCenvironments, otherwise detects compatible GCC, Clang, or MSVC C11 toolchains -
--target,RIDDLE_TARGET, andClue.toml[build].targetoverride the host platform in sequence -
ridup target add <triple>installs target runtimes; linking requires target sysroot and SDK libraries - Resolves path, git, and sparse registry dependencies into a deterministic
Clue.lockv3 lockfile -
clue docgenerates self-contained offline HTML API documentation directly from source and HIR - Library build artifacts are cached globally under
$CLUE_HOME; sibling dependencies build in parallel with-j -
clue buildpreserves.clue/build/<name>.cfor reviewing generated C code -
Clue.tomlsupports redirecting[runtime].sourceto custom allocator implementations
riddle-lsp
Language Server
Built on tower-lsp, delivering real-time diagnostics, completion, semantic highlighting, and code actions to modern editors.
- Workspace-wide completion prioritizing unsaved buffers across open files
- Rich semantic token classification distinguishing free functions, methods, structs, enums, traits, and bindings
- Direct error code documentation links, with inline actionable
help:andnote:suggestions
Editor Integration
Editor & IDE Support
The editors/ directory in the repository provides battle-tested configurations and extensions.
- Helix
- VS Code
- Zed
- IntelliJ IDEA 2026.1+
Supported Features
-
.ridfile recognition and syntax highlighting - Incremental diagnostics for Clue projects, unsaved buffers, and closed modules
- Real-time syntax, type, move checking, and borrow conflict reporting
- Semantic highlighting for functions, methods, structs, enums, traits, parameters, and mutable bindings
- Inlay hints for cross-module return types and inferred local variables
- Cross-file completion for fields, instance methods, enum variants, and associated items
- Code actions for mutable closure bindings
- Incremental document synchronization and semantic token delta updates
- Hover inspection, go-to-definition, find-references, symbol renaming, and document formatting
- Workspace indexing with auto-import suggestions
Under Active Development
- Complex semantic refactorings (extract function, inline variable, etc.)
Execution & Architecture
Built-in MIR interpreter, 9-stage compiler pipeline, C runtime ABI, and cross-compilation
Built-in Interpreter
MIR Execution & REPL
crates/interpreter directly executes lowered SSA MIR with semantics aligned with the C11 backend, requiring no local C compiler to run programs or experiment with syntax.
01 · Riddle Source
fun add(a: i32, b: i32) -> i32 {
a + b
}
fun main() -> i32 {
add(2, 3)
} 02 · SSA MIR Representation
module main {
fn add(%0: I32, %1: I32) -> I32 {
block_?(0):
v2 = Add v0, v1 : I32
return v2
}
fn main() -> I32 {
block_?(0):
v0 = iconst(I32) 2 : I32
v1 = iconst(I32) 3 : I32
v2 = call Local("add")(v0, v1) : I32
return v2
}
} 03 · Execution & Exit Code
$ riddle run tiny.rid
$ echo $?
5 The identical MIR is both lowered to C11 and directly executed by the MIRMid-level SSA intermediate representation situated between HIR type checking and backend code generation; shared by the C11 backend and built-in interpreter. interpreter: add(2, 3) maps directly to the process exit code.
Single-File Execution
Lowers to MIR and executes immediately; arguments after -- are forwarded to the program, and --seed sets the RNG seed.
riddle run hello.rid
riddle run hello.rid -- --verbose
riddle run hello.rid --seed 7 Interactive REPL Session
Accumulates top-level definitions, prints expression values while binding them to __, with :mir to inspect MIR and :reset to clear state.
Riddle REPL — type :help for commands, :quit to exit
let x = 5
x * 2
10
:help
commands: :help :reset :mir :quit | expressions print their value and bind `__` | definitions (fun/struct/…) join the session
let mut total = 0
for i in 0..3 { total += i }
total
3
An authentic REPL session: explore language syntax with zero C toolchain setup; panics map precisely back to source locations.
Strictly Aligned with C Backend Semantics
Integer wrapping, division-by-zero and MIN / -1 traps, masked bit shifts, saturating float-to-int casts, and bounds checking behave identically to C11 binaries.
Native Shims for Standard Library
Filesystem I/O, system time, RNG, process controls, and standard I/O are backed by native shims; unshimmed custom extern "C" functions fail explicitly when called.
Shares the Same Compiler Pipeline
REPL let bindings and expressions are wrapped into an internal main function for incremental evaluation, preserving accumulated top-level definitions.
Compiler Pipeline
From Source to C11
riddlec implements an incremental-aware frontend pipeline paired with a C11 backend that generates immediately linkable code.
- 01
Lexing & Parsing
Driven by
IncrementalParserfor efficient local re-parsing - 02
AST Construction
Unified syntax tree representation with attributes attached directly to items
- 03
HIR Lowering
Performs high-level validation including E0040 / E0050 / E0051 / E0052 diagnostics
- 04
Scope Graph & Resolution
Segment-based incremental scope graph with fine-grained invalidation
- 05
Static Type Checking
Type inference and generic constraint solving via
IncrementalTypeChecker - 06
Escape Analysis
Interprocedural fixpoint analysis determining stack vs GC heap placement
- 07
Move Checker
Static verification of use-after-move, borrow conflicts, and reassignments during active borrows
- 08
MIR Lowering
Lowering to strict SSA representation with Phi nodes, basic blocks, and allocation nodes
- 09
C11 Code Generation
Emits standard C11 source linking against the minimal
rgcruntime ABI
clue check terminates immediately after move and borrow checking; MIR lowering occurs only when compiling or running. The identical MIR is consumed by both the C11 backend and the built-in interpreter (riddle run / riddle repl).
Runtime Specification
Minimal C Runtime ABI
Any runtime provider needs only to export these five symbols to handle stack probing, memory allocation, and garbage collection.
void rgc_init(void *stack_bottom);
void *rgc_alloc(size_t size);
void *rgc_realloc(void *ptr, size_t size);
void rgc_free(void *ptr);
void rgc_collect(void); crates/gc provides the default non-moving, conservative mark-sweep collector; custom providers can be specified in Clue.toml under [runtime].source.
- Zero External Dependencies
clue buildcompiles generated C code alongside lightweight runtime source using the standard system C compiler, with no dependency on Boehm GC.- Non-Moving Conservative Collection
- Only values identified by escape analysis as outliving their stack frame enter the GC heap; all other data remains on the stack, and the collector never moves live objects in memory.
- Clear Allocation & Deallocation Contract
rgc_reallocaccommodatesVectorgrowth andrgc_freeenables manual cleanup by the provider; non-GC providers can implementrgc_collectas a no-op.- Fully Replaceable Provider
- The runtime is decoupled from compiler logic, allowing seamless redirection to specialized allocators for embedded or domain-specific environments.
Cross Compilation
Supported Targets
The initial release provides precompiled runtime support across 7 desktop and server architectures ({{triple}}), managed via ridup target add.
-
x86_64-unknown-linux-gnu
Primary 64-bit Linux desktop and server platform
-
aarch64-unknown-linux-gnu
64-bit ARM Linux servers and Apple Silicon Linux
-
i686-unknown-linux-gnu
32-bit x86 Linux architecture
-
x86_64-pc-windows-msvc
Primary 64-bit Windows platform (MSVC toolchain)
-
i686-pc-windows-msvc
32-bit Windows platform (MSVC toolchain)
-
aarch64-pc-windows-msvc
Windows on Arm platform
-
aarch64-apple-darwin
Apple Silicon macOS platform
- Target runtimes and C toolchains are distinct: final linking requires target sysroot, Windows SDK/MSVC libraries, or Apple SDKs
-
clue runexecutes binaries only for the host platform; cross-compiled binaries must be deployed to the destination system - Unsupported triples are rejected explicitly by the compiler, avoiding silent fallback to host targets
ridup target add <triple> installs runtime.c and target.toml locally; missing target SDKs produce clear installation guidance.
Status & Limits
v0.3.0 highlights, capabilities and boundaries, benchmarks, and FAQ
Release Highlights
v0.3.0 Release Highlights
Introduces a built-in MIR interpreter (riddle run / riddle repl), or-patterns in match expressions, global build caching, and static HTML documentation generation.
- 01
Built-in MIR Interpreter (No C Toolchain Required)
crates/interpreterdirectly executes lowered SSA MIR:riddle run <file.rid>compiles and runs single files in milliseconds, whileriddle reploffers an interactive session with cumulative definitions and instant evaluation — neither requiring a local C compiler. - 02
Syntax Standardization & Cleaner Semantics
matchexpressions gainA | B => …or-pattern support; legacyfun(x) { ... }anonymous syntax is completely removed in favor of[x -> x + 1]; integer parsing returnsResult, bitwise operator precedence aligns with Rust and C, andHashMapadopts an idiomatic entry API. - 03
Toolchain Expansion & Global Caching
clue docgenerates static HTML API documentation from HIR and doc-comments; library compilation artifacts are cached under$CLUE_HOMEfor cross-project reuse; sibling dependencies build in parallel using-j; andriddlec --emit mirprints program MIR. - 04
Checker Precision & Edge Case Handling
Reference provenance tracks through nested struct fields and indexing paths;
T: Copybounds participate in Copy inference; and associated types normalize structurally, allowing generic containers destructuringIteratoritems to compile smoothly.
Status & Boundaries
Status & Boundaries
Riddle v0.3.0 is a Technology Preview: language grammar and runtime ABIs are subject to evolution. Below is an honest accounting of supported features and current limitations.
Currently Fully Supported
- Static type inference, Move Checker, borrow checker, and interprocedural escape analysis
- Generics, const generics, trait bounds, and associated types
- Closure captures and static
Fn/FnMut/FnOncecapability checking - Pattern matching with recursive exhaustiveness checking and discrete interval deduction
- Standard
forloops driven byIntoIterator/Iteratortraits -
unsafesemantics and native C FFI interoperability - Fixed-size arrays, slices,
String, andVectorcore standard collections -
std::ops::Dropdeterministic destructors, operator overloading, and C11 backend code generation - Tuple types, tuple pattern destructuring, and enum variants with tuple payloads
- Procedural macro infrastructure and standard derive macros (Default, Hash, Ord, etc.)
- Formatted output supporting positional, named, and debug
{:?}format specifiers - Bracket lambda expressions
[v -> v * 2](legacy anonymous function syntax removed) - Iterator combinators, collection element mutations, and the
vec!macro - Standard library modules: filesystem I/O, system time, high-quality RNG, and parsing primitives
-
riddle fmtcode formatting CLI (shared engine with LSP) - Built-in SSA MIR interpreter:
riddle runandriddle repl(no C compiler required) - Or-pattern matching (
A | B => ...), collection iteration views, andTreeMap/HashMapentries -
clue docoffline HTML documentation generation and multi-threaded dependency building - Precompiled runtimes supporting cross-compilation across 7 primary target triples
- Complete standard library, C11 code generator, project management tool, and LSP language server
Current Technical Limitations
- Formatting currently supports positional, named, and
:?debug markers; width, alignment, and fill specifiers are not yet implemented - Floating-point modulo is not implemented;
RemandRemAssignare currently restricted to integers - Generics rely entirely on static monomorphization; complex lifetime specialization is out of scope
- No explicit named lifetime syntax; half-open ranges, range patterns, and labeled loops are not yet implemented
- Currently single-threaded by design: multithreading, atomics,
async/await, and network socket APIs are not yet included - The lexer accepts
i128/u128/f16/f128tokens, but the semantic type system does not yet support them -
clue buildrequires a local C compiler to produce native executables;riddle run/replrun via the MIR interpreter and do not - Raw function pointer types are not yet supported; callable arguments must be declared as
impl Fn(...) -> Tordyn Fn(...)trait objects
Please note: v0.3.0 makes no backward compatibility promises regarding syntax or ABI. It is designed for technical evaluation, tooling scripts, and language exploration.
Benchmarking
Performance & Benchmarks
Criterion benchmarks protect interpreter hot paths; tests emphasize deterministic correctness over arbitrary hardware scores.
-
loops
Executes 60,000 arithmetic loop iterations, verifying results against constant checksum
1_799_970_000. -
fib
Deep recursive
fib(24)exercising call frame allocations and MIR basic block dispatch, asserting against46_368. -
vector
Frequent pushes and pops on
Vectorcollections, benchmarking container memory interaction paths.
cargo bench - Each benchmark iteration runs
mainin an isolated fresh interpreter session to prevent state leakage - Workloads assert against strict checksums: algorithmic bugs or corrupted intermediate states immediately trigger hard failures
- Hot execution paths are continuously optimized, including eliminating redundant instruction vector cloning during basic block dispatch
Due to machine variability, CI does not gate on raw benchmark times; performance regression guards rely on local cargo bench comparison.
FAQ
Frequently Asked Questions
Direct answers regarding production readiness, backend choices, memory architecture, and ecosystem goals.
Is Riddle production-ready today?
Not yet. Riddle is currently in Technical Preview. Syntax and runtime ABIs remain subject to breaking changes. It is ideal for prototyping, writing developer tools, exploring language mechanics, and providing feedback.
Why compile to C11 instead of directly to LLVM?
The primary reason is that a C backend is straightforward, lightweight, and simple to implement, allowing us to validate end-to-end language semantics quickly with minimal engineering overhead while leveraging existing C compilers for cross-platform builds. Later in development, we plan to transition to compiling directly to LLVM for stronger optimization pipelines and native code generation. In the meantime, the built-in riddle run and riddle repl interpret MIR directly without needing any external compiler.
Why does Riddle not need lifetime annotations?
An interprocedural fixpoint escape analysis infers reference lifetimes automatically. Values are promoted to the non-moving conservative GC heap only when their reference lifetime exceeds their stack frame. The GC handles physical placement, while move semantics and borrow checking remain strictly enforced.
How does Riddle relate to Rust?
Riddle adopts Rust-style ownership, borrow checking, and algebraic data types, but eliminates manual lifetime parameters like 'a. It also removes reference-counting pointer types like Rc and Arc; dyn Trait in Riddle is an owned value.
How does Riddle compare to Go?
Riddle shares Go's philosophy of streamlined toolchains and accessible syntax, but differs fundamentally in its memory architecture: Go depends on an always-on full GC, whereas Riddle uses default move semantics, compile-time borrow checking, and deterministic RAII destruction, reserving GC exclusively for escaping values.
When should I use the interpreter vs the C backend?
Use riddle run and riddle repl for quick single-file scripting, syntax exploration, or running on machines without a C compiler. Use clue build when creating standalone binaries, building libraries, or cross-compiling. Both modes share identical execution semantics.
What is the current standard library coverage?
The built-in standard library provides Option, Result, String, Vector, hash maps and balanced tree views (HashMap / TreeMap), iterator combinators, formatted I/O, filesystem access, high-resolution time, RNG, and basic string parsing. Package ecosystem tooling is powered by clue and sparse registries.
How can I contribute to Riddle?
You can report bugs or propose ideas on GitHub Issues. Writing standard library modules, contributing to The Riddle Book, improving compiler error explanations, and testing editor integrations are high-impact ways to get involved.
Docs & Project
The Riddle Book overview, release milestones, roadmap, and project maintenance
Documentation
The Riddle Book
Maintained directly alongside the compiler across eight comprehensive topic areas.
Getting Started
Language Basics
Ownership & Memory
Abstraction & Errors
Generics & Modules
Collections & Functional
Engineering & Tools
Running clue doc generates the identical offline HTML documentation for your own projects.
Release History
Version History
Every release maps to a Git tag in the repository and validated GitHub Releases assets.
- v0.3.0 2026-09-19
Built-in SSA MIR interpreter (
riddle run/riddle repl), or-pattern matching, collection iteration views,clue docHTML docs, global build caching, and parallel dependency compilation - v0.2.3 2026-09-05
vec!macro, range expressions, iterator combinators, standard filesystem/time/RNG modules, and nine automated LSP quick fixes - v0.2.2 2026-08-25
riddle fmtcode formatter, dynamic trait objects, associated types, doc-comments, and pattern control-flow destructuring - v0.2.1 2026-08-11
LSP workspace indexing, symbol renaming, auto-imports; derive / attribute / function procedural macro exports
- v0.2.0 2026-07-28
Cross-compilation across 7 target triples; project-aware LSP diagnostics, completion, and semantic tokens
- v0.1.1 2026-07-20
Early feedback fixes improving borrow checker stability and HIR lowering
- v0.1.0 2026-07-15
Initial technical preview establishing move semantics, escape analysis, and C11 backend architecture
For detailed release notes, breaking change details, and changelog diffs, see CHANGELOG.md. View all releases on GitHub
Roadmap
Project Roadmap
Priorities follow a strict engineering hierarchy: semantic correctness and memory safety first, fundamental syntax second, standard library and ecosystem following in step.
Core Language
Focusing on semantic correctness, foundational syntax stability, and type checker robustness.
- Labeled
breakandcontinuejump control flow - Half-open range syntax and complete slice/range pattern matching
- Format string completion: width, alignment, and fill specifiers
Standard Library & Tools
Broadening systems-level primitives to facilitate building larger software projects comfortably.
- Buffered I/O (
BufReader/BufWriter) and enhanced string parsing modules - Additional standard collections and higher-order iterator combinators
- Clue dependency resolution performance and incremental caching improvements
Concurrency & Multi-Target
Carefully introducing advanced runtime capabilities once single-threaded semantics are fully solidified.
- Lightweight concurrency and structured async / await asynchronous model
- Direct native compilation backends (LLVM or WASM) alongside C11
- Long-term language grammar and runtime ABI stabilization commitments
Have a feature you want prioritized? Start a discussion or open an issue on GitHub Issues.
Experience Riddle First-Hand
Write, compile, and run Riddle directly in your browser without installing anything locally.