View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

Lazy Lindenmayer

Home   How To   Code Pool   Public Library   Theory   Events
jrh 2005/2006


a stream variant of a lindenmayer system (see also L-Systems in SC)

experimental, might change interface.

see also_

An initial stream, the axiom, is recursively rewritten, using a set
of production rules. In a classic lindenmayer system (L-system),
each level of rewriting is done at once, rewriting the whole string.

This can be also done in a depth-first traversal through all levels,
taking in a stream and resulting in a stream.

The L-system's restrictions to a general generative grammar is its
fixed order in which the rules are applied,
and no principal distinction between terminal and nonterminal symbols.

If one of the two special characters < and > appear in a set of rules,
they are interpreted as context in order to form a context-sensitive generative grammar.
Everything that falls outside the closure such as A and B in A<X>B are not
rewritten if AXB match: X is rewritten only.

The class Prewrite by James McCartney does a similar thing with objects, whereby
their identity is used as a lookup. This is more efficient, but does not allow for the
combinatorics that a pure string rewriting system does.

Note that for some context-sensitive grammars there is an ambiguitiy which needs to be fixed (left-side dependency).

download: LazyLindenmayer

// the new version allows context-sensitive grammars:

// "X<A>Y", where X,A,Y is any number of characters.

r = "xuabcyyyyxcccxx";
	"a<b>c" -> "Z",
	"xx" -> "yy",
	"y<xcc" -> "P",
	"x>u" -> "......",
	"." -> "/"
], 2)

// results in:

further information:
an introduction to L-systems for composers and animators
L-Systems in SC

Links to this Page