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
-
Program Structure: The raw AST is wrapped in a
Programabstraction which distinguishes between extensional (data) and intensional (rules) predicates. -
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. -
Lowering: The AST (or stratified program parts) is lowered into the Intermediate Representation (IR). See
LoweringContext. -
Type Checking: The IR is checked for type consistency and safety. See
TypeChecker. -
Planning: The Logical IR rules are transformed into Physical Operations (like nested-loop joins) ready for execution or codegen. See
Planner.
Structs§
- Lowering
Context - Planner
- Program
- Represents a Mangle program consisting of logic rules and declarations.
- Stratified
Program - A program that has been successfully stratified.
- Type
Checker
Functions§
- rewrite_
unit - Rewrites a unit by prefixing local predicates with the package name.
Type Aliases§
- Predicate
Set - A set of predicate symbols, typically used to represent a stratum or a collection of EDB/IDB predicates.