X hits on this document

PDF document

1. INTRODUCTION - page 7 / 10

30 views

0 shares

0 downloads

0 comments

7 / 10

] Jump back to the command after the corresponding [ if pointing to a non-zero value. A Brainfuck “hello, world” program follows:

++++++++++[>+++++++>++++++++++>+++>+<<<<>++.>+.++ +++++..+++.>++.<<+++++++++++++++.>.+++.------.---

  • -----

    .>+.>.

Minimalist languages also comment on computer architectures as well the nature of computation, and can have the flavor of a minimal assembly language. The language OISC explicitly parodies assembly language, for example. OISC stands for the “One Instruction Set Computer”, referencing the standard acronyms RISC (Reduced Instruction Set Computer) and CISC (Complex Instruction Set Computer). OISC consists of a single instruction, subtract-and-branch-unless-positive. subleq(a, b, c) subtracts the contents of memory location a from the contents of memory location b, stores the result in b, and, if the result of the subtraction was 0 or negative, jumps to the address stored in memory location c. Assembly languages commonly contain separate arithmetic operations (add and subtract), as well as various branch operations that test a memory location and branch if the memory location is, for example, positive, or negative, or zero. OISC parodies assembly by combining an arithmetic and branch operation into a single instruction and providing that to the programmer as the only instruction.

9. STRUCTURED PLAY: SHAKESPEARE

Some weird languages encourage double coding by structuring the play within the language such that valid programs can also be read as a literary artifact. As was previously described, double-coding is certainly possible in languages such as C and Perl, and in fact is an important skill in the practice of obfuscated programming. But where C and Perl leave the space of play relatively unstructured, forcing the programmer to shoulder the burden of establishing a double coding, structured play languages, through their choice of keywords and their treatment of programmer defined names (e.g. variable names), support double coding within a specific genre of human-

readable textual production. The exemplifies this structured play aspect.

language

Shakespeare

Here is a fragment of a Shakespeare program that reads input and prints it out in reverse order:

[Enter Othello and Lady Macbeth]

Othello: You are nothing!

Scene II: Pushing to the very end.

Lady Macbeth: Open your mind! Remember yourself.

Othello: You are as hard as the sum of yourself and a stone wall. Am I as horrid as a flirt-gill?

Lady Macbeth: If not, let us return to scene II. Recall your imminent death!

Othello:

You are as small as the difference between yourself and a hair!

Shakespeare structures the play of the language so as to double-code all programs as stage plays, specifically, as spoofs on Shakespearean plays. This is done primarily by structuring the play (that is, the free space) that standard languages provide in the naming of variables and constants. In standard languages, variable names are a free choice left to the programmer, while numeric constants (e.g. 1) are either specified by the textual representation of the number, or through a name the programmer has given to select constants. In contrast, Shakespeare Dramatis Personae (variables) must be the name of a character from some Shakespeare play, while constants are represented by nouns. The two fundamental constants in Shakespeare are -1 and 1. The dictionary of nouns recognized by the Shakespeare compiler have been divided into positive, negative, and neutral nouns. All positive (e.g. “lord”, “angel”, “joy”) and neutral (e.g. “brother”, “cow”, “hair”) nouns have the value 1. All negative nouns (e.g. “bastard”, “beggar”, “codpiece”) have the value -1.3 Constants other than -1 and 1 are created by prefixing them with adjectives; each adjective multiplies the value by 2. So sorry little codpiece denotes the number -4.

The overall structure of Shakespeare follows that of a stageplay. Variables are declared in the Dramatis Personae section. Named acts and scenes become labeled locations for jumps; let us return to scene II is an example of a jump to a labeled location. Enter and exit (and exeunt) are used to declare which characters (variables) are active in a given scene; only two characters may be on stage at a time. Statements are accomplished through dialog. By talking to each other, characters set the values of their dialog partner and themselves, compare values, execute jumps, and so forth. Conditional jumps are accomplished by one character posing a true or false question, and the second character describing what action to take based on the truth value. Such a jump appears in the previous code sample, where Othello asks Lady Macbeth Am I as horrid as a flirt-gill? (is the value of the variable Othello equal to -1), and Lady Macbeth responds If not, let us return to scene II.

In a programming language, keywords are words that have special meaning for the language, indicating commands or constructs, and thus can’t be used as names by the programmer. An example from C is the keyword for used to perform iteration; for can not be used by the programmer as the name of a variable or function. In standard languages, keywords typically limit or bound play, as the keywords are generally not selected by language designers to facilitate double-coding. This is, in fact, what makes code poetry challenging; the code poet must hijack the language keywords in the service of a double- coding. In contrast, weird languages that structure play provide keywords to facilitate the double-coding that is generally encouraged by the language. Shakespeare keywords maintain a

stylistic

consistency

with

a

melodramatic

spoof

of

Shakespearean plays. Output is accomplished via Open

heart (output

(output value as number) and value as character), input by

Speak your Listen to

your mind your

heart (input value as number) value as character). A number

and of

Open your mind (input comparative synonyms are

3Interestingly, “Microsoft” is in the negative noun list.

Document info
Document views30
Page views30
Page last viewedWed Dec 07 16:47:10 UTC 2016
Pages10
Paragraphs273
Words9932

Comments