dave rogers

Programming Language Scrabble

20071105.Monday

We broke out Scrabble™ last night. While working through the permutations of my seven letters, I seemed to happen upon reserved words from various programming languages again and again.

Most programming languages have a set of these reserved words (a.k.a., keywords) that can't be used by the programmer for other things that need names (e.g., variables, functions, classes). To do so would confuse the computer, in much the same way as Bill Clinton's line "it depends on what the meaning of the word 'is' is," confused the grand jury.

I wondered if it would be possible to play Scrabble with just these reserved words. I also wondered if it would be possible to be any more of a computer geek than I already was.

The Internet teaches us that none of our ideas are original. Sure enough, someone else had already proposed such nerdlike Scrabble variations. But Geektronica, as this fellow is known -- apparently I do not reside atop the pinnacle of geekiness after all -- did not follow his proposal through to its ultimate, if insane, conclusion.

To begin, I looked up the ten most popular programming languages as of November 2007: Java, C, BASIC, C++, PHP, Perl, Python, C#, Ruby, and JavaScript. C and its descendants seemed over-represented, so I tossed a few oldies onto the pile: FORTRAN, COBOL, Pascal, Smalltalk, and Prolog. Sadly, Lisp and Forth don't really have reserved words.

(Different versions and implementations of languages have different numbers of reserved words. I just snagged the first count I could find. The chart was prepared with a nifty online tool -- for kids.)

I then aggregated the lists of the fifteen languages' reserved words, throwing out digits and punctuation marks, to arrive at a Scrabble-riffic list of 958 unique reserved words.

I didn't bother excluding words that couldn't possibly be formed with the game's letter distribution (even with the blank tiles). There are also a few one-letter reserved words, which I believe can only be played on the first move of Scrabble: watch your opponents' faces as you kick off a new game with "q" (from Perl).

It's going to chew up a lot of RSS bandwidth, but I know someone will want the complete list: