« Cyberflora | Main | Welcome! »

As honest as the square root of yourself

| 5 Comments

Hee—Jeremy T. and Jay L. point to the Shakespeare Programming Language. (Link may not be working this morning, unfortunately, but it appears to have been around for a while so I'm hoping it'll be back online later.) The idea is that you write code that reads sorta kinda vaguely like Shakespearean dialogue, and it gets automatically translated into the C programming language, which you can then compile and run.

It's not actually a useful language—the GCC front ends page notes that SPL has "the expressiveness of BASIC and [the] user-friendliness of assembly language"—but it's kinda fun to read, at least in small doses.

Character names are variables; characters assign values to each other by saying lines that begin with "You are. . . ." Nouns are constants, with a value of either 1 or -1 (depending on whether they represent good or bad things; kings (e.g.) are good, while pigs are bad), and each adjective multiplies its noun by 2. So you can, for instance, assign a value of 8 to the character Romeo with this line:

Juliet: You are as bold as a mighty handsome brave king.

Unfortunately, to get numbers other than powers of 2, you have to use the language's math operations, which use math phrasing like "the sum of" and "the square of." I'd rather see less obvious operations (like "and" for addition, and maybe a phrase using the word "less" for subtraction).

The approach to generating output is particularly goofy. (Note to non-programmers: if you get bored reading this paragraph, just skip ahead to the next paragraph.) In one of the sample programs, I couldn't figure out why Romeo (assigned a value of 100 at the start) kept taking his own square root, printing the result, and then squaring himself. Why would you print out "10" in every iteration of a loop? (Loops, by the way, are created using lines like "Am I better than you? If not, let us proceed to Scene III.") It turns out there are two kinds of printing: one ("Open your heart") prints a number; the other ("Speak your mind") prints an ASCII value. The ASCII character with the value 10 is the newline character; displaying it (in some operating systems) moves to the next line of text (like pressing Return in a word processor). So because the author knew that Romeo was set to 100, the easiest way to display a newline was to take the square root of Romeo and display it as an ASCII character, then square Romeo again. Needless to say, this is not exactly the most elegant (nor the most cross-platform compatible) approach to displaying output ever devised.

But the idea is cute, and suggests all sorts of other possibilities. Chaucer Programming Language? (Among other things, code must be written in iambic pentameter.) Austen Programming Language? Tolkien Programming Language? Mamet Programming Language? (u = 1; fuck(u);) Rand Programming Language? (A=A;) Other suggestions welcome.

(Addendum: I hadn't realized there were so many Mamet parodies online. For example: Mamet explains Neo-Futurism; "Dammit, Dave," Mamet's version of 2001; and Oklahoma!, by David Mamet.)

5 Comments

The Neo-futurists! Man, if you ever have an opportunity to go to Chicago, check out Too Much Light Makes the Baby Go Blind. They do (I think) 30 plays in 60 minutes. The price of admission is 5 plus 1d6 dollars. It's one of the single coolest experiences I have had in my life.

Anyway, That Shakespearian programming language is the only one out side of PHP that I can read...


I drag people to see them every time they're in Chicago. :-) That and the architectural boat tour...


I've seen Too Much Light three times now, twice in Chicago and once in NYC (scroll most of the way down for my adventures after seeing it, or all the way down to the bottom for my review); it remains one of my favorite theatrical experiences. Ditto Jeremy on the strong recommendation.

But you don't have to go to Chicago for it! Instead, you can buy the CD, which is as close as you can get to reproducing the experience (sans visuals) in the comfort and privacy of your own home. A really superb CD; there's some astonishingly good work there, and they chose pieces that don't need visuals. $16.50 including postage and handling for one copy of the CD, $12.50 incl. p&h for each additional copy. Everyone should buy this.

You can also buy a book of 100 of their scripts; it's good, but as a whole it's not as good as the CD.


Wow, nifty (Too Much Light)! I'll be in Chicago this summer, so I'll pester folks closer to the appropriate time for more info.


Those (despite their pretences) aren't Mamet parodies; they're just Glengarry Glen Ross parodies.

(If you really want a good laugh, though, try watching the airline / TV sanitized-dialogue version of GGR. You'll never be able to take Ed Harris seriously again.)


Post a comment