Compilers are perceived to be magical artifacts, carefully crafted
by the wizards, and unfathomable by the mere mortals.
This is from a great paper by Abdulaziz Ghuloum on how compilers are made. It, along with a timely email from Julian Rohrhuber inspired me to have a go at making a tiny one for compiling scheme to betablocker – the idea is that you only need a handful of scheme primitives before you are able to bootstrap all the other code together. Betablocker is no way powerful enough to go too far with this, but I think there may be some good uses for compiling bits of fluxus scheme code on Raspberry Pi and Android, maybe not to native binary but mixing an interpreter with a fast intermediate language for graphics processing would make it possible to compile object deformation inner loops i.e. (pdata-map!) and friends for per-vertex operations, but have it transparently the same language to the user/livecoder.
I’ve only dealt with fixnums, booleans, null lists and a handful of simple core procedures, but compiling something stupid like this:
(zero? (- (+ 12 4) (+ 43 (add1 34))))
Results in this:
Via the slightly more conventional looking:
I’m swatting up on my scratch skills for the first codeclub at Troon Primary School in Cambourne tomorrow afternoon! It’s exciting to finally head to the frontlines of algorithmic literacy in education.
Also on Wednesday I present at talk about FoAM and cross-disciplinary working at Exeter University’s Biomedical Informatics Hub, I’ll be talking about Borrowed Scenery, The Lobster DorisMap, Hapstar and Lirec, specifically concentrating on things that happen when people work together across many disciplines.
After getting acquainted with the BeagleBoard while working on the Swamp bike opera I decided to have a look at the similar Raspberry Pi, and particularly it’s graphics systems. The Android/PS2 version of fluxus, called nomadic is ported after a bit of fiddling, but no mouse or keyboard input yet (build it with ‘scons TARGET=RPI’). The graphics driver for the Pi’s VideoCore GPU doesn’t work quite like you normally expect with X11, you get access to it via a custom display manager called dispmanx which allows crazy things like alpha compositing on top of the X display like this:
Everything you need to develop for the Pi’s GPU can be found inside /opt/vc/ (before finding that I installed a bunch of generic OpenGL ES stuff that wouldn’t work). You need to use the headers and link to the driver libraries there. There are some useful examples inside the hello_pi directory – one important thing is to call bcm_host_init(); and link with libbcm_host.so to initialise BroadCom’s driver before you can do any GPU related calls. I started off by trying to port GlutES to the Raspberry Pi but I got further using the example code – I might come back to that as a way of getting more functionality working along with X11.
I’m also experimenting with a new fluxus editor for nomadic, based on Kassen Oud’s work – a text editor written in fluxus for fluxus that you can see in the screenshot. This will eventually be useful for the standard version too, as it will give much more control over the livecoding environment while livecoding :)