← Iris

Generation 0
String length 0
Segments 0
String
Iterations 5
Angle 25°
Line width 1.0
Animation speed Fast
Axiom
Rules

What are L-systems?

An L-system (Lindenmayer system) is a parallel rewriting system — a formal grammar where every symbol in a string is replaced simultaneously at each step. They were invented in 1968 by Aristid Lindenmayer, a Hungarian-born theoretical biologist working at the University of Utrecht, who wanted a mathematical language for describing how plants grow. The key insight was that biological growth is a parallel process: all cells divide at once, not one at a time. This made Lindenmayer’s grammars fundamentally different from the sequential rewriting systems that Chomsky had developed for linguistics.

Parallel rewriting

In a Chomsky grammar, you pick one symbol and replace it, then pick another. The order matters. In an L-system, every symbol is replaced in the same step. This distinction sounds subtle, but it changes everything. Sequential rewriting models a single agent acting on a passive string. Parallel rewriting models a population of agents all growing at once — which is exactly what cells do. The string “ABA” under the rules A→AB, B→A becomes “ABAAB” in one step: every A and every B is replaced simultaneously. In a sequential grammar, you would choose which A to expand first, and the outcome might differ.

From strings to geometry

The rewriting system produces a string. To make it visible, you interpret the string as instructions for a turtle — a cursor with a position and heading. The symbol F means “move forward and draw a line.” The symbol + means “turn left by some fixed angle,” and − means “turn right.” Square brackets create branching: [ pushes the turtle’s state (position and heading) onto a stack, and ] pops it back. This is what makes plant-like structures possible — the turtle draws a branch, returns to the junction, and draws another.

Why simple rules produce complex forms

An L-system rule like F→F[+F]F[-F]F contains only a handful of symbols, but after five or six iterations the string is millions of characters long, and the resulting shape is a dense, detailed tree. This is the same principle at work across every experiment in this lab: complexity is not in the rules but in the iteration. A short grammar specifies a recursive structure, and each generation amplifies that structure exponentially. The Koch curve rule F→F+F−F−F+F replaces every line segment with a kinked version of itself, and after six generations you have a coastline so detailed that its perimeter is effectively infinite while enclosing finite area.

Branching and botanical realism

The bracket symbols [ and ] are what lift L-systems from abstract curves into recognizable biology. A stack-based branching system means the grammar can describe a main stem that sends off lateral branches, each of which sends off sub-branches, each of which bears leaves. Przemyslaw Prusinkiewicz and Aristid Lindenmayer’s 1990 book The Algorithmic Beauty of Plants demonstrated that remarkably realistic images of real plant species could be generated from short L-system grammars. The fractal plant preset above, for instance, uses just two rules and produces a structure that looks uncannily like a fern or a small shrub.

Beyond deterministic D0L-systems

The systems in this experiment are deterministic, context-free L-systems (D0L-systems), the simplest class. But the framework extends much further. Stochastic L-systems assign probabilities to rules, so the same axiom produces a different plant each time — modeling natural variation. Context-sensitive L-systems let a symbol’s replacement depend on its neighbors, modeling signal propagation through tissue. Parametric L-systems attach continuous parameters (length, thickness, hormone concentration) to each symbol, enabling smooth tapering of branches and realistic phyllotaxis. And environmentally-sensitive L-systems let the geometry feed back into the rules — a branch that hits an obstacle stops growing, a leaf that is shaded grows larger. These extensions blur the line between grammar and simulation, between formal language theory and computational biology.

L-systems and fractal geometry

Many L-systems generate exact or statistical fractals. The Koch curve has a fractal dimension of log(4)/log(3) ≈ 1.26. The Sierpinski triangle produced by the arrowhead curve has dimension log(3)/log(2) ≈ 1.58. The dragon curve is a space-filling curve with dimension 2. The Hilbert curve is another space-filling curve — it visits every point in a square, a continuous surjection from a line onto a plane. These are not approximations or metaphors: the L-system grammars generate the exact iterated function systems that define these classical fractals. Formal grammars and fractal geometry turn out to be two views of the same mathematics.