Linguaggi di programmazione molto esoterici

“Hello World” in Piet (vedi https://en.wikipedia.org/wiki/Esoteric_programming_language#Piet )

Io sono molto anzyano, e sapevo dell’esistenza di linguaggi di programmazione volutamente incomprensibili come per esempio INTERCAL. Ho però appena scoperto che esiste una pletora di questi linguaggi, generalmente inventati per divertimento: trovate un elenco su esolangs.org e le relative implementazioni a tio.run.

Segnalo due linguaggi in particolare: Shakespeare, dove le istruzioni sono righe di opere in stile appunto scespiriano, e Rockstar, che invece usa testi metallari. (Per dire, cito dalla sua documentazione: «(Anche se non tipici, Eleanor Rigby, Peggy Sue, Black Betty, e Johnny B Goode sarebbero tutti nomi validi per una variabile in Rockstar.)»
Per darvi un esempio, ecco come verrebbe programmato il gioco per bambini FizzBuzz, quello in cui si conta da uno in su ma ogni volta che il numero è un tre o contiene un multiplo di tre bisogna dire Fizz! mentre se il numero è un 5 o contiene un multiplo di cinque bisogna dire Buzz!.

In Shakespeare (vedi qui per una spiegazione):

The Elucidation of Foul Multiples.

Romeo, the hopeless romantic.
Mercutio, the grave man.
Prince Henry, the noble.
Ophelia, the drowned.

Act I: The Revelation Of Wretched Multiples.

Scene I: Romeo The Sweet Talker.

[Enter Prince Henry and Romeo]

Romeo:
You are as rich as the sum of a handsome happy honest horse and a lovely fellow.
Thou art the square of thyself.

[Exit Prince Henry]

[Enter Ophelia]

Romeo:
You are the sum of a beautiful blossoming daughter and the moon.
[Exit Ophelia]

[Enter Mercutio]

Romeo:
You plum.

Scene II: A Pox Upon Both Houses.
Mercutio:
Is the remainder of the quotient between myself and the difference between Ophelia and a
warm wind as good as nothing?

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

Scene III: What's In A Name.
Mercutio:
Is the remainder of the quotient between myself and Ophelia as good as nothing?

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

Scene IV: You Shall Find Me A Grave Man.
Romeo:
Open your heart!

Mercutio:
Let us proceed to scene VII.

Scene V: I Do Not Bite My Thumb At You.
Mercutio:
Thou art the sum of a warm lamp and Ophelia.
You are the product of thyself and the product of Ophelia and a brave squirrel.
Speak your mind!

You are the sum of yourself and the sum of a rich father and a mother. Speak your mind!

Thou art the sum of the sum of the square of a cute cunning squirrel and a plum and thyself.
Speak your mind! Speak your mind!

Is the remainder of the quotient between myself and Ophelia as good as nothing?

Romeo:
If not, let us proceed to scene VII.

Scene VI: Wherefore Art Thou Romeo.
Mercutio:
Thou art the sum of a fair fine angel and a gentle lovely flower.
You are the sum of a fair daughter and the square of thyself! Speak your mind!

You are as charming as the sum of yourself and the square of a beautiful lovely lamp.
Thou art the sum of thyself and the sum of a rich purse and a plum. Speak your mind!

Thou art the sum of thyself and Ophelia. Speak your mind! Speak your mind!

Scene VII: Good Night, Good Night, Parting Is Such Sweet Sorrow.
Romeo:
You are as noble as the sum of yourself and a Lord.

Mercutio:
You are the product of Ophelia and a warm wind. Speak your mind!

Mercutio:
Am I better than Prince Henry?

Romeo:
If not, let us return to Scene II.
[Exeunt]


Lo stesso programma, scritto in Rockstar (vedi qui per una versione meno metallara):

Midnight takes your heart and your soul
While your heart is as high as your soul
Put your heart without your soul into your heart

Give back your heart

Desire is a lovestruck ladykiller
My world is nothing
Fire is ice
Hate is water
Until my world is Desire,
Build my world up
If Midnight taking my world, Fire is nothing and Midnight taking my world, Hate is nothing
Shout "FizzBuzz!"
Take it to the top

If Midnight taking my world, Fire is nothing
Shout "Fizz!"
Take it to the top

If Midnight taking my world, Hate is nothing
Say "Buzz!"
Take it to the top

Whisper my world

Niente male, vero?

Ah, quello della figura è un programma scritto in Piet (nel senso di Mondrian), che se eseguito ritorna il classico “Hello World”.

2 pensieri su “Linguaggi di programmazione molto esoterici

I commenti sono chiusi.