Home βΊ Developer Docs βΊ Aether Architecture & Roadmap
Aether Architecture & Roadmap
This document provides a high-level overview of Aetherβs architecture, current status, and future roadmap.
Table of Contents
π For Practical Development: This document focuses on high-level architecture and long-term roadmap.
For day-to-day development guidance, see:
- CLAUDE.md - Quick reference, project status, where to add features
- DEVELOPMENT.md - TDD workflow, testing strategy, code style, common pitfalls
Architecture Overview
Aether is a tree-walking interpreter written in Rust following a classic three-stage pipeline:
Source Code (.ae)
β
[Lexer] βββ Tokens
β
[Parser] βββ Abstract Syntax Tree (AST)
β
[Interpreter] βββ Execution / Output
β
[I/O Thread Pool] (async tasks)
Core Components
| Component | Status | Purpose | Details |
|---|---|---|---|
| Lexer | β Complete | Tokenization | See LEXER.md |
| Parser | β Complete | Syntax analysis | See PARSER.md |
| Interpreter | β Complete | AST execution | See INTERPRETER.md |
| I/O Thread Pool | β Complete | Concurrent I/O | See ASYNC.md |
| Event Loop | β Complete | Callback-based async | See EVENT_LOOP.md |
| REPL | β Complete | Interactive mode | See REPL.md |
| Standard Library | β Complete | Core functions | See STDLIB.md |
| Garbage Collection | β Complete | Memory management | See GC_DESIGN.md |
Project Structure
aether/
βββ docs/ # Comprehensive documentation
βββ stdlib/ # Standard library (written in Aether)
βββ examples/ # Example programs
βββ tests/ # Integration tests (~559 tests)
βββ src/
βββ lexer/ # Tokenization (14 unit tests)
βββ parser/ # Parsing (53 unit tests)
βββ interpreter/ # Execution (17 unit tests)
β βββ evaluator/
β β βββ mod.rs β Evaluator struct, constructors, call_main
β β βββ expressions.rs β eval_expr, eval_index, await_value
β β βββ statements.rs β exec_stmt_internal (all Stmt variants)
β β βββ functions.rs β eval_call, try_submit_io_task
β β βββ members.rs β eval_member, eval_method_call
β β βββ modules.rs β load_module, resolve_module_path
β β βββ operators.rs β eval_unary, eval_binary
β βββ builtins.rs β Built-in function dispatch
β βββ environment.rs β Scope chain
β βββ event_loop.rs β on_ready / event_loop
β βββ io_pool.rs β I/O thread pool
β βββ value.rs β Value enum (16 variants)
βββ repl/ # Interactive mode
Current Status
Phase 5 Complete β
Test Coverage: ~693 tests passing (134 unit + ~559 integration)
Code Quality: cargo clippy clean (5 acceptable mutable_key_type warnings for HashSet)
Whatβs Implemented
Core Language β
- Dynamic typing with runtime type checking
- First-class functions with closures and function expressions
- Primitives: int, float, string (UTF-8), bool, null
- Collections: array, dict (ordered insertion), set (unique, unordered)
- Automatic memory management (Rc-based GC)
- C-like syntax (curly braces, no semicolons)
- String interpolation:
"Hello ${name}" - String indexing:
str[0], slicing:str[1:3] - Multi-line strings:
"""..."""
Control Flow β
- if/else conditionals
- while loops
- for-in loops (array, dict, set, string, iterator)
- Labeled
break/continuefor nested loops - return statements
Error Handling β
try { ... } catch(e) { ... } finally { ... }throw valueβ throw any value as an errore.message,e.stack_traceβ error object properties- Stack traces include filename and line numbers
Null Safety β
??null coalescing (short-circuits if left side is non-null)?.optional member access β returns null instead of throwing?.optional method call β returns null instead of throwing
Structs β
- User-defined types with fields and methods
selfbinding in methods- Mutable fields via
RefCell
Async / Await β
async fnβ returns a Promiseawait exprβ resolves a Promise (polls until ready)Promise.all([p1, p2, ...])β concurrent resolution- Promise result caching
I/O Thread Pool β
set_workers(n)β configure pool size at runtimeAETHER_IO_WORKERSenv var β set at startup- Async:
http_get,http_post,sleep,read_file,write_file - Per-request HTTP options:
{timeout: N, user_agent: "..."} - Env-var defaults:
AETHER_HTTP_TIMEOUT,AETHER_HTTP_USER_AGENT
Event Loop β
on_ready(promise, callback)β register callbackevent_loop([timeout_secs])β run until all callbacks resolve- Chained callbacks (register from inside a callback)
set_queue_limit(n)β backpressure capset_task_timeout(secs|null)β per-callback deadline
Module System β
import moduleβ namespace importfrom module import fn1, fn2β selective importimport module as aliasβ aliased import- User
.aemodules from filesystem + embedded stdlib
Built-in Functions β
- I/O:
print,println,input,read_file,write_file,read_lines,append_file,lines_iter,read_bytes,write_bytes - File system:
file_exists,is_file,is_dir,mkdir,list_dir,path_join,rename,rm - HTTP:
http_get,http_post - Time:
clock,sleep - JSON:
json_parse,json_stringify - Type:
type,len,int,float,str,bool,set - Async:
set_workers,on_ready,event_loop,set_queue_limit,set_task_timeout - Iterator:
has_next,next
Standard Library β (40+ functions, written in Aether)
- Core:
range(),enumerate() - Collections:
map(),filter(),reduce(),find(),every(),some() - Math:
abs(),min(),max(),sum(),clamp(),sign() - String:
join(),repeat(),reverse(),starts_with(),ends_with() - Testing:
assert_eq(),assert_true(),assert_false(),assert_null(),assert_not_null(),expect_error(),test(),test_summary()
Test Coverage
Total: ~693 tests passing β
(2 permanently ignored β deep recursion stack overflow in debug builds)
Unit Tests (134):
βββ Lexer: 14 tests
βββ Parser: 53 tests
βββ Interpreter: 17 tests
βββ Built-ins: 15 tests
βββ Other unit: 35 tests
Integration Tests (~559):
βββ Core features: 29 tests
βββ Async: 21 tests
βββ I/O pool: 14 tests
βββ Event loop: 15 tests
βββ Structs: 14 tests
βββ Iterators: 22 tests
βββ Sets: 24 tests
βββ Null safety: 23 tests
βββ JSON: 25 tests
βββ HTTP: 5 tests (0 ignored β all network-free)
βββ Error handling: 10 + 11 tests
βββ String features: 16 + 9 + 8 + 15 tests
βββ Array methods: 22 tests
βββ Dict: 27 tests
βββ Module system: 13 tests
βββ Stdlib (collections/math/string/core): 38+26+24+9 tests
βββ Stdlib testing framework: 19 tests
βββ Function expressions: 13 tests
βββ GC/leak: 6 + 4 tests
βββ ... (35 test files total)
Roadmap
Completed Phases
| Phase | Description | Tests at completion |
|---|---|---|
| Phase 1 | Core interpreter (lexer, parser, evaluator, REPL) | 102 |
| Phase 2 | Essential features (collections, error handling, modules) | 147 |
| Phase 3 | Standard library (stdlib written in Aether) | 230 |
| Phase 4 | Advanced language features (structs, sets, iterators) | 314 |
| Phase 5 Sprint 1 | Testing framework | 333 |
| Phase 5 Sprint 2 | Advanced types (structs, sets, iterators) | 420 |
| Phase 5 Sprint 3 | Async/await + I/O pool | 476 |
| Phase 5 Sprint 4 | Error context + stack traces | ~547 |
| Phase 5 Sprint 5 | Null safety + Event loop | ~693 |
Near-Term Backlog (Tier 1)
See BACKLOG.md for the full prioritised list. Top items:
matchstatement β pattern matching, replaces chained if/else- Destructuring β
let [a, b] = arr,let {x, y} = dict format(fmt, args...)β printf-style string formatting- Variadic functions β
fn sum(...args)
Tier 2: Type System
- Enums with associated data
- Generics (lightweight)
- Interface / trait system
Tier 3: Networking
- TCP/UDP server support
- WebSocket client
- DNS resolution
Longer-Term
Compiler Improvements
- Bytecode compilation (instead of tree-walking)
- Constant folding and dead code elimination
- Tail call optimization
Runtime Optimization
- JIT compilation for hot paths
- Generational garbage collection
- String interning
Design Principles
Core Philosophy
- Simplicity First β start with straightforward implementations; optimize later
- Test-Driven Development β write tests before implementation; tests serve as documentation
- User Empowerment β stdlib in Aether (users can read and extend); clear error messages
- Pragmatic Evolution β ship working features quickly; iterate based on usage
Technical Decisions
Why Tree-Walking Interpreter?
- Faster to implement and iterate on
- Easier to debug and extend
- Good enough performance for scripting use cases
Why Rust?
- Memory safety without GC overhead (for the interpreter itself)
- Strong type system catches bugs at compile time
- Excellent tooling (cargo, clippy, rustfmt)
Why Rc for GC?
- Simple reference counting
- Predictable, deterministic memory behavior
- No stop-the-world pauses
- Good enough for single-threaded interpreter
Why Stdlib in Aether?
- Validates language expressiveness (βdogfoodingβ)
- User-readable, user-modifiable implementations
- Proves the language works for real code
Why std::sync::mpsc for async?
- No new dependencies β uses Rust stdlib channels
- Worker threads run blocking I/O; main thread stays single-threaded
- All
Value/Rc<T>objects stay on the main thread (thread-safe by design)
Resources
Documentation
Core Implementation:
- DESIGN.md β Complete language specification
- DEVELOPMENT.md β Development guidelines and best practices
- LEXER.md β Tokenization implementation
- PARSER.md β Syntax analysis implementation
- INTERPRETER.md β Execution engine implementation
- REPL.md β Interactive mode implementation
- STDLIB.md β Standard library design
- GC_DESIGN.md β Garbage collection architecture
Language Features:
- STRUCT.md β User-defined types with fields and methods
- ERROR_HANDLING.md β try/catch/finally/throw
- STRING_FEATURES.md β String indexing, interpolation, slicing
- ASYNC.md β Async/await and I/O thread pool
- EVENT_LOOP.md β Callback-based async
- JSON.md β JSON parsing and serialization
- TIME.md β Time functions (clock, sleep)
- HTTP.md β HTTP client functions
- MODULE_SYSTEM.md β Import and module loading
- ITERATOR_PROTOCOL.md β Iterator protocol
- BACKLOG.md β Feature backlog (~30 items, 7 tiers)
External Resources
- Crafting Interpreters by Robert Nystrom
- Writing An Interpreter In Go by Thorsten Ball
- Rust Programming Language Book
Quick Links
- Main README: ../README.md
- Project Guide: ../CLAUDE.md
- Examples: ../examples/
- Standard Library: ../stdlib/
Last Updated: April 29, 2026 Current Phase: Phase 5 Complete β Test Count: ~693 passing