Hubbry Logo
search
logo

Shakespeare Programming Language

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Shakespeare Programming Language

The Shakespeare Programming Language (SPL) is an esoteric programming language designed by Jon Åslund and Karl Wiberg. 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 recognize only those 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", "Thou", or "Thee". 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:

Lines are represented as dialogue spoken by a character, and consist of at least one sentence. Each sentence may assign a new value to a variable, direct a variable to output its value, or direct it to receive an input. Lines can also manipulate stacks or act as if/then or goto statements. A line starts with a character's name and a colon. Since this character is the speaker, the other character on stage is the variable that is addressed as "You", "Thou", or "Thee".

See all
User Avatar
No comments yet.