Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

160 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Zane Language Specification

This repository is a prior art publication for the Zane programming language. The techniques described in these documents were conceived and developed by the author and are dedicated to the public domain under CC0 1.0 Universal. Anyone may use these ideas freely, for any purpose, without restriction or attribution. No patent claims are made by the author.


Repository layout

spec/             ← the specification itself (start here): what the language does
stories/          ← design stories: how each part of the spec came to be
contributing/     ← style guides for writing spec docs and stories docs
bench/            ← reference C harness used for runtime experiments

Specification documents

The specification lives in spec/ and is organized by topic. Each document has a single canonical home for its rules; everything else cross-references.

Foundations

Document Purpose
spec/foundations.md The few cross-cutting commitments the whole spec rests on: captured intent, staged compilation, casing-determines-kind, fixed layout, and strictness-as-performance — start here

Reference documents

Document Purpose
spec/syntax.md Canonical surface syntax for every construct
spec/lexical.md Case-sensitive parsing, identifier formation, and the casing-determines-kind rule
spec/glossary.md Canonical names for recurring concepts and coined spec terms

Type system and runtime model

Document Purpose
spec/types.md Classes, structs, fields, constructors, implicit conversions, and type/alias declarations
spec/adt.md Enums, variants, the struct/variant symmetry, pattern matching, match, and enum maps
spec/functions.md Methods, free functions, subscripts, overload resolution, function values, and lambdas
spec/generics.md Unified type parameters, <> type expressions, constructor calls, and the Array<T, n> primitive
spec/memory.md Hosting, guests, anchors, and arena layout
spec/lifetimes.md Lexical lifetime rules, rehosting, scope rules, and deterministic destruction
spec/effects.md The effect model, mut, inferred effect levels, and capability wiring
spec/concurrency.md Implicit parallelism, spawn, water-tower lifetimes, and concurrency safety

Programs and program structure

Document Purpose
spec/control-flow.md if/elif/else, guard, counted loops, and 1-based ordinal rules
spec/operators.md Operator set, derived operators, precedence, and boolean keywords
spec/error-handling.md Bifurcated return paths, ? handlers, and abort/resolve semantics
spec/packages.md Directory-defined namespaces and compilation units, file-scoped imports, explicit member access, package visibility, and package-scope state
spec/dependencies.md Package identity, manifests, version pinning, fetching, and caching

Design stories

The spec states what the language does; the why lives in a parallel set of stories docs under stories/, one per spec document. Each reads as a history — a handful of thematic chapters that recount, in the order the thinking moved, the situation that forced a choice, the roads not taken, and the costs accepted — kept separate so the spec stays terse while the reasoning has room to breathe. They are appended to as the design evolves, so each is the record of how its part of the spec came to be, not just why it is the way it is now.

Document Tells the story behind
stories/foundations.md spec/foundations.md — the bets behind captured intent, staged compilation, casing-determines-kind, strictness-as-performance, and the collapse of value/reference into one # axis
stories/lexical.md spec/lexical.md — casing as a hard-error kind signal and the <> disambiguation it buys, why field privacy lives in the name and reaches across packages, and a delimiter for each kind of separated thing
stories/types.md spec/types.md — the two-axis value/reference model, why # marks a distinct type rather than a box, constructing a type by what it is, confining # to the body forms, why every type must be named, dropping the tuple mould once a named struct does the job better, adding named (dart-style) constructors on the syntax variants introduced, and naming the enum's shape the peer mould
stories/adt.md spec/adt.md — splitting enum from variant against the hype, the shared struct body, escaping the matcher machine with case overloads and the turn to a central match block, matching variants rather than patterns, keeping enum data outside the members, reducing a match group to sugar for one arm per case, and building a variant by naming a case rather than calling a constructor
stories/generics.md spec/generics.md — the parameter model, the <>/() split, size-in-the-type, and the deferred features
stories/dependencies.md spec/dependencies.md — URL identity, the manifest/resolution split, prebuilt distribution, symbol-rewriting, the browsable global cache, the package-graph acyclicity rule, and the opt-in remapping model
stories/memory.md spec/memory.md — the no-GC-no-lifetimes goal, the move problem and the anchor, lazy backpointer creation, the indexed heap table, the rooted-guest rules and the host/guest terminology split, the collapse to one value/reference axis with a borrowed receiver, and the shift to segmented chunked bump arenas
stories/lifetimes.md spec/lifetimes.md — lexical scope in place of a borrow checker, what may be moved, the declaration-block rule that kills flow analysis, downgrade instead of use-after-move, parameter-rooted returned guests, and why each strict rule is the minimal guard against one specific memory corruption
stories/effects.md spec/effects.md — inferring effects instead of annotating them, receiver-scoped mut, capabilities in place of ambient I/O, the four-level ladder and the Total-Pure/Pure split, what deliberately is not an effect, and mutation through a borrowed receiver
stories/concurrency.md spec/concurrency.md — the parallelism/concurrency split and the refusal of async coloring, why spawn marks only a call, water-tower lifetimes, signature-based safety without locks, and value-typed mutation closing the aliased-write gap
stories/error-handling.md spec/error-handling.md — the two-doors model and why failure is control flow rather than a Result value, resolve as expression-substitution rather than assignment, typed abort paths and the deliberately-absent propagate operator, and keeping abortability orthogonal to effects
stories/control-flow.md spec/control-flow.mdguard as an active exit that opens no scope of its own, doing without while behind a written loop bound, and one-based counting after the loop that forced the question
stories/functions.md spec/functions.md — pulling methods out of the type body and the verb model that revealed, mutation made visible with :/!, overloading on parameter shape alone, and why callables are call-only while self-typed lambdas are values
stories/operators.md spec/operators.md — the fixed vocabulary worth overloading, ~ as the universal flip, laws enforced through derived operators, grammar-only grouping, and home-package coherence
stories/packages.md spec/packages.md — the directory as namespace and compilation unit, declarations as move checks, explicit qualified access through $, and keeping mutable state inside values so the effect model can see it

Contributing

Style and structural conventions live in two sibling guides; read the relevant one before editing or adding a document:

About

The spec for the Zane programming language.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages