Skip to content

Pipeline

opulse.generation.pipeline

Generate operators one at a time and grow a registry layer by layer.

OperatorFactory.generate(kind, layer) loops until a candidate passes:

  1. draw a symbol and shape;
  2. build a draft (simple / branch / recursive) targeting layer;
  3. compile the definition to compute/count code (one code path for all kinds);
  4. compute dependencies and the recursive layer, reject if not layer;
  5. run the acceptance checks (see :mod:opulse.generation.checks); the decisive one compiles nothing new: it requires the generated code to agree with the reference interpreter on boundary and random inputs, value and both counts (docs/reference/semantics.md section 9).

build_layers fills a registry with a requested number of operators per layer. Inside each layer recursive operators are generated first, because simple and branch operators at layer L need some layer-L operator to exist.

OperatorFactory

generate

generate(kind: str, layer: int) -> Operator

Return one accepted operator (not yet added to the registry).

layer_plan

layer_plan(
    count: int,
    layer: int,
    proportions: tuple[float, float, float],
    rng: Random,
) -> list[str]

Definition kinds for count operators at layer; recursive ones first.

proportions is (simple, branch, recursive). Layer 0 cannot hold recursive operators, so their share goes to simple/branch at random.