Skip to main content

Module inferrer

Module inferrer 

Source
Expand description

Pattern inference engine.

This module implements the core algorithm that derives a transformation pattern from one or more before/after example pairs. The process works as follows:

  1. Parse both the before and after code into tree-sitter ASTs.
  2. Walk the two trees in parallel, performing a structural diff.
  3. Where leaf nodes differ (identifiers, literals, etc.), extract them as PatternVars.
  4. Where the structure is identical, preserve it verbatim in the template.
  5. Assemble the before_template and after_template and compute a confidence score.

Structsยง

PatternInferrer
The pattern inference engine.