Class TemplateEnrichmentGenerator
java.lang.Object
org.ek9lang.compiler.fuzz.TemplateEnrichmentGenerator
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final recordResult of enrichment generation: the sources to compile, template identity, and metadata. -
Constructor Summary
ConstructorsConstructorDescriptionTemplateEnrichmentGenerator(List<AtnBasedGenerator.NamedSource> qaExampleSources, List<TemplateProbeGenerator.HarvestedTemplate> harvestedTemplates, SharedThreadContext<CompilableProgram> sharedContext, FileHandling fileHandling, CompilerReporter compilerReporter) Create an enrichment generator from pre-harvested templates. -
Method Summary
Modifier and TypeMethodDescription(package private) TemplateEnrichmentGenerator.EnrichmentResultGenerate an enriched program combining multiple Q&A templates with nested control flow.
-
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
-