Beatnik is a very simple language to learn: it has a small set of commands, a very relaxed
syntax, and you can find a reference to its vocabulary at any toy store.
A Beatnik program consists of any sequence of English words, separated by any sort of punctuation from spaces to hyphens to blank pages. Thus, "Hello, aunts! Swim around brains!" is a valid Beatnik program, despite not making much sense.
(If you're wondering, that reads a character from the user, adds seven to it [i.e. A -> H], and prints it out.)
The function of a particular word--say, brains, or aunts--is determined by the score one would receive for playing that word in Scrabble. Thus, "hello" gets us 8 points, and so on.
Before we explain how the scores are matched up to the functions, there are a couple things you must know.
|<5||Does nothing. The Beatnik Interpreter may mock you for your poor scoring, at its discretion. Low scoring words such as "I" or "of" are probably not good words to program with immediately after stealing all of the interpreter's cigarettes and stomping on its beret.|
|5||Finds the score of the next word and pushes it onto the stack. Skips the aforementioned next word.|
|6||Pops the top number off the stack and discards it.|
|7||Adds the top two values on the stack together (as described above)|
|8||Input a character from the user and push its value on the stack. Waits for a keypress.|
|9||Pop a number off the stack and output the corresponding ASCII character to the screen.|
|10||Subtract the top value on the stack from the next value on the stack, pushing the result.|
|11||Swap the top two values on the stack.|
|12||Duplicate the top value.|
|13||Pop a number from the stack, and figure out the score of the next word. If the number from the stack is zero, skip ahead by n words, where n is the score of the next word. (The skipping is actually n+1 words, because the word scored to give us n is also skipped.)|
|14||Same as above, except skip if the value on the stack isn't zero.|
|15||Skip back n words, if the value on the stack is zero.|
|16||Skip back if it's not zero.|
|17||Stop the program.|
|18-23||Does nothing. However, the score is high enough that the Beatnik Interpreter will not mock you, unless it's had a really bad day.|
|>23||Garners "Beatnik applause" for the programmer. This generally consists of reserved finger-snapping.|
By this point, you're probably wondering why it's called Beatnik. Well, you're about to find out. Here is the source for a program that simply prints "Hi" to the screen.
Baa, badassed areas!
queasy nude adverbs!
Dare address abase adder? *bares baser dadas* HA!
Equalize, add bezique, bra emblaze.
He (quezal), aeons liable. Label lilac "bulla," ocean sauce!
duodena sounded amends.