Skip to main content

Crate maat_module

Crate maat_module 

Source
Expand description

Module resolution, dependency graph construction, and multi-module compilation for the Maat compiler.

This crate builds a directed acyclic graph (DAG) of module dependencies before compilation begins. Each reachable source file is parsed independently, cycle detection is performed via DFS with gray/black coloring, and the final graph provides a topological ordering suitable for compilation.

§File Resolution

Resolution follows Rust’s module conventions:

  • Root entry files and mod.maat files resolve submodules in their own directory: mod foo; in dir/mod.maat resolves to dir/foo.maat or dir/foo/mod.maat.
  • All other files resolve submodules in a subdirectory named after the file stem: mod bar; in dir/foo.maat resolves to dir/foo/bar.maat or dir/foo/bar/mod.maat.

If both foo.maat and foo/mod.maat exist, the resolution is ambiguous and an error is produced. If neither exists, a resolution error is produced.

Structs§

ModuleExports
The set of publicly visible items exported by a module.
ModuleGraph
A directed acyclic graph of module dependencies.
ModuleId
A unique identifier for a module within the dependency graph.
ModuleNode
A single node in the module dependency graph.
ResolvedImport
A resolved import ready to be injected into a module’s type environment.

Enums§

ImportKind
The kind of item being imported.

Functions§

check_and_compile
Type-checks, compiles, and links all modules in the given graph.
check_exports
Returns the per-module public exports extracted during type checking.
resolve_module_graph
Resolves the complete module dependency graph starting from entry.

Type Aliases§

ModuleResult
A specialized Result type for module resolution operations.