# 01. Language Overview ## 1. Purpose Aji is a low-level systems language optimized for generation, verification and repair by AI agents. The language intentionally has a smaller semantic surface than conventional general-purpose systems languages. ## 2. Explicit by default Aji has no implicit: - heap allocation; - reference counting; - exception propagation; - destructor execution; - network/filesystem authority; - dynamic dispatch; - integer conversion; - thread detachment. The compiler MAY provide source syntax that lowers to explicit AIR, but the semantic operation MUST remain visible in AIR. ## 3. Program structure Illustrative source: ```aji module example; fn add(a: u64, b: u64) -> u64 effects [] { return a + b; } ``` A program is composed of: - modules; - type declarations; - constants; - function declarations; - explicit imports; - optional contracts; - explicit effect declarations. ## 4. Control flow Core structured source constructs are: - `if` / `else`; - `while`; - `for` over verifier-recognized ranges/iterators; - `match`; - `break`; - `continue`; - `return`. AIR lowers these constructs to basic blocks, branches, block parameters and terminators. ## 5. Error handling Aji has no exceptions. Fallible operations return `Result`. ```aji match fs.read(file, buffer) { Ok(n) => consume(n), Err(e) => return Err(e), } ``` Stack unwinding is not part of the language. ## 6. Trap A trap is a defined abnormal termination of the current execution context according to runtime policy. Common trap sources: - checked arithmetic overflow; - failed assertion; - impossible match state in unsafe code; - bounds failure in trapping indexing; - explicit `trap`. Safe programs SHOULD prefer `Result` for expected failures. ## 7. Generics Aji supports monomorphized generics. ```aji fn swap(a: mut, b: mut) { ... } ``` Version 0.1 does not require user-defined traits/typeclasses. Generic constraints use compiler-known structural properties such as `Copy`, `Send`, `Share`, `Freeze` and `Local`. ## 8. Compilation principle Aji source is not the normative execution format. AIR is. A source feature is acceptable only if its lowering to AIR is deterministic, explicit and mechanically verifiable.