Shakespeare (programming language)

From Wikipedia, the free encyclopedia

Jump to: navigation, search

The Shakespeare Programming Language (SPL) is an esoteric programming language designed by Jon Åslund and Karl Hasselström.[1] 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 more than an order of magnitude more verbose.

Contents

[edit] Programming in Shakespeare

[edit] Title

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.

[edit] Dramatis Personæ

This is the section where variables are declared. Each variable can hold a signed integer value and is of the following form:

Name, Description

Where Name is the name of the variable and Description is ignored by the compiler.
Each variable name must be the name of a character from a Shakespeare play.

[edit] Acts and Scenes

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 GOTO labels. Any code after the colon is considered a comment. They are written in the form:

Act I: Hamlet's insults and flattery.
Scene I: The insulting of Romeo.

[edit] Enter, Exit and Exeunt

Before "Characters" (variables) can "Act" (be acted upon) they must first be "on stage". To call a variable to the stage the Enter command is used. However, only two characters may be on stage at a time, else it is unclear who is being addressed. To tell characters to leave the stage, use the Exit command. 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:

[Enter Juliet] 
[Enter Romeo and Juliet]
[Exit Romeo]
[Exeunt Romeo and Juliet]
[Exeunt]

Lines consist of the name of a character, a colon, and one or more sentences.

[edit] Example code

This is part of the standard "Hello World" program in SPL. The statements assign numerical values to the other character, and "Speak your mind" is an order to the other character to output that value as a character.

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.

Act I: Hamlet's insults and flattery.
Scene I: The insulting of Romeo.
[Enter Hamlet and Romeo]
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!
You are as brave as the sum of your fat little stuffed misused dusty old rotten codpiece and a beautiful fair warm peaceful sunny summer's day. You are as healthy as the difference between the sum of the sweetest reddest rose and my father and yourself! Speak your mind!
You are as cowardly as the sum of yourself and the difference between a big mighty proud kingdom and a horse. Speak your mind.
Speak your mind!
[Exit Romeo]
Scene II: The praising of Juliet.
[Enter Juliet]
Hamlet: Thou art as sweet as the sum of the sum of Romeo and his horse and his black cat! Speak thy mind!
[Exit Juliet]
Scene III: The praising of Ophelia.
[Enter Ophelia]
Hamlet: Thou art as lovely as the product of a large rural town and my amazing bottomless embroidered purse. Speak thy mind!
Thou art as loving as the product of the bluest clearest sweetest sky and the sum of a squirrel and a white horse. Thou art as beautiful as the difference between Juliet and thyself. Speak thy mind!
[Exeunt Ophelia and Hamlet]

Act II: Behind Hamlet's back.
Scene I: Romeo and Juliet's conversation.
[Enter Romeo and Juliet]
Romeo: Speak your mind. You are as worried as the sum of yourself and the difference between my small smooth hamster and my nose. Speak your mind!
Juliet: Speak YOUR mind! You are as bad as Hamlet! You are as small as the difference between the square of the difference between my little pony and your big hairy hound and the cube of your sorry little codpiece. Speak your mind!
[Exit Romeo]
Scene II: Juliet and Ophelia's conversation.
[Enter Ophelia]
Juliet: Thou art as good as the quotient between Romeo and the sum of a small furry animal and a leech. Speak your mind!
Ophelia: Thou art as disgusting as the quotient between Romeo and twice the difference between a mistletoe and an oozing infected blister! Speak your mind!
[Exeunt]

[edit] List of reserved words

As defined in the perl implementation Lingua::Shakespeare

[edit] Adjectives

[edit] Negative

bad, cowardly, cursed, damned, dirty, disgusting, distasteful, dusty, evil, fat, fat-kidneyed, fatherless, foul, hairy, half-witted, horrible, horrid, infected, lying, miserable, misused, oozing, rotten, smelly, snotty, sorry, stinking, stuffed, stupid, vile, villainous, worried

[edit] Neutral

big, black, blue, bluest, bottomless, furry, green, hard, huge, large, little, normal, old, purple, red, rural, small, tiny, white, yellow

[edit] Positive

amazing, beautiful, blossoming, bold, brave, charming, clearest, cunning, cute, delicious, embroidered, fair, fine, gentle, golden, good, handsome, happy, healthy, honest, lovely, loving, mighty, noble, peaceful, pretty, prompt, proud, reddest, rich, smooth, sunny, sweet, sweetest, trustworthy, warm

[edit] Nouns

[edit] Negative

Hell, bastard, beggar, blister, codpiece, coward, curse, death, devil, draught, famine, flirt-gill, goat, hate, hog, hound, leech, lie, pig, plague, starvation, toad, war, wolf

[edit] Neutral

animal, aunt, brother, cat, chihuahua, cousin, cow, daughter, door, face, father, fellow, granddaughter, grandfather, grandmother, grandson, hair, hamster, horse, lamp, lantern, mistletoe, moon, morning, mother, nephew, niece, nose, purse, road, roman, sister, sky, son, squirrel, stone wall, thing, town, tree, uncle, wind

[edit] Positive

Heaven, King, Lord, angel, flower, happiness, joy, plum, summer's day, hero, rose, kingdom, pony

[edit] See also

[edit] References

[edit] External links

Personal tools