Language Specification

Each specification file covers a major area of the language design, and sections are numbered consistently across documents.

1. Leaf

A high-level introduction to Leaf, its compilation pipeline, assumptions, and built-in types.

2. Language Semantics

Covers the foundational semantic rules of the language: scoping, mutability, visibility, closures, function types, variance, type inference, annotations, constants, literals, operators, and strings.

§2.0–2.3 — Core

§2.4–2.9 — Functions

§2.10–2.13 — Values and Operations

§2.14–2.17 — Patterns and Syntax

3. Type System

Describes the advanced type system features: pattern matching, the never type, generators, for loops, and flow control.

4. Structs, Interfaces, Enums, and Collections

Covers struct declarations, the Self keyword, constructors, generics, interfaces, enums, tuples, collections, and type aliases.

§4.1–4.5 — Core

§4.6–4.9 — Data Types

5. Source Files

Explains .leaf source files and their rules.

6. Module Resolution

Details how modules are discovered, how imports work (use, @ for external packages, re-exports), path resolution, circular dependency rules, and visibility.


Topic Index

Cross-cutting topics that span multiple spec files:

Topic Definition API/Standard Library Usage/Patterns
Closures §2.4 semantics/functions.md §2.5 Function Types
Collections §4.8 structs/data-types.md stdlib/types.md §2.14 Destructuring
Enums §4.6 structs/data-types.md stdlib/types.md §3.1 Pattern Matching
Generics §4.4 structs/core.md §2.6 Variance
Interfaces §4.5 structs/core.md stdlib/interfaces.md Conformance
Iterators stdlib/interfaces.md §3.4 For Loops
Numeric Types §2.11 semantics/values.md stdlib/functions.md §2.12 Operators
Tuples §4.7 structs/data-types.md stdlib/types.md §2.14.3 Destructuring
Link copied to clipboard!