Me wearing ridiculous goggles

Beatnik

Preface FROM THE FUTURE! (2013)

Beatnik is a direct result of the flu-like symptoms and subsequent cognitive impairment that come with truly, deeply understanding Forth. Like Forth, it is a stack language that is syntax-free — or, thematically, "syntax is just, like, your opinion, man!"

Like all of my esoteric languages written in the cold, dark winter of 2000, the Beatnik specification and example (posted verbatim below) contain an error to detect people trying to implement it. This is arguably rather rude. If you lost hours of your life frantically debugging your Beatnik implementation, trying to figure out why it doesn’t match the posted spec, then (1) I apologize and (2) I am impressed by your inexplicable dedication to absurdity.

There is also a more subtle error: as a teenage American, I had only encountered a single set of Scrabble tiles with a single scoring system. Thus, Beatnik failed to even specify which Scrabble scoring system should be used. Many language libraries have locale-sensitivity issues; Beatnik may be one of the only languages whose semantics are locale-sensitive.


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.

  • When Beatnik does arithmetic, it does it on a stack. For those of you who don’t spend as much time doing this stuff as I do, a stack is very simple: you can push things onto the top of it, or take things off the top of it (in order, from top to bottom), and that’s it. So, if you push 2 and 3, and then do an “add”, 2 and 3 are “popped”, added into 5, and then 5 is “pushed.”
  • The numbers Beatnik deals with can range from 0 to 255.
Score Function
<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!
Jarheads' arses
      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!
Ends, addends,
   duodena sounded amends.

See?

More Cliffle

By Topic