Context-Free Design Grammars


Chris Coyne's Context Free Design Grammars appeal to me on so many levels (linguistically, artistically, mathematically, computationally, ...)

Basically they are a set of production rules where the terminals are geometric shapes (actually just a circle and a square) and each symbol on the right-hand-side of a rule is augmented with a geometric transformation.

So a sentence in the generated language is just a collections of squares and circles at different positions, sizes and orientations.

But the results are stunning.

Of course, immediately after discovering this, I had to write a Python implementation. My first implementation immediately hit the recursion limit so I rewrote it to use a pool of states rather than recurse. Coincidently, I used exactly the same technique working on level 24 of the Python Challenge and avoided the recursion depth issues others had encountered.

Once it's cleaned up, I'll make my Python implementation available.