Ook!

Ook! ist eine Variante der esoterischen Programmiersprache Brainfuck für Orang-Utans, entwickelt von David Morgan-Mar.[1][2] Obwohl bei Ook! de

Ook!

Ook! ist eine Variante der esoterischen Programmiersprache Brainfuck für Orang-Utans, entwickelt von David Morgan-Mar.[1][2] Obwohl bei Ook! der humoristische Ansatz im Vordergrund steht, eignet es sich gut dazu, einige Grundlagen zum Design von Programmiersprachen zu verdeutlichen. Wie Brainfuck ist auch Ook! Turing-vollständig, obwohl es einen sehr kleinen Syntaxumfang hat.

Sprachdesign

Die Designkriterien der Sprache sind:

  1. Eine Programmiersprache sollte schreib- und lesbar für Orang-Utans sein.
  2. Die Syntax sollte einfach sein, leicht zu merken und das Wort Monkey (engl. Affe) vermeiden.
  3. Bananen sind gut.

Augenscheinlich ist diese Programmiersprache angelehnt an die Bibliothekarsfigur aus den Scheibenweltromanen von Terry Pratchett (Vergleiche hierzu dessen Eigenschaft, jedes Wort und jeden Satz mit „Ook“ („Ugh“ im Deutschen) ausdrücken zu können und seine Empfindlichkeit, wenn er als „Monkey“ bezeichnet wird – er bevorzugt „Ape“).

Ook! hat nur drei Syntaxelemente:

  • Ook.
  • Ook?
  • Ook!

Diese werden zu Zweiergruppen (2-Tupeln) zusammengefasst. Die Ook-Tupel (Ook? Ook? wird nicht verwendet) lassen sich wie Brainfucksymbole nutzen, das ebenfalls nur acht Befehlsbezeichnungen kennt. Jedes Ook!-Programm besteht also aus einer geraden Zahl von Ooks. Zeilenumbrüche werden ignoriert.

Es gibt inzwischen Ook!-Interpreter in Ruby, Python, Perl und C# sowie einen Ook!-zu-Brainfuck- und Brainfuck-zu-Ook!-Konverter in Java, Object Pascal sowie Brainfuck und Ook! selbst.

Ook! ist formal gesehen identisch mit Brainfuck. Die Syntax der beiden Sprachen ist übereinstimmend, lediglich die Darstellung in den Symbolen unterscheidet sich. Durch die Verwendung der drei „Ook“-Symbole wird die ASCII-Darstellung von Brainfuck auf eine zweistellige ternäre Codierung umgesetzt[3]. Damit wird u. a. verdeutlicht, dass sich formale Sprachen ohne Änderung der Funktion in andere Darstellungen überführen lassen.

Vergleich der Befehlsbezeichnungen von Ook! und Brainfuck

Ook! Ook! Brainfuck Beschreibung
Ook. Ook. . . + den Wert der aktuellen Zelle um 1 erhöhen
Ook! Ook! ! ! - den Wert der aktuellen Zelle um 1 verringern
Ook. Ook? . ? > eine Zelle nach rechts gehen
Ook? Ook. ? . < eine Zelle nach links gehen
Ook! Ook? ! ? [ Schleifenanfang – die Schleife durchlaufen solange der Wert der aktuellen Zelle ungleich 0 ist
Ook? Ook! ? ! ] Schleifenende – beendet die Schleife, wenn der Wert der aktuellen Zelle gleich 0 ist
Ook! Ook. ! . . den Wert der aktuellen Zelle ausdrucken
Ook. Ook! . ! , einen Wert von der Tastatur in die aktuelle Zelle einlesen

Beispielprogramm

Dies ist ein Beispielprogramm, das in Ook! programmiert ist. Es gibt Hello World! auf der Standardausgabe aus.

Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.
Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook.
Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.

Vereinfachung

Dies ist ein Beispielprogramm, das in der vereinfachten Variante von Ook! die Standardausgabe Hello World! ausgibt.

. ? . . . . . . . . . . . . . .
. . . . ! ? ? . . . . . . . . .
. . . . . . . . . ? ! ! ? ! ? .
! . . ? . . . . . . . . . . . .
. . ! ? ? . . . . . . . . . . ?
! ! ? ! ? . . . ! . . . . . . .
. . . . . . . . ! . ! . . . . .
. . ! . . ? . ? . ? . . . . . .
. . . . . . . . . . ! ? ? . . .
. . . . . . . ? ! ! ? ! ? . ! .
. ? . ? . ? . . . . . . . . . .
. . . . . . . . . . ! ? ? . . .
. . . . . . . . . . . . . . . .
. ? ! ! ? ! ? . ! ! ! ! ! ! ! .
? . ? . ? . ? . ! . . . . . . .
! . ! ! ! ! ! ! ! ! ! ! ! ! ! .
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
! . . ? . ? . . ! .

Einzelnachweise

  1. DM's Esoteric Programming Languages
  2. Camille Paloque-Bergès: Poétique des codes sur le réseau informatique, Paris 2008, S. 73
  3. Eine dreistellige binäre Codierung von Brainfuck liegt beispielsweise der Sprache Hohoho! zugrunde, welche speziell auf die Bedürfnisse von Weihnachtsmännern zugeschnitten ist [1].

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.