Shakespeare (programming language)

Shakespeare (programming language)

The Shakespeare Programming Language (SPL) is an esoteric programming language designed by Jon Åslund and Karl Hasselström. [ [http://shakespearelang.sourceforge.net/report/shakespeare/shakespeare.html The Shakespeare Programming Language] ] 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.

Programming in Shakespeare

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.

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, DescriptionWhere 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.

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.

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. 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.

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]

List of reserved words

As defined in the perl implementation [http://search.cpan.org/dist/Lingua-Shakespeare/lib/Lingua/Shakespeare.pod Lingua::Shakespeare]

Adjectives

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,rotten,smelly,snotty,sorry,stinking,stuffed,stupid,vile,villainous,worried

Neutral

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

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

Nouns

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

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

Positive

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

ee also

*Literate programming
*Chef
*Inform 7

References

* http://shakespearelang.sourceforge.net/report/shakespeare/shakespeare.html

External links

* [http://shakespearelang.sourceforge.net/ Homepage]
* [http://sourceforge.net/projects/shakespearelang/ SourceForge page]
* [http://people.csa.iisc.ernet.in/sreejith/frontends/spl/ GCC Frontend] (also has fuller language description)
* [http://developers.slashdot.org/article.pl?sid=01/08/31/1126253&mode=thread Shakespeare Programming Language] on Slashdot


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Shakespeare Programming Language — Die Shakespeare Programming Language (SPL) ist eine von Kalle Hasselström und Jon Åslund im Jahre 2001 entwickelte imperative esoterische Programmiersprache (Computersprache), welche in C realisiert wurde und zu den am schwersten erlernbaren… …   Deutsch Wikipedia

  • Shakespeare Programming Language — Pour les articles homonymes, voir Shakespeare (homonymie). Le Shakespeare Programming Language ou SPL est un langage de programmation créé par Karl Hasselström et Jon Åslund en février 2001 dont le code source ressemble à une pièce de théâtre. Il …   Wikipédia en Français

  • Esoteric programming language — An esoteric programming language (sometimes shortened to esolang) is a programming language designed as a test of the boundaries of computer programming language design, as a proof of concept, or as a joke. There is usually no intention of the… …   Wikipedia

  • Shakespeare (disambiguation) — Shakespeare may refer to the following people: * William Shakespeare, the playwright * John Shakespeare, father of William * Susanna Shakespeare, daughter of William * Judith Shakespeare, younger daughter of William * Hamnet Shakespeare, son of… …   Wikipedia

  • Shakespeare (Begriffsklärung) — Shakespeare ist der Familienname folgender Personen: Nicholas Shakespeare (* 1957), britischer Journalist und Schriftsteller Robert Shakespeare (* 1953), jamaikanischer Musiker William Shakespeare (1564–1616), englischer Dramatiker William… …   Deutsch Wikipedia

  • Shakespeare (Programmiersprache) — Die Shakespeare Programming Language (SPL) ist eine von Kalle Hasselström und Jon Åslund im Jahre 2001 entwickelte imperative esoterische Programmiersprache (Computersprache), welche in C realisiert wurde und zu den interessantesten, aber auch am …   Deutsch Wikipedia

  • Shakespeare — William Shakespeare William Shakespeare William Shakespeare. Activité(s) dramaturge, poète Naissance …   Wikipédia en Français

  • Shakespeare (homonymie) — Cette page d’homonymie répertorie les différents sujets et articles partageant un même nom. Sommaire 1 Patronymes 2 Œuvres 3 …   Wikipédia en Français

  • Weird Programming — Esoterische Programmiersprachen sind Programmiersprachen, die nicht für den praktischen Einsatz entwickelt wurden, sondern ungewöhnliche Sprachkonzepte umsetzen. Eine einfache Bedienung ist selten, teilweise werden Sprachen konzipiert, um… …   Deutsch Wikipedia

  • William Shakespeare — Pour les articles homonymes, voir Shakespeare (homonymie). William Shakespeare Will …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”