Skip to content

Stability and Supported Fragment

w4ffl35 edited this page Aug 26, 2026 · 9 revisions

Stability and Supported Fragment

This page is the single source of truth for what Curlee currently supports (and what it explicitly does not), plus what we consider breaking vs allowed changes.

Curlee is currently alpha. Expect iteration — but within the constraints below, Curlee aims to stay deterministic, verification-first, and friendly to automation.


1) Supported syntax (MVP)

See Language Syntax for the full MVP surface syntax.

High-level summary of supported constructs:

  • Items: import (top-level imports), fn (functions). Top-level let is documented but may remain restricted.
  • Statements: let, assignment (x = expr; on an existing local binding), expression statements, return, if/else, while, blocks { ... }.
  • Expressions: literals (Int, Bool), names, grouping (...), calls, + - * / %, bitwise (& | ^ ~ << >>), comparisons, boolean connectives.
  • Contracts: bracketed contract block after a function header:
fn divide(numerator: Int, denominator: Int) -> Int [
  requires denominator != 0;
  ensures result * denominator == numerator;
] {
  return numerator / denominator;
}

Notes:

  • Each contract clause ends with ;.
  • result is reserved inside ensures.
  • If a contract/refinement predicate is outside the supported verification scope, Curlee must hard-error (no silent weakening).

2) Supported verification scope (MVP)

Curlee’s supported logic fragment is intentionally small and decidable.

  • Canonical spec: Verification Scope
  • If a predicate uses out-of-scope constructs, Curlee rejects the program with a span-precise diagnostic.

3) Supported runnable subset (MVP-run)

Curlee’s execution path is verification-gated:

  • curlee run only runs if curlee check succeeds.

The runnable subset is intentionally conservative for MVP:

  • Deterministic VM with an explicit fuel budget.
  • Control flow: if/else, while.
  • Calls: direct calls are supported (named calls and module-qualified calls). Callee expressions are not first-class.

See Running Programs for operational details, including fuel.


3.5) Supported freestanding fragment (curlee build)

The freestanding target (curlee build --target freestanding-c) is verification-gated: no proof, no build (nothing is emitted on failure). It is Linux/x86-64 only and has no hosted builtins.

Surface Status
Int, Bool, U8/U16/U32 arithmetic ✅ supported
U64 construction from an Int/literal (binding positions: let, ghost snapshots, struct-literal fields; compile-time-known literal must satisfy 0 <= value < 2^32) ✅ supported (issue #277; out-of-range/negative literal = hard error)
U64 == U64 comparison ✅ supported
U64 arithmetic and mixed U64/Int comparisons ❌ out of scope (rejected)
Bitwise ops + shifts (& ` ^ ~ << >>) and %onInt`/unsigned element kinds
struct / enum (storable payloads only) ✅ supported
match, if/else, while ✅ supported
Contracts (requires / ensures / where) ✅ verified before build
extern fn (assumed contracts) ✅ supported (see Verification Scope)
Phys<T> + read()/write() under unsafe + cap phys.mem ✅ supported (trusted deref, opaque reads)
x86 port I/O port_inb/port_outb/port_inw/port_outw/port_inl/port_outl (constant or let-bound-base + constant-offset ports, under unsafe + cap phys.mem) ✅ supported (opaque reads, inline in/out asm; DX-register form for runtime ports)
Fixed-size mutable arrays [T; N] in freestanding locals (let q: [T; N] = [v; N]; + indexed read/write q[i] / q[i] = v; T = Int/U8/U16/U32/U64) ✅ supported (issue #278; codegens to a C array; [0; N] -> {0} zero-fill; bounds obligation on every access)
Arrays in struct fields / enum payloads / parameters / return types / ghost snapshots; multi-dimensional indexing; array element reads in contracts ❌ rejected (freestanding-local let bindings only in the MVP)
Runtime surface: curlee_halt, curlee_panic, weak curlee_putc, memset/memcpy/memcmp ✅ provided by runtime/rt.c
print, String, Vec, python_ffi ❌ rejected (hosted-only)
Phys/Unit in storage positions (struct field, enum payload) or returns ❌ rejected

The freestanding runtime is deliberately not libc: no malloc, no printf, no filesystem, no threads. malloc/printf are user-provided where a driver needs them.


4) Stability promises

Curlee is alpha. The promises below are pragmatic and testable.

4.1 What is considered stable

  • The project’s verification-first principle: “no proof, no run”.
  • Determinism of verification + VM execution for supported programs.
  • The definitions in this page and Verification Scope as the authoritative statement of what’s supported.

4.2 What may change (even in alpha)

  • Diagnostics wording/formatting may change (golden tests should be updated intentionally).
  • Internal IR/bytecode details may change.
  • CLI flags may be added.

5) Breaking vs allowed changes

Breaking changes include:

  • Any change to the MVP surface syntax in Language Syntax.
  • Any narrowing of the supported scope in Verification Scope.
  • Any change that makes a previously-accepted program fail to parse/typecheck/verify/run within the supported fragment.
  • Any incompatible change to user-facing bundle formats or CLI outputs intended for scripting.

Allowed (non-breaking) changes include:

  • Adding new syntax/features (as long as old programs in the supported fragment keep working).
  • Expanding the verification fragment (with corresponding updates to Verification Scope and tests).
  • Improving diagnostics (with deliberate golden test updates).
  • Performance improvements that preserve determinism and results.

Clone this wiki locally