Expand description
Compile-time analysis passes for the LOGOS compilation pipeline.
This module provides static analysis that runs after parsing but before code generation. These passes detect errors that would otherwise manifest as confusing Rust borrow checker errors.
§Analysis Passes
| Pass | Module | Description |
|---|---|---|
| Escape | escape | Detects zone-local values escaping their scope |
| Ownership | ownership | Linear type enforcement (use-after-move) |
| Discovery | discover_with_imports | Multi-file type discovery |
§Pass Ordering
Parser Output (AST)
│
▼
┌──────────────┐
│ Escape Check │ ← Catches zone violations (fast, simple)
└──────────────┘
│
▼
┌─────────────────┐
│ Ownership Check │ ← Catches use-after-move (control-flow aware)
└─────────────────┘
│
▼
Code Generation§Re-exports
This module re-exports types from logicaffeine_language::analysis for
convenience, including:
TypeRegistry,TypeDef,FieldDef- Type definitionsPolicyRegistry,PredicateDef,CapabilityDef- Security policiesDiscoveryPass- Token-level type discovery
Re-exports§
pub use dimension_check::DimensionChecker;pub use dimension_check::DimensionError;pub use escape::EscapeChecker;pub use escape::EscapeError;pub use escape::EscapeErrorKind;pub use ownership::OwnershipChecker;pub use ownership::OwnershipError;pub use ownership::OwnershipErrorKind;pub use ownership::OwnershipFinding;pub use ownership::VarState;pub use types::LogosType;pub use types::TypeEnv;pub use types::FnSig;pub use types::RustNames;pub use check::check_program;pub use check::check_program_collect;pub use check::IndexedTypeError;
Modules§
- callgraph
- check
- Bidirectional type checker for the LOGOS compilation pipeline.
- dependencies
- dimension_
check - Dimension-aware static analysis — rejects dimension-incoherent quantity arithmetic at COMPILE
time, before any code is generated.
2 meters + 1 gramis a type error, not a runtime panic: a length and a mass have no common dimension, so adding them cannot mean anything. - escape
- Escape analysis for zone safety.
- liveness
- ownership
- Native ownership analysis for use-after-move detection.
- policy
- readonly
- registry
- types
- Type inference pass for the LOGOS compilation pipeline.
- unify
- Unification engine for the bidirectional type checker.
Structs§
- Capability
Def - A capability definition:
A User can publish the Document if... - Dependency
- A dependency declaration found in the document’s abstract.
- Discovery
Pass - Discovery pass that scans tokens before main parsing to build a TypeRegistry.
- Discovery
Result - Result of running the discovery pass
- Field
Def - Field definition within a struct
- Policy
Registry - Registry for security policies defined in
## Policyblocks. - Predicate
Def - A predicate definition:
A User is admin if the user's role equals "admin". - Type
Registry - Variant
Def - Phase 33: Variant definition for sum types
Enums§
- Field
Type - Type reference for struct fields (avoids circular deps with ast::TypeExpr)
- Policy
Condition - Condition in a policy definition. Represents the predicate logic for security rules.
- TypeDef
Functions§
- discover_
with_ imports - Recursive discovery with module imports.
- scan_
dependencies - Scans the first paragraph (Abstract) of a LOGOS file for
[Alias](URI)links.