Class TemplateEnrichmentGenerator

java.lang.Object
org.ek9lang.compiler.fuzz.TemplateEnrichmentGenerator

public final class TemplateEnrichmentGenerator extends Object
Strand 5: Template Enrichment. Combines 1-4 working Q&A templates into a single module, extracts their type/function definitions, then generates a program body with nested control flow using those real types.

The key insight: Q&A templates provide semantically valid, compiler-resolved types. Strand 1 generates random programs that often die at FULL_RESOLUTION (35%). By using real types in complex nested control flow, we get programs that reach deeper compiler phases (IR_GENERATION, CODE_GENERATION) while exercising cross-type interactions that no single Q&A template would produce.

Source-level extraction preserves working method bodies, operators, and field defaults without needing to regenerate code from harvested symbols.

  • Constructor Details

  • Method Details

    • generate

      Generate an enriched program combining multiple Q&A templates with nested control flow. Uses two-phase generation: first compiles the combined type definitions to harvest actual resolved symbols, then generates the program body against what actually resolved.
      Parameters:
      random - the random source for all non-deterministic choices
      Returns:
      EnrichmentResult with the combined source, or null if insufficient templates