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 assemble::assemble_project;pub use assemble::assemble_project_with_deps;pub use assemble::check_scopes;pub use assemble::AssembledProgram;pub use assemble::DefKind;pub use assemble::DefSite;pub use assemble::Located;pub use assemble::Provenance;pub use assemble::ScopeInfo;pub use assemble::Segment;pub use assemble::SourceMap;pub use check::check_program;pub use check::check_program_collect;pub use check::check_program_located;pub use check::infer_instantiations;pub use check::root_binding_types;pub use check::CallInstance;pub use check::IndexedTypeError;pub use check::Instantiations;pub use check::LocatedTypeError;pub use check::Site;pub use dimension_check::DimensionChecker;pub use dimension_check::DimensionError;pub use escape::EscapeChecker;pub use escape::EscapeError;pub use escape::EscapeErrorKind;pub use import_hygiene::lint_imports;pub use import_hygiene::lint_imports_with_deps;pub use import_hygiene::ImportLint;pub use import_hygiene::ImportLintKind;pub use import_hygiene::LintSeverity;pub use known_calls::check_unknown_calls;pub use known_calls::check_unknown_calls_with_exports;pub use known_calls::proven_module_exports;pub use known_calls::refuse_retired_calls;pub use ownership::MaybeGivenIn;pub use ownership::OwnershipChecker;pub use ownership::OwnershipError;pub use ownership::OwnershipErrorKind;pub use ownership::OwnershipFinding;pub use ownership::VarState;pub use types::FnSig;pub use types::LogosType;pub use types::RustNames;pub use types::TypeEnv;
Modules§
- assemble
- Source-level assembly of a multi-file / multi-directory LOGOS project.
- callgraph
- check
- Bidirectional type checker for the LOGOS compilation pipeline.
- defined_
real - Which functions may define a real number:
the real number whose digits in base 3 are f,the real number approximated by f. - 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.
- import_
hygiene - Import-hygiene lints — the pit-of-success guardrails that keep a project’s import blocks honest. An UNRESOLVABLE import is already a hard error at assembly (with a “did you mean” suggestion from the loader); this pass finds the problems that ASSEMBLE FINE but are still mistakes: an import that is never used, the same module imported twice, and a module importing itself.
- known_
calls - Definition-time resolution of CALLED NAMES — a call to a name that exists NOWHERE in the program is a check error, not a native-build E0425 or a runtime surprise.
- liveness
- ownership
- Native ownership analysis for use-after-move detection.
- pipes
- Which function parameters carry a pipe.
- policy
- readonly
- registry
- relay
- Whether a program’s pages talk to the relay — and so whether the backend serving them answers
/_relayitself. - tower
- Which values of a program the exact extension reaches: the bindings, function results and parameters that can hold an infinitesimal, a hyperreal, an infinite integer, an algebraic number, a computable real, an ordinal, a residue-dependent value or a provisional answer.
- 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.
- first_
section_ header - A file’s first
##section header outside a ``` fence, as its 1-based line and its text: the line above which anImportmust stand to import anything. - misplaced_
imports - Every
Importsentence below a file’s first##header, each with its byte span. That is wherescan_dependenciesdoes not read, so such a sentence imports nothing: the module is never spliced and the program runs on without it. A caller refuses each at its own line. A line inside a - scan_
dependencies - Scans the first paragraph (Abstract) of a LOGOS file for
[Alias](URI)links.