Lingua::Shakespeare
Implementation of programming language ShakespeareShakespeare implementation by Graham Barr, designed as a Perl module. To run a program using this module, add
use Lingua::Shakespeare;
to the start of the program, and run it as Perl code.
Examples:
Hello, World!:
Example for versions Lingua::Shakespeare 1.00The message is printed in a simplest way: ASCII-code of each character is calculated anew as a sum of powers of two present in its binary notation.
use Lingua::Shakespeare;
Shakespeare-style Encoded Message.
Desdemona, the talker.
Pericles, a shut-pan with notable patience.
Act I: Message output.
Scene I: Letter by letter.
[Enter Desdemona and Pericles]
Desdemona:
You honest reddest gentle loving sweet brave rose!
You are as bottomless as the sum of yourself and a rural red purple hamster!
Speak your mind!
You bold cunning peaceful proud good sweetest hero!
You are as pretty as the sum of thyself and a warm cunning cute fine delicious kingdom!
You are as bottomless as the sum of yourself and a rural white morning!
You are as small as the sum of yourself and a grandfather!
Speak your mind!
You sweetest proud happy prompt cunning loving joy!
You are as embroidered as the sum of yourself and a reddest loving beautiful cunning handsome happiness!
You are as reddest as the sum of yourself and a peaceful cunning beautiful pony!
You are as rural as the sum of yourself and a white tiny sky!
Speak your mind!
Speak your mind!
You healthy amazing loving clearest trustworthy good happiness!
You are as brave as the sum of yourself and a cunning golden loving peaceful mighty pony!
You are as delicious as the sum of thyself and a mighty rich gentle plum!
You are as embroidered as the sum of yourself and a fine bold hero!
You are as old as the sum of yourself and a tiny cat!
You are as green as the sum of thyself and a stone wall!
Speak your mind!
You bottomless big blue purple huge horse!
You are as lovely as the sum of thyself and a gentle prompt delicious Heaven!
You are as red as the sum of yourself and a bottomless big moon!
Speak your mind!
You tiny red furry rural bottomless sky!
Speak your mind!
You rural bluest large bottomless little purple cow!
You are as sweet as the sum of yourself and a embroidered cute trustworthy rich rose!
You are as bottomless as the sum of yourself and a green normal cow!
You are as proud as the sum of thyself and a handsome summer's day!
You are as happy as the sum of thyself and a flower!
Speak your mind!
You tiny bluest large huge hard normal uncle!
You are as warm as the sum of yourself and a pretty rich charming reddest mighty Heaven!
You are as small as the sum of yourself and a huge green little morning!
You are as sweetest as the sum of yourself and a beautiful sweet kingdom!
You are as warm as the sum of yourself and a proud happiness!
You are as hard as the sum of yourself and a roman!
Speak your mind!
You warm cute happy pretty golden loving Lord!
You are as huge as the sum of thyself and a little furry small green yellow brother!
You are as peaceful as the sum of thyself and a honest brave happy fine flower!
You are as small as the sum of yourself and a yellow purse!
Speak your mind!
You normal purple rural old white big morning!
You are as blossoming as the sum of yourself and a charming cunning gentle lovely amazing happiness!
You are as normal as the sum of thyself and a large red big animal!
You are as charming as the sum of yourself and a healthy delicious hero!
Speak your mind!
You large old bluest green red rural lantern!
You are as sweet as the sum of yourself and a beautiful loving sunny mighty reddest summer's day!
You are as lovely as the sum of yourself and a bold clearest happiness!
Speak your mind!
You golden loving fair charming lovely King!
You are as rural as the sum of thyself and a squirrel!
Speak your mind!
[Exeunt]
Factorial:
Example for versions Lingua::Shakespeare 1.00This example uses iterative factorial definition. In scene I variables are initialized (except for loop index which is 0 by default), scene II is the loop which prints the current number, characters and the factorial, and then checks whether the current number is 17 — if it is, the loop breaks.
use Lingua::Shakespeare;
Elizabethan Factorial.
Ferdinand, for factorial.
Isabella, for loop index.
Emilia, for exclamation mark.
Sebastian, for space.
Egeus, for equality sign.
Lucio, for newline.
Act I: Factorial calculations.
Scene I: Initialization.
[Enter Isabella and Sebastian]
Isabella:
You are as fat as the product of a big black furry old cat and a white cow!
[Exit Sebastian]
[Enter Emilia]
Isabella:
You are as distasteful as the sum of Sebastian and a chihuahua!
[Exit Emilia]
[Enter Egeus]
Isabella:
You are as good as the difference between the sum of Sebastian and Emilia and a bold brave hero!
[Exit Egeus]
[Enter Lucio]
Isabella:
You are as cute as the sum of a peaceful warm delicious summer's day and a cute squirrel!
[Exit Lucio]
[Enter Ferdinand]
Isabella:
You brother!
Scene II: Loop.
Ferdinand:
Open your heart!
[Exit Ferdinand]
[Enter Emilia]
Isabella:
Speak your mind!
[Exit Emilia]
[Enter Sebastian]
Isabella:
Speak your mind!
[Exit Sebastian]
[Enter Egeus]
Isabella:
Speak your mind!
[Exit Egeus]
[Enter Sebastian]
Isabella:
Speak your mind!
[Exit Sebastian]
[Enter Ferdinand]
Isabella:
Open your heart!
[Exit Ferdinand]
[Enter Lucio]
Isabella:
Speak your mind!
[Exit Lucio]
[Enter Ferdinand]
Ferdinand:
You are as good as the sum of yourself and a rose.
Isabella:
You are as gentle as the product of myself and yourself.
Am I not as beautiful as the sum of your sweet charming lovely noble sister and a flower?
Ferdinand:
If so, let us return to scene II.
[Exeunt]
Fibonacci numbers:
Example for versions Lingua::Shakespeare 1.00This example uses iterative method of calculating Fibonacci numbers. After the loop (end of scene II) loop counter Isabella
is re-used to print full stops.
use Lingua::Shakespeare;
Fibonacci Numbers.
Isabella, the loop index.
Falstaff, a Fibonacci number.
Fortinbras, another Fibonacci number.
Sebastian, space.
Cordelia, comma.
Act I: Factorial calculations.
Scene I: Initialization.
[Enter Isabella and Sebastian]
Isabella:
You are as fat as the product of a big black furry old cat and a white cow!
[Exit Sebastian]
[Enter Cordelia]
Isabella:
You are as beautiful as the sum of Sebastian and the sum of a tiny yellow furry hamster and the clearest blue sky!
[Exit Cordelia]
[Enter Fortinbras]
Isabella:
You father!
Scene II: Loop.
Isabella:
Open your heart!
You are as noble as the sum of yourself and Falstaff.
[Exit Fortinbras]
[Enter Falstaff]
Isabella:
You are as brave as the difference between Fortinbras and yourself.
[Exit Falstaff]
[Enter Cordelia]
Isabella:
Speak your mind!
[Exit Cordelia]
[Enter Sebastian]
Isabella:
Speak your mind!
[Exit Sebastian]
[Enter Fortinbras]
Fortinbras:
You are as good as the sum of yourself and a rose.
Isabella:
Am I not as beautiful as your sweet charming lovely noble sister?
Fortinbras:
If so, let us return to scene II.
You are as good as the sum of Cordelia and a fine horse!
Speak your mind! Speak your mind! Speak your mind!
[Exeunt]
Comments
]]>blog comments powered by Disqus
]]>