Evolutionary Sketch with Puppet Master and Spawn

I challenged myself to take on the question of how compilers parse language to understand whether or not code is syntactically correct and compilable. To do this, I had to dig deep into grammar files and look at the meta-structure of programming languages. After trying to incorporate ANTLR grammar files for many days, I decided to make a proof of concept sketch writing my own grammar files in a structure provided by an external library for Processing called “riTa”.

My Processing sketch called “riTa_Tester_V4” uses these grammar files to expand random Strings of working processing code into a sketch called “Spawn”. It then resaves Spawn.pde and runs it, using applescript for Automation.

Here is a video of the whole process and a step-by-step breakdown of what is happening when I run puppet_master.pde:

1. riTa_Tester_V4 is run from the command line using processing-java, generating code into Spawn.pde.
2. Spawn.pde is opened in the Sublime Text window
3. An applescript is called to activate the Sublime Text Window so it will live update.
4. Spawn.pde is run from the command line, using processing-java.
5. An applescript is called to kill the Rita_Tester_V4 and Spawn windows after a short delay to watch the sketch
6. Steps 1-5 are repeated.

FinalICM720p from Aaron Arntz on Vimeo.