Skip to main content

Crate mangle_analysis

Crate mangle_analysis 

Source
Expand description

Analysis and Transformation Pipeline for Mangle.

This crate provides the core analysis passes and transformations that turn a parsed Mangle AST into an executable plan.

§Transformation Stages

  1. Program Structure: The raw AST is wrapped in a Program abstraction which distinguishes between extensional (data) and intensional (rules) predicates.

  2. Stratification: The program is analyzed for dependencies and stratified to handle negation correctly. This produces a StratifiedProgram, where predicates are grouped into layers (strata) that can be evaluated sequentially.

  3. Lowering: The AST (or stratified program parts) is lowered into the Intermediate Representation (IR). See LoweringContext.

  4. Type Checking: The IR is checked for type consistency and safety. See TypeChecker.

  5. Planning: The Logical IR rules are transformed into Physical Operations (like nested-loop joins) ready for execution or codegen. See Planner.

Structs§

LoweringContext
Planner
Program
Represents a Mangle program consisting of logic rules and declarations.
StratifiedProgram
A program that has been successfully stratified.
TypeChecker

Functions§

rewrite_unit
Rewrites a unit by prefixing local predicates with the package name.

Type Aliases§

PredicateSet
A set of predicate symbols, typically used to represent a stratum or a collection of EDB/IDB predicates.