Friday, October 10, 2008

Weird Programming Languages

As if programming wasn't weird enough already, some people have taken it into their hands to design programming languages for humor value, or just to show it can be done. A great place to start is BF, a language designed to be extremely minimalistic while still Turing Complete (able to do certain calculations). It works in terms of a long "tape" of cells, in order from cell zero on to (theoretically) infinity. The program controls a "pointer" which moves from cell to cell to preform operations on the number stored in each cell.
The following program inputs two numbers, multiplies them, and outputs the answer.
Multiplication is repeated addition. The program is no more efficient than counting on your fingers, but it's automated. There is also a brilliant ZZT engine that simulates it and lets you see exactly what the program is doing. (This doubles as a proof-by-simulation that ZZT is turing complete).

BFZZT multiplication in progress
Here's my multiplication program, mid-way between multiplying 2 by 3 (I use small numbers because of how long the program takes to run when I slow it down to a speed I can watch!).

Other weird programming languages I have recently read about include LOLCODE ( a work in progress, not finished yet) that goes something like this:


This would be so much fun to program in.