Kore going mad again: kaforkl - Blog - Open Source - schlitt.info

schlitt.info - php, photography and private stuff

Kore going mad again: kaforkl

My friend Kore is going mad again. As usual, it has something to do with graphics... But this time in a completly different way than before: Kore created his own small programming language, which he named "kaforkl".

Inspired by Brainfuck2D, a 2 dimensional, brainfuck like language, Kore started implementing some (I think completly new) kind of programming language, based on images. For example, the image below shows the famous "Hello World!" program, "written" (or better drawn) in kaforkl (beware, the image is quite small):


Kaforkl is based on the pixels of an image. The language interpreter starts at the top left corner of an image and interpretes the color channel values of the pixels to perform operations, work on a stack and determine the direction, the processor will take from the current pixel on. The red value of the pixel defines the direction (north, east,...) the processor will take. If multiple directions are specified (you know, there are 256 possible red values per pixel), the processor forks and performs all directions, starting north. Using the green value you can define a position on the variable stack to work with and the blue channel allows you to specify a byte value, which is interpreted as an integer or as a character, depending on the command you perform on it. Commands are defined using the alpha channel of a pixel. So far, Kore already implemented common commands like jumps, conditions, IO operations, calculations and some more.

I think now you get the point, why I really think Kore is kinda mad! ;) Not that he wrote that interpreter, but singularly by having the idea for it. Finally (since the program above is really tiny), another example. Here is the also common "99 bottles of beer..." program, which will print the song text to your shell, if you process the image with kaforkl:


If you wanna try out kaforkl, you can check out its source code from Kores SVN:

$ svn co svn://busimess.org/kaforkl

Have phun! ;)

If you liked this blog post or learned something, please consider using flattr to contribute back: .



Add new comment

Fields with bold names are mandatory.