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.maatfiles resolve submodules in their own directory:mod foo;indir/mod.maatresolves todir/foo.maatordir/foo/mod.maat. - All other files resolve submodules in a subdirectory named after
the file stem:
mod bar;indir/foo.maatresolves todir/foo/bar.maatordir/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.