Sorry for the missed weeks of friday pathological programming language columns. To be honest, I’m running out of languages. I’m sure there must be more, but my usual sources (dealers?) are running out – so send links!
Anyway, today I’m going to look at a really simple one, which I find fun. It’s
not an overly exciting language, but it is a language which is has semantics almost as
trivially simple as [BrainFuck][bf], but which ends up looking almost as much like line-noise as [TECO][teco]. It’s called [Betterave][betterave].
[betterave]: http://www.esolangs.org/wiki/Betterave
[teco]: http://scienceblogs.com/goodmath/2006/09/worlds_greatest_pathological_l_1.php
[bf]: http://scienceblogs.com/goodmath/2006/07/gmbm_friday_pathological_progr.php
Category Archives: Programming
FPP: No you cant haz yr LOLCODE: Sortle Instead
All week, I’ve been buried by a wave of requests to write about LOLCODE today. Normally, I do try to honor requests from readers, but from the time I started my friday pathological languages, I’ve always tried to stick to languages that actually had *something* interesting about their semantics. LOLCODE is funny because of its goofy grammar; but it’s really incredibly dull semantically. And while there are lots of programs written in it,
there’s no implementation (at least not yet).
Anyway, what I decided to do instead is a twistedly beautiful language called [Sortle][sortle]. Sortle is a very simple language which is based on insertion sort. The basic idea of how it works is: it takes the lines of the program, and sorts them. Then it executes them; when a line is executing, it can modify itself; when it gets modified, the interpreter re-sorts the line into its correct position in the sorted order according to its new value. So control flow is completely driven by the sort-order of the lines of the program.
A Pathological Way to Paint: Gammaplex
Today’s a mighty cool example of bizzare language design, called GammaPlex In terms of language
design, it’s nothing particularly special: it’s yet another stack language
with a befunge-like graphical syntax. What’s unusual about GammaPlex is that it’s strongly focused on graphics. It’s got built in support for ascii graphics, OpenGL, and mouse input.
Even More Stack Pathology
I thought that it would be fun to stick with the “stack-based” theme of last week’s pathological post, but this time, to pick an utterly pointlessly twisted stack based language, but one that would be appreciated by the mascot of one of my fellow ScienceBlogs. Orac, this one’s for you! 🙂 Our target these week is the language “Enema”.
Why am I doing this Pi-Calculus Language Thing?
Since my post on datatypes for my π-calculus language, I’ve gotten a bunch of questions from people who (I guess) picked up on the series after the original post where I said that the idea of the series was to see if I could create a programming language based on it. The questions are all variations on “Why design another programming language? Do you really think anyone will ever use it?”
True Pathology: A Multilingual Quine
While browser over at programming.reddit.com, I came across something simultaneously hideous and amazing.
I’ve showed quines before as part of the pathological programming posts: a quine is a program which, when run, generates itself as an output. I’ve even written about a programming language where the only way to create a loop is through quining the program.
But I’ve never seen anything like this before. It’s a multilingual quine: the program below is not just a quine, but it’s simultaneously a quite in three different languages: OCaml, Haskell, and Scheme. I have no idea how the author managed to figure out how to do this; and I probably don’t want to. 🙂
From Beautiful to Twisted in One Syntactic Step: False
Today’s friday programming language insanity is a tad different. I’m going to look at another twisted stack-based language. I’ve got a peculiar fondness for these buggers, because back in the day, I was a serious Forth addict. One of the ideas that’s actually come up in serious programming languages in the last few years is creating a sort of cross between functional languages and stack-based languages, producing what are known as concatenative languages. An excellent example of an extremely powerful and useful member of this family is called Factor, by Slava Pestov.
But serious useful languages aren’t the realm of my regular friday pathology. So I’m going to tell you about a not-really-serious version of a concatenative language, called False. Semantically, False is actually not a horrible language. In fact, if it weren’t for the bogglingly awful syntax, it’s something I could imagine using for tiny file-filtering utilities. But the syntax is designed to be truly horrible, and when you blend the natural potential for confusion that you get from doing everything backwards on a stack with a syntax that looks like line-noise, you get something that can really sprain your brain.
"Flip" Out with a Pathological Programming Language
As promised, this week, I’ve got a new friday pathological programming language. This one is another 2-dimensional language, but it’s pretty different from any of the 2d languages I’m written about before. It’s called “Flip“, and the warped minds behind describe it as being sort of like “Programmers Billiards”. It’s a seriously neat language, but it is pretty large and complicated. So I’m not going to describe everything about it in detail: you’ll have to read the language manual for that. But I’ll describe enough to give you the flavor of it, and show you a couple of examples to whet your appetite.
Basics: Binary Search
For the basics, I wrote a bunch of stuff about sorting. It seems worth taking a moment
to talk about something related: binary search. Binary search is one of the most important
and fundamental algorithms, and it shows up in sorts of places.
It also has the amazing property that despite being simple and ubiquitous, it’s virtually
always written wrong. There’s a bit of subtlety in implementing it correctly, and virtually
everyone manages to put off-by-one indexing errors into their implementations. (Including me; last time I implemented a binary search, the first version included one of the classic errors.) The errors are so ubiquitous that even in a textbook that discusses the fact that most programmers get it wrong, they got it wrong in their example code!
Programming with Shapes: Clunk
Today’s bit of pathology is a really silly, and really fun language called Clunk, with a downloadable package containing a perl implementation here. I’m
not sure that it’s Turing compete, but my best guess is that it is. It’s another two dimensional
language, but it’s very different from any of the other 2d languages that we’ve look at, because it
doesn’t rely on an instruction pointer moving around the playfield; instead, it computes by
creating an image by fitting together pieces according to some pre-determined rules.