Skip to main content

Module grammar

Module grammar 

Source
Expand description

L-system grammar expansion: pure, deterministic string rewriting. Applies a production rule set to an axiom depth times — each character is replaced by its successor (or kept if no rule matches). This is a build-time step (runs inside Scene::configure, off the hot path), not per-frame work.

Deterministic by construction: a fixed (axiom, rules, depth) always yields the exact same string (NFR 6), which is what makes it directly unit-testable.

Functions§

expand
Expand axiom by applying rules depth times. Each rule is (predecessor, successor); a character with no matching rule maps to itself (the standard context-free L-system semantics). Pure and deterministic.