Context free design grammar
Posted by Dan on Jan 7th, 2008
2008
Jan 7
![]()
This site has a “context free design grammar”, which is a computer language that produces art directly. Here is an example of the language:
startshape flower6 rule flower6 {
12* {r 30} petal6 { }
12* {r 30} petal6 {flip 90}
} rule petal6 {
SQUARE { s 1 0.001 }
CIRCLE { x -0.5 s 0.01 b -1 }
petal6 [ x 0.5 r 120.21 s 0.996 x 0.5 b 0.005 ]
}
This is a simple language that will produce graphics immediately, but it does what it does and nothing else. For example, it can set the background to a color, but it can’t use a digital photo as a background. A general purpose computer language like C# will do anything, but it takes a bit of work to do what the program above does so quickly.