Expand description
CJC Module System
Deterministic module resolution, dependency graph construction, and program merging for multi-file CJC programs.
Design principles:
- All internal maps use
BTreeMapfor deterministic ordering - Symbol mangling:
module_path::fn_name(e.g.,math::linalg::solve) - Cycle detection via DFS with proper error reporting
- Single merged
MirProgramoutput for the executor
Structs§
- Import
Info - A resolved import from one module to another.
- Module
Graph - A directed acyclic graph of module dependencies.
Uses
BTreeMapinternally for deterministic iteration order. - Module
Id - A unique, deterministic identifier for a module derived from its path relative to the project root.
- Module
Info - Information about a single module (source file).
- Visibility
Violation - Errors produced by visibility checks.
Enums§
- Module
Error - Errors that can occur during module resolution.
Functions§
- build_
import_ aliases - Build an alias map from a module’s imports for use during call resolution.
- build_
module_ graph - Build a module graph starting from the entry file.
- check_
visibility - Check visibility constraints after merging.
- merge_
programs - Merge multiple module ASTs into a single combined MIR program.
- resolve_
file - Resolve an import path to a source file, searching from the given root directory.