The Shakespeare Programming Language (SPL) is an esoteric programming language designed by Jon Åslund and Karl Hasselström. Like the Chef programming language, it is designed to make programs appear to be something other than programs; in this case, Shakespearean plays.
A character list in the beginning of the program declares a number of stacks, naturally with names like "Romeo" and "Juliet". These characters enter into dialogue with each other in which they manipulate each other's topmost values, push and pop each other, and do I/O. The characters can also ask each other questions which behave as conditional statements. On the whole, the programming model is very similar to assembly language but much more verbose.
The first line in a Shakespeare program is called the 'title'. The compiler considers anything from the first line to the first period to be a comment.
This is the section where variables are declared. Each variable can hold a signed integer value and is of the following form:
Where Name
is the name of the variable and Description
is ignored by the compiler. The compiler will only recognize names that correspond to actual Shakespearean characters.
A piece of code in Shakespeare is broken into Acts
which contain Scenes
in which characters (variables) interact. Each Act
and Scene
is numbered with a Roman numeral and serves as a GOTO
label. Any code after the colon is considered a comment. They are written in the form:
Individual lines of code generally take the form of a piece of dialogue spoken by one character to another; this is how the value of a variable (the character spoken to) is assigned, changed, or output. A character can only be addressed as "you". Thus, there must typically be exactly two characters "on stage" whenever lines are spoken: one to speak, and the other to be spoken to. To call a variable to the stage the Enter
command is used with a list of one or more characters. The Exit
command tells exactly one listed character to leave the stage. Exeunt
calls more than one character to leave, or in the case that no characters are listed all the characters will leave the stage. The following format is used: