Shakespeare

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
For the functional stack language, see spl. For the brainfuck derivative, see SPL.

The Shakespeare Programming Language (SPL) is an esoteric programming language created by Karl Hasselström and Jon Åslund in 2001. The design goal of Shakespeare was, according to the Manual, to make a language with beautiful source code that resembled Shakespeare plays.


Language Overview

Instructions are written as a play script, using characters as variables. Most variable manipulation is done through dialogue.

Title

Shakespeare starts with a title name (consisting of any character other than new line and .) and a ..
Example Title. (This is simply to specify what the program does, and nothing else.)

Introductions

You must then introduce characters, restricted to ones from Shakespeare plays, followed by a comma, description, and .. There must be at least one non-whitespace character in the description.
Romeo, a young man with a remarkable patience.

Acts

At least one act must be defined. Denoted as Act RomanNumeral: description. Act numbers start at one, and increment by for each new act.
Act I: The Murder of Juliet.

Scenes

Scenes are used as goto labels. At least one scene is required per act.
Scene I: description_goes_here..

Instructions

For all operations, "you" and all of "it's" forms are interchangeable with "thou" and "it's" forms, as long a proper grammar is maintained.

To be written, characters must first enter the stage. Use the format "[Enter Character]" or "[Enter Character and OtherCharacter]". A maximum of two characters can be on the stage at any one time. You can remove a character from the stage with "[Exit Character]" or remove all characters using "[Exeunt]".

By a character saying the following commands,

  • "Speak your mind." - Outputs the ASCII character corresponding to the value held in the character being spoken to.
  • "Open your heart." - Outputs the numeric value held in the Sahara ter being spoken to.
  • "Open your mind." - Inputs an ASCII character from the user and stores it in the character being spoken to.
  • "Listen to your heart." - Inputs a number from the user and stores it in the character being spoken to.

To set which character is speaking, write:

Name:

Characters edit each other's values using dialogue. The general form is "You are" followed either by a character, constant expression, operation expression, or simile.
Constant expressions consist of a 'positive' (complementing) or 'negative' (insulting) noun, preceded by zero or more adjectives. A noun is equal to either 1 or -1, and each attached adjective doubles its value. A simile is written "as adjective as ", means nothing, and can be followed by a constant expression, character, or an operation expression. Operation expressions are written the operation of constant, operation, or character and constant, operation, or character.. Characters can be referenced using "yourself" or "thyself" if they are on stage, or by name if they aren't. For example:

[Enter Romeo and Juliet]

Romeo:
   Thou art a vile coward!  Open thy heart!
Juliet:
   You are as lovely as the sum of Hamlet and a brave tree.  Open thy heart.

Output:
-2&gtHamlet+2&lt
Conditional statements are written something like this:


Scene II: The grand if greater than condition.

[Enter Romeo and Juliet]

Juliet:
Am I better than you?
Romeo:
If so, let us proceed to scene I.


Scene II: The just as incredible if equal to condition.

[Enter Romeo and Juliet]

Juliet:
Am I as good as you?
Romeo:
If so, let us proceed to scene I.

Computational class

As every Shakespeare program can be converted into a brainfuck program, (see here: https://github.com/mjdarby/Brain2Speare) Shakespeare is turing- complete. (More information needed)

Examples

Hello World!

The Infamous Hello World Program.

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 beautiful as the difference between Romeo and the square
 of a huge green peaceful tree. Speak thy mind!

 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]

Truth Machine

The Truth Machine.

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.


                    Act I: The Truth.

                    Scene I: The Initialization.

[Enter Romeo and Juliet]

                    Scene II: The Looping Heart.

Romeo:
	Listen to your heart!  Open your heart!

Juliet:
	Am I better than you?

Romeo:
	If so, let us proceed to scene II.

[Exeunt]

External resources