This roadmap outlines the path from current state (lexer + parser) to a complete, production-ready language.
Current State Goal
│ │
▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ Lexer │ → │ Parser │ → │ Type │ → │ Codegen │ → │ Runtime │
│ ✅ │ │ ✅ │ │ Checker │ │ WASM │ │ Rust │
└─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘
│
┌────────────┼────────────┐
▼ ▼ ▼
┌────────┐ ┌─────────┐ ┌─────────┐
│ Borrow │ │ Effect │ │Refinemt │
│Checker │ │Inference│ │ SMT │
└────────┘ └─────────┘ └─────────┘
Status: Done
- Project structure (Dune)
- Lexer (Sedlex)
- Parser (Menhir)
- AST definitions
- Error infrastructure
- CLI skeleton
- Test framework
- Academic documentation
Goal: Type check simple programs without effects or ownership
Duration: 8-12 weeks
- Symbol table structure
- Scope management
- Module path resolution
- Import resolution
- Visibility checking (pub, pub(crate), etc.)
Files: lib/resolve.ml, lib/symbol.ml
- Kind inference
- Kind unification
- Higher-kinded types
- Row kinds
- Effect kinds
Files: lib/kind.ml
- Bidirectional type checking
- Type synthesis
- Type checking mode
- Subsumption rule
Files: lib/typecheck.ml, lib/check.ml, lib/synth.ml
- Type unification
- Occurs check
- Union-find structure
- Error messages for unification failures
Files: lib/unify.ml, lib/union_find.ml
- Let-generalization
- Instantiation
- Value restriction
- Type application
- Record row unification
- Variant row unification
- Lacks constraints
- Row rewriting
Files: lib/row_unify.ml
- Type mismatch errors
- Undefined variable errors
- Source location tracking
- Suggested fixes
Milestone: affinescript check works for simple programs
Goal: Full QTT and effect system
Duration: 8-12 weeks
- Quantity context tracking
- Context scaling
- Context addition
- Usage analysis
- Quantity error messages
Files: lib/quantity.ml
- Effect signature checking
- Effect row inference
- Handler typing
- Effect unification
- Effect polymorphism
Files: lib/effect.ml, lib/effect_infer.ml
- Handler completeness
- Return clause typing
- Operation clause typing
- Continuation typing (linear vs multi-shot)
- Unhandled effect errors
- Effect mismatch errors
- Handler clause errors
Milestone: Effects and quantities fully checked
Goal: Memory safety verification
Duration: 6-10 weeks
- Move semantics
- Ownership transfer
- Drop insertion
- Copy trait handling
Files: lib/ownership.ml
- Borrow tracking
- Conflict detection
- Non-lexical lifetimes
- Dataflow analysis
Files: lib/borrow.ml, lib/dataflow.ml
- Lifetime constraints
- Lifetime solving
- Lifetime elision
- Lifetime bounds
Files: lib/lifetime.ml
- Quantity affects ownership
- Linear ownership (1)
- Shared ownership (ω + Copy)
- Erased types (0)
Milestone: affinescript check catches all ownership errors
Goal: Dependent types with SMT verification
Duration: 6-10 weeks
- Π-type checking
- Σ-type checking
- Type-level computation
- Normalization
Files: lib/dependent.ml, lib/normalize.ml
- Z3 OCaml bindings
- Predicate translation
- Validity checking
- Model extraction (for errors)
Files: lib/smt.ml, lib/smt_translate.ml
- Refinement subtyping
- VC generation
- SMT queries
- Refinement error messages
Files: lib/refinement.ml
- Termination analysis
- Structural recursion
- Custom measures
- Total annotation
Files: lib/totality.ml
Milestone: Full type system complete
Goal: Compile to WebAssembly
Duration: 10-14 weeks
- ANF transformation
- Effect evidence insertion
- Closure conversion
- Lambda lifting
Files: lib/ir.ml, lib/anf.ml, lib/closure.ml
- Dead code elimination
- Inlining
- Constant folding
- Linearity-aware optimizations
Files: lib/optimize.ml
- WASM module structure
- Function compilation
- Type mapping
- Memory layout
Files: lib/wasm.ml, lib/codegen.ml
- Evidence-passing transform
- Handler compilation
- Continuation representation
- One-shot optimization
Files: lib/effect_compile.ml
- Drop insertion points
- Move compilation
- Borrow elimination
Milestone: affinescript compile produces working WASM
Goal: Minimal Rust runtime for WASM
Duration: 6-8 weeks
- Project structure
- Memory allocator
- Panic handling
- Stack management
Location: runtime/ (new Rust crate)
- Evidence structures
- Handler frames
- Continuation allocation
- Resume implementation
- Mark-sweep for ω cycles
- Root tracking
- Finalization
- WASI integration
- JavaScript interop
- Console I/O
- File system
Milestone: Programs run correctly
Goal: Usable standard library
Duration: Ongoing (8+ weeks initial)
- Prelude
- Option, Result
- Tuples
- Unit, Bool, Never
Location: stdlib/core/
- List
- Vec (growable array)
- HashMap
- HashSet
- BTreeMap
Location: stdlib/collections/
- String
- Char
- Formatting (Display, Debug)
- Parsing
Location: stdlib/text/
- IO effect
- State effect
- Exn effect
- Async effect
- Reader effect
Location: stdlib/effects/
- Int, Float
- Numeric traits
- Math functions
Location: stdlib/num/
Milestone: Self-sufficient programs possible
Goal: Developer experience
Duration: Ongoing (10+ weeks initial)
- LSP implementation
- Diagnostics
- Hover information
- Go to definition
- Find references
- Completion
- Rename
Location: tools/affinescript-lsp/
- Canonical formatting
- Configuration options
- Editor integration
Location: lib/format.ml, bin/fmt.ml
- Expression evaluation
- Type printing
- Effect handling
- History
Location: bin/repl.ml
- Manifest parsing
- Dependency resolution
- Package fetching
- Lock file
- Publishing
Location: tools/affine-pkg/
- Doc comments
- API documentation
- Search index
Location: tools/affine-doc/
Milestone: Professional development experience
Goal: Community and adoption
Duration: Ongoing
- Syntax highlighting
- LSP client
- Snippets
- Debugging
Location: editors/vscode/
- Web REPL
- Shareable links
- Examples
Location: playground/
- Registry backend
- Web frontend
- CLI publishing
- Tutorial
- Language reference
- API docs
- Blog
- Hello World
- Web server
- CLI tool
- Library
Milestone: Community can build real projects
| Version | Contents | Target |
|---|---|---|
| 0.1.0 | Type checker (no effects/ownership) | Phase 1 |
| 0.2.0 | Full type system | Phase 2-4 |
| 0.3.0 | WASM compilation | Phase 5-6 |
| 0.4.0 | Standard library | Phase 7 |
| 0.5.0 | Tooling (LSP, formatter) | Phase 8 |
| 0.9.0 | Release candidate | Phase 9 |
| 1.0.0 | Stable release | All phases |
- OCaml (compiler)
- Rust (runtime, tooling)
- Type theory (checker design)
- WASM (code generation)
- ReScript/Deno (web tooling)
- CI/CD (GitHub Actions)
- Package registry hosting
- Documentation hosting
- Playground hosting
- 100+ test programs type check correctly
- Error messages are helpful
- <1s for typical file
- All language features work
- Performance competitive with Rust/Go
- 10+ community packages
- 3+ production users
- Complete documentation
Last updated: 2024