Skip to main content

Crate cjc_module

Crate cjc_module 

Source
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 BTreeMap for deterministic ordering
  • Symbol mangling: module_path::fn_name (e.g., math::linalg::solve)
  • Cycle detection via DFS with proper error reporting
  • Single merged MirProgram output for the executor

Structs§

ImportInfo
A resolved import from one module to another.
ModuleGraph
A directed acyclic graph of module dependencies. Uses BTreeMap internally for deterministic iteration order.
ModuleId
A unique, deterministic identifier for a module derived from its path relative to the project root.
ModuleInfo
Information about a single module (source file).
VisibilityViolation
Errors produced by visibility checks.

Enums§

ModuleError
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.