Tuesday, July 05, 2005

grammatical graphics

Context Free is a programming language that generates fractals from simple grammar. For example, this code...

startshape SNOWFLAKE

rule SNOWFLAKE {
SPIKE {}
SPIKE { r 60 }
SPIKE { r 120 }
SPIKE { r 180 }
SPIKE { r 240 }
SPIKE { r 300 }
}

rule SPIKE {
SQUARE {}
SPIKE { y 0.97 s 0.97 }
}

rule SPIKE 0.03 {
SPIKE { r 60 }
SPIKE { r -60 }
SPIKE { y 0.97 s 0.97 }
}

... generates this pic:

With only marginally more complex code, very organic forms can be made:

Context Free is a GUI for editing and rendering grammar code. It's available for Mac, Win, and Posix-based systems, and it's free as in beer and as in speech, but if you want to show the love they ask that you either donate $ to the EFF or buy something from their CafePress shop.