Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Perl-Sensitive Sunglasses
 
PerlMonks  

Shakespeare Programming Language

by trantor (Chaplain)
on Sep 01, 2001 at 18:16 UTC ( #109634=poem: print w/ replies, xml ) Need Help??

Although not directly related to Perl (yet?), I bumped into this site today and I think it's brillant, to say the least. It was on display on slashdot.

Programs are written in such a way that they resemble a Shakespeare play. The site describes the language syntax and has some really beautiful examples.

Here's an example of SPL (Shakespeare Programming Language). I'd like to point out that this is not my code!

Prime Number Computation in Copenhagen. Romeo, a young man of Verona. Juliet, a young woman. Hamlet, a temporary variable from Denmark. The Ghost, a limiting factor (and by a remarkable coincidence also Hamlet's father). Act I: Interview with the other side. Scene I: At the last hour before dawn. [Enter the Ghost and Juliet] The Ghost: You pretty little warm thing! Thou art as prompt as the difference between the square of thyself and your golden hair. Speak your mind. Juliet: Listen to your heart! [Exit the Ghost] [Enter Romeo] Juliet: Thou art as sweet as a sunny summer's day! Act II: Determining divisibility. Scene I: A private conversation. Juliet: Art thou more cunning than the Ghost? Romeo: If so, let us proceed to scene V. [Exit Romeo] [Enter Hamlet] Juliet: You are as villainous as the square root of Romeo! Hamlet: You are as lovely as a red rose. Scene II: Questions and the consequences thereof. Juliet: Am I better than you? Hamlet: If so, let us proceed to scene III. Juliet: Is the remainder of the quotient between Romeo and me as good as nothing? Hamlet: If so, let us proceed to scene IV. Thou art as bold as the sum of thyself and a roman. Juliet: Let us return to scene II. Scene III: Romeo must die! [Exit Hamlet] [Enter Romeo] Juliet: Open your heart. [Exit Juliet] [Enter Hamlet] Romeo: Thou art as rotten as the difference between nothing and the sum of a snotty stinking half-witted hog and a small toad! Speak your mind! [Exit Romeo] [Enter Juliet] Scene IV: One small dog at a time. [Exit Hamlet] [Enter Romeo] Juliet: Thou art as handsome as the sum of thyself and my chihuahua! Let us return to scene I. Scene V: Fin. [Exeunt]

In short, variables are Shakespeare actors and contain scalar values only. Computations are performed in act and scenes, by means of dialogues between characters.

It somewhat reminds me of Lingua::Romana::Perligata, but SPL translates to C, not to Perl (again, yet? (-;)

I really like the way conditionals are expressed in the language. String output is a bit awkward, but it's part of the beauty of poetry.

That's just another example of how much programming and art have in common.

I think the authors (Kalle Hasselström and Jon Åslund, from Sweden) deserve a load of ++

Now, if only we could find a similar way of expressing regular expressions, the x modifier would become redundant :-)

-- TMTOWTDI

Comment on Shakespeare Programming Language
Download Code
they call this Shakespearean?
by Vynce (Friar) on Sep 04, 2001 at 12:57 UTC

    But... but...

    It isn't iambic pentameter!

    OK, i feel a little better now.

    .
      But Vynce, it does not have to be of iambs
      Made to qualify. The Works contain
      Much prose and stuff.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: poem [id://109634]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (12)
As of 2014-04-21 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (495 votes), past polls