Skip to content
ALB Wiki

Shakespeare Programming Language

This is an old revision of this page — revision 1 (2026-10-22 13:17:59 UTC). It may differ from the current revision.

Shakespeare Programming Language

The Shakespeare Programming Language — SPL — is a language whose programs are written as Elizabethan stage plays, and whose stated design goal was to make source code beautiful. Karl Hasselström and Jon Åslund created it in 2001, producing the only programming language in which arithmetic is performed by insulting people in iambic cadence and output is achieved by telling them to speak their mind.[1]

A program is a play: it has a title, a dramatis personae, acts and scenes, stage directions, and dialogue. The variables are characters — restricted, by the specification, to names from actual Shakespeare plays — and they hold integer values on stacks. To compute, characters must take the stage and speak to each other; to print a character, someone must say "Speak your mind!"; to print a number, "Open your heart!" Input arrives when a character is told to "Open your mind" or "Listen to your heart."[2]

Drama as control flow

The staging rules are the machine. At most two characters may be on stage at once — every [Enter] and [Exit] is effectively register allocation. Acts and scenes are not structure but labels: "let us proceed to Scene II" is goto, and conditional jumps are achieved by one character asking another "Am I better than you?" — followed, if so, by an exit to the appropriate scene.[3]

Arithmetic is where the design becomes deranged in a rigorous way:

  • A noun is worth 1 if complimentary (a rose, a summer's day) or −1 if insulting (a codpiece, a festering wound).
  • Each adjective doubles the noun's value — so "a beautiful fair warm peaceful sunny summer's day" is 1 × 2⁵ = 32.
  • "You are as lovely as the sum of Hamlet and a brave tree" assigns Juliet the value of Hamlet plus 2 — a compliment that is simultaneously an addition statement.
  • Insults are therefore not optional: negative numbers must be delivered as abuse.

Which produces the language's famous consequence: to print ASCII characters, you must construct their numeric values out of compliments and insults, so every output program reads as an escalating drama of flattery and offense.[4]

The Hello World that insults a Danish company

The canonical SPL Hello World is a genuine three-scene play: Hamlet — billed in the dramatis personae as "the flatterer of Andersen Insulting A/S" — takes the stage and, by alternating abuse and praise at Romeo, Juliet, and Ophelia, drives each one's value to the ASCII code of the next output character:

Hamlet:
 You lying stupid fatherless big smelly half-witted coward!
 You are as stupid as the difference between a handsome rich brave
 hero and thyself! Speak your mind!

That produces a character of output. The whole program is several scenes of this — Romeo getting insulted into punctuation. It is possibly the only Hello World in computing that reads as a defamation lawsuit.[5]

Shakespeare is Turing-complete — a Brainfuck-to-SPL translator exists (Brain2Speare), which means every computable function can be staged as a tragedy. Whether anyone should watch the performance is a separate question.

Where it sits in the wing

Where LOLCODE attacked vocabulary by borrowing a meme, SPL attacked it by borrowing literature — the assumption that source code should look like a program at all. Alongside Whitespace (programs as absence) and Piet (programs as paintings), it completes the trio of languages whose source code you could show a civilian without them recognizing it as code.

Check your understanding

  • What does "Speak your mind!" do — and what outputs a number instead?
  • How is a negative integer written in SPL?
  • What are acts and scenes used for mechanically?
  • How many characters may be on stage at once, and why does that matter?
Show answers

1 — "Speak your mind!" outputs the addressed character's value as an ASCII character; "Open your heart!" outputs it as a number. 2 — as an insult — negative nouns (codpiece, festering wound) are worth −1, and each adjective doubles the magnitude. 3 — they are goto labels — "let us proceed to Scene II" is control flow, and conditional questions direct the jumps. 4 — two — it is the register file: only the two on-stage characters can exchange values, so [Enter]/[Exit] is resource management.

Footnotes

  1. ↑ Shakespeare, esoteric-languages wiki — Hasselström & Åslund, 2001, and the design goal of "beautiful source code"
  2. ↑ SPL language overview — the stage-direction model and the four I/O utterances
  3. ↑ SPL language overview — the two-character stage limit and scenes-as-labels
  4. ↑ SPL expression rules — noun/adjective valuation, similes, and "the sum of / difference between" operation expressions
  5. ↑ SPL Hello World — the full program, Hamlet's insults included, as distributed with the language
This page was last edited 2026-10-22 13:17:59 UTC by ALB Team. What links here