Web - Amazon

We provide Linux to the World


We support WINRAR [What is this] - [Download .exe file(s) for Windows]

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
SITEMAP
Audiobooks by Valerio Di Stefano: Single Download - Complete Download [TAR] [WIM] [ZIP] [RAR] - Alphabetical Download  [TAR] [WIM] [ZIP] [RAR] - Download Instructions

Make a donation: IBAN: IT36M0708677020000000008016 - BIC/SWIFT:  ICRAITRRU60 - VALERIO DI STEFANO or
Privacy Policy Cookie Policy Terms and Conditions
Shakespeare (język programowania) - Wikipedia, wolna encyklopedia

Shakespeare (język programowania)

Z Wikipedii

Shakespeare jest ezoterycznym językiem programowania stworzonym przez Jona Åslunda i Karla Hasselströma. Podobnie jak Chef jest tak zaprojektowany, aby sprawiał wrażenie czegoś innego niż kod źródłowy; w tym przypadku są to dramaty Williama Szekspira.

Lista postaci biorących udział w sztuce jest deklaracją ilości stosów używanych w programie. Postaci te prowadzą ze sobą dialog zmieniając sobie nawzajem wartości z wierzchu stosu, wykonując polecenia typu push i pop i przeprowadzając I/O. Mogą również zadawać sobie nawzajem pytania, które mają charakter instrukcji warunkowych. W całości język przypomina asembler.

Spis treści

[edytuj] Programowanie w Shakespeare

[edytuj] Tytuł

Pierwsza linijka jest nazywana "tytułem". Kompilator traktuje wszystko od pierwszej linijki do pierwszej części jako komentarz.

[edytuj] Lista postaci

Jest to sekcja w której deklaruje się zmienne i stosy. Każda zmienna może zawierać oznakowaną liczbę całkowitą. Deklaracja wygląda następująco:

Imię, Opis

Gdzie Imię jest nazwą zmiennej, a Opis jest traktowany jako komentarz. Imię musi być imieniem jednego z bohaterów dramatów szekspirowskich, inaczej wystąpi błąd kompilacji.

[edytuj] Akty i sceny

Program dzieli się na akty, a następnie na sceny, w których występują postaci, a więc w których operujemy zmiennymi. Każdy akt i scenę deklaruje się z użyciem rzymskich cyfr, a następnie po dwukropku opisu fragmentu. Deklaracja wygląda następująco:

Act I: Oszczerstwa Hamleta i wewnętrzna rozterka.
Scene I: Podłość Hamleta

[edytuj] Enter, Exit i Exeunt

Enter (pol. wchodzi na scenę), Exit (pol. schodzi ze sceny), Exeunt (z łac. exeunt, wychodzą) używa się do kierowania postaci (zmiennych) na scenę. Aby wywołać zmienną (wywołać postać na scenę) lub kilka zmiennych należy użyć [Enter]. Aby powiedzieć postaci by opuściła scenę korzysta się z Exit. W przypadku więcej niż jednej zmiennej korzysta się z [Exeunt], lub kiedy nie podamy żadnej zmiennej zakańczamy scenę. Korzysta się z następującego formatu:

[Enter Romeo]
[Enter Juliet and Romeo]
[Exit Juliet]
[Exeunt Juliet and Romeo]
[Exeunt]

[edytuj] Wartości

Aby przywołać wartości (takie jak 8 czy 1734) należy korzystać z rzeczowników i przymiotników.

Każdy rzeczownik przybiera wartość 1 lub -1, w zależności czy jest ładny czy nie. Dla przykładu, rzeczownik flower (pol. kwiat) przyjmie wartość 1, gdyż kwiaty są ładne. Natomiast wyraz pig (pol. świnia) przybiera wartość -1, gdyż świnie kojarzą się z brudem i brzydotą. Neutralne rzeczowniki takie jak tree (pol. drzewo) również przyjmują wartość 1.

Dzięki przymiotnikom podwajamy wartość rzeczownika; kolejnym przymiotnikiem znów podwajamy wartość, itd.. Dzięki temu można osiągnąć każdą wielokrotność dwójki. Na tej podstawie możemy tworzyć inne liczby dodając je do siebie (The sum of X and Y, Suma X i Y) czy odejmując (The difference between X and Y, Różnica pomiędzy X i Y). Można również podnosić wartości do kwadratu za pomocą square, czy do sześcianu używając cube. A więc The difference between the square of a little flower and a smelly dirty pig jest równe (2*1)²-(2*2*-1), czyli 8.

[edytuj] Przykładowy kod

Poniżej znajduje się część kodu programu wyświetlającego na ekranie Hello world. Zdania twierdzące przypisują wartości liczbowe postaciom, natomiast "Speak your mind" (pol. wyraź swe myśli) wyświetla wartość jako znak.

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]

[edytuj] Linki zewnętrzne

Our "Network":

Project Gutenberg
https://gutenberg.classicistranieri.com

Encyclopaedia Britannica 1911
https://encyclopaediabritannica.classicistranieri.com

Librivox Audiobooks
https://librivox.classicistranieri.com

Linux Distributions
https://old.classicistranieri.com

Magnatune (MP3 Music)
https://magnatune.classicistranieri.com

Static Wikipedia (June 2008)
https://wikipedia.classicistranieri.com

Static Wikipedia (March 2008)
https://wikipedia2007.classicistranieri.com/mar2008/

Static Wikipedia (2007)
https://wikipedia2007.classicistranieri.com

Static Wikipedia (2006)
https://wikipedia2006.classicistranieri.com

Liber Liber
https://liberliber.classicistranieri.com

ZIM Files for Kiwix
https://zim.classicistranieri.com


Other Websites:

Bach - Goldberg Variations
https://www.goldbergvariations.org

Lazarillo de Tormes
https://www.lazarillodetormes.org

Madame Bovary
https://www.madamebovary.org

Il Fu Mattia Pascal
https://www.mattiapascal.it

The Voice in the Desert
https://www.thevoiceinthedesert.org

Confessione d'un amore fascista
https://www.amorefascista.it

Malinverno
https://www.malinverno.org

Debito formativo
https://www.debitoformativo.it

Adina Spire
https://www.adinaspire.com