Skip to main content

compile

Function compile 

Source
pub fn compile<R>(root: &str, resolver: &R) -> Result<Compiled, CompileError>
where R: Resolver,
Expand description

Compile a root source and all its transitive IMPORTs into one IR.

Each file is keyed by DOMAIN; atoms unify only within a domain. Imports are referenced by <domain>.<atom> and visibility is file-local (naming is not transitive, though a dependency’s clauses still participate). Sources are content-addressed (sha256): a source reached by several paths is compiled once (so a diamond — or an exponential fan-out — stays linear, never blowing up), and an import cycle is an error.

Resolution is iterative (an explicit work stack, not native recursion), so an arbitrarily deep import chain cannot overflow the call stack.

Premise/rule names are per-source labels, not global identifiers: different files may reuse a name, and the report qualifies them by source. A name reused with a different body is an error only within the same source.