Learning Objectives and Prerequisites
The Shakespeare Programming Language (SPL) is an esoteric language in which source files resemble plays. Characters represent variables that hold signed integers; stage directions control who can participate in dialogue; nouns and adjectives form numeric constants; and dialogue assigns values. Learners should be able to identify a variable, trace a listener, evaluate simple signed constants, and explain how a program changes state. Begin with OSShakespeare.001 — How a Shakespeare Program Is Structured. Knowledge of JavaScript variables, C# variables, or PowerShell variables provides useful comparisons.
Elementary Overview
A variable is a name attached to information a program needs. In many languages the name might be score or count. SPL replaces those ordinary labels with characters from Shakespeare’s plays, including Romeo and Juliet. Each character remembers a whole number, such as zero, five, or negative three.
Think of two actors on a stage. One actor speaks a number to the other. The listener is the variable that receives the new value. The special words and stage directions look like a script for a performance, but they have exact computational meanings. A sentence that sounds beautiful is not automatically valid SPL syntax.
NDC Conferences — Dylan Beattie, The Art of Code (2020). The talk contextualizes esoteric programming; the original specification supplies the exact SPL rules.
The Dramatis Personae Declares Variables
The original language specification published in 2001 by Karl Hasselström and Jon Åslund requires all referenced characters to be declared before use. A program begins with a title ending in a period, followed by character declarations. The character names must come from the supported Shakespeare vocabulary. The descriptive prose beside each name is aesthetically useful but ignored when the program runs.
These first three sentences declare a program and its two variables:
An Instruction in Two Voices.
Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
The names Romeo and Juliet identify the variables; their descriptions do not provide assigned numbers. In the reference execution model, each begins with a numeric value of zero. A character also has an associated stack for stored values, a feature explored later in the curriculum. Modern languages generally let programmers invent descriptive variable names, whereas SPL deliberately restricts names to theatrical characters.
The design is an example of an esoteric programming language, a language built partly to explore what counts as code. Related experiments include Emojicode and the unrelated Chef culinary programming language. Their syntax differs; learning one does not make its commands valid in another.
Who Is on Stage Determines Who Can Receive a Value
A declared character is not necessarily present on stage. [Enter Romeo and Juliet] places both characters in the scene. [Exit Romeo] removes Romeo, and [Exeunt] clears the stage. A character must be present to speak, and the target of a second-person sentence must also be present.
When exactly two characters are on stage, the character who is not speaking is the listener. Introducing a third active character makes a second-person reference ambiguous. Entering a character who is already present, or exiting one who is not present, can cause a runtime error. These are execution rules rather than literary conventions.

How Nouns and Adjectives Form Integer Constants
In the original SPL grammar, recognized nouns represent either positive one or negative one. Pleasant and neutral nouns such as hero can mean +1, while negative nouns such as pig can mean -1. Each accepted adjective immediately modifying a noun doubles the numeric magnitude. Two adjectives therefore multiply the base by four, regardless of sign.
The simple-noun formula is value = sign(noun) × 2^n, where n is the number of accepted adjectives. For example, brave hero expresses the positive value two, and handsome brave hero expresses four. The phrase stupid pig has negative value two in magnitude, and adding another accepted adjective doubles the negative magnitude again. The exact word list matters: an English synonym is not necessarily a token recognized by the parser.

The original language also supports more elaborate expressions, including sums, differences, products, squares, cubes, and pronoun references. Its historical Hello World example constructs output character codes using arithmetic hidden in compliments and insults. Later lessons can study the complete expression grammar; the current lesson concentrates on variable identity and simple assignment.
A Complete Two-Character Assignment
The following short program shows a declaration, stage entry, a numeric assignment, and numeric output. Its source is presented using the established Gutenberg code template, without boxed code blocks:
An Instruction in Two Voices.
Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Act I: A meeting.
Scene I: Juliet addresses Romeo.
[Enter Romeo and Juliet]
Juliet:
You are a hero.
Open your heart.
[Exeunt]
The first line is the title. The next two lines declare the variables. The Act and Scene provide labels, and the stage direction makes both characters available. Juliet speaks the line You are a hero. to Romeo, who receives the numeric value +1. The line Open your heart. prints Romeo’s value as a number. Assuming a conforming interpreter and successful execution, the expected output is 1. The program was not independently compiled or run during article preparation.
Changing the instruction to You are a pig. changes the literal to -1 in the original grammar. The expected output therefore becomes negative one. The insult is not a comment or a description; its noun encodes a numeric value. A parser needs the precise accepted words rather than approximate English meaning.
Pronouns and Reassignment
The expression thyself refers to the character being spoken to; other second-person pronouns operate similarly. The speaker’s value can be referenced through supported first-person forms such as me. These references allow an assignment to depend on an existing variable value.
For instance, You are as good as thyself. preserves the listener’s current value. You are as good as the sum of thyself and a hero. describes adding one to the listener’s previous value. The same operation might be written count = count + 1 in a conventional language. The literary form changes how the operation is expressed, not the underlying arithmetic.
SPL character stacks are conceptually similar to the push-and-pop abstraction demonstrated in the separate Chef Put and Fold lesson. However, SPL’s Remember and Recall commands follow their own syntax and are reserved for a later module.
Practical Lab and Troubleshooting
Use a compatible implementation, such as the modern shakespearelang interpreter, inside a disposable environment. Copy the teaching example into a file in the format required by the selected tool. Before executing, trace the initial values and predict the listener’s result. Note the tool’s version and compare the actual output against the prediction.
- Unknown character: Check that every name belongs to the implementation’s supported Shakespeare cast and is declared.
- Missing listener: Check preceding Enter and Exit statements; an off-stage variable cannot receive a second-person assignment.
- Ambiguous audience: Reduce the stage to the intended two characters before using an unqualified second-person pronoun.
- Unexpected sign: Inspect the accepted noun, not merely the emotional tone of the sentence.
- Unexpected magnitude: Count valid adjectives immediately modifying that noun.
- Unexpected output type: Open your heart outputs a number, while Speak your mind outputs the corresponding character.
Repeat the experiment after substituting pig for hero, then add one accepted adjective to predict a value of negative two. Do not represent an unexecuted prediction as an observed result. Distinguish reference-specification behavior from extensions or incompatibilities in modern interpreters.
Exercises and Knowledge Check
- Which part of a character declaration determines the variable identity?
- Why is the descriptive prose after Romeo’s name not an ordinary variable assignment?
- What is the value of a positive noun modified by two accepted adjectives?
- When Juliet speaks to Romeo, whose value changes?
- What differs between Open your heart and Speak your mind?
- Why does a third on-stage character create a potential problem for second-person pronouns?
Answers
- The recognized Shakespeare character name, such as Romeo.
- The compiler uses the description for theatrical appearance and ignores it semantically.
- Positive four, since one multiplied by two twice is four.
- Romeo, because Juliet is the speaker and Romeo is the intended listener.
- The former outputs a numeric value; the latter emits the character represented by the numeric code.
- The listener becomes ambiguous when more than one other character is on stage.
References and Further Reading
- Original Shakespeare Programming Language specification (2001)
- Mirror of the reference translator, vocabulary, and documentation
- Modern SPL interpreter and debugger documentation
- Additional examples and experiments with SPL
- Open Source Tech Cert — Shakespeare Program Structure
- Open Source Tech Cert — Emojicode and Esoteric Syntax
Elementary Conclusion
SPL uses character names as variable names. It uses stage directions to decide which characters are available, and dialogue to change the number held by the listener. Special words can represent positive or negative numbers. Recognized adjectives double their magnitudes.
To understand a Shakespeare program, identify the speaker, find the listener, work out the value of the spoken expression, and update the listener’s number. Beneath the costume of a stage play, the underlying reasoning is the same as in ordinary programming.
Editor’s Note: OSShakespeare.002 builds on the previous lesson using the original 2001 SPL specification. The educational diagrams illustrate the language model. Code execution and individual video playback are not independently verified.

For mobile scanning, open this lesson on a larger screen and use a compatible Bitcoin wallet to scan the original QR code. Verify the address before sending 5,000 sats: 3C9o19EH5HSiwEPyCTmEKzxhNCbo2X6TTb.
We volunteer daily to ensure the credibility of the information on this platform is Verifiably True. If you would like to support to help further secure the integrity of our research initiatives, please donate using the QR code provided.
BitcoinVersus.tech is not a financial advisor. This media platform reports on financial subjects purely for informational purposes.

Leave a Reply