Are you tired of regular old programming languages? Do you ever wish there was something less code-y to code in? Haven't you ever wanted to talk like a beatnik?

Well, then Beatnik is the esolang for you!

For those who don't know what an esolang (or "esoteric programming language") is, it is "a computer programming language designed to experiment with weird ideas, to be hard to program in, or as a joke, rather than for practical use."

Beatnik is one example of an esolang, created by Cliff L. Biffle sometime near 2001 (the exact year is unknown). It's especially nice in my opinion, because most of you already know how to write valid Beatnik code, and a reference to its full vocabulary can be found at any toy store. Allow me to explain...

How it works: Beatnik code takes the form of English words. For example, "Hello, aunts! Around, around, swim!" is a valid Beatnik program, despite not making much sense. (What that does, if you're curious, is it reads a character from the user, adds 7 to it [i.e. A -> H], and prints it out.) The function of a word (for example, "aunts" or "swim") is determined by the score one would receive by playing that word in English Scrabble (for example, "Hello" is 8 points, which would turn into INPUT, etc).

Beatnik is a stack based language. For those unfamiliar, a stack is very simple. You can put things on top, or "push", and take things off (in order from top to bottom), or "pop", and that's it. So, if you push 2 and 3, and do an "add" instruction, 2 and 3 are "popped", added into 5, and then the result it "pushed".

The numbers Beatnik deals with range from 0 to 255. The values wrap around, i.e. 0-1=255, and 255+1=0.

Full instruction list, as from the official specification:
    <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 now, you may be wondering, why is it called Beatnik? Well, you're about to find out. Here is the source for a program that simply prints all printable ASCII characters.

Code:
Ho humbuzz, Dionysus. | orgasm if I feel altruistic & alone...

Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch?! Ha!

Monarchies spoil; language intermediates everyone!

See?

Now, for my interpreter. I made it in TI-BASIC as a little fun project, using this interpreter for reference. Some information about it:

    When you run the program, you are asked to input a Beatnik program. You can use capital and lowercase letters, as well as (meaningless) punctuation. Words are delimited by spaces, so make absolutely sure at least one space is in between words!

    After input, the code is "compiled" (i.e. evaluating the scores according to Scrabble rules, which will be interpreted as instructions by the interpreter. You can press MODE to quit compiling. When it's done compiling, press ENTER.

    At any point during execution, you may press MODE to terminate the program early. Once the program terminates on its own, it will say "Done" on the bottom, and you can press ENTER to quit out of the interpreter.

    Input is handled by using the 8th line. It shows a "?" on the 8th line. Press the number keys to type a number (the printable-ASCII equivalent, if applicable, is shown to the right), press LEFT or DEL to backspace, and press ENTER to input it. You are not allowed to input anything less than 0 or greater than 255 (try it, seriously).

    Output is handled by printing the ASCII character that corresponds to the number popped. If a printable ASCII character is "output", it displays on the top in a kinda-typewriter-like format. If ASCII codes 10 or 13 are "output", it brings the line down. Otherwise, nothing is output.

    The only problem you might run into is conditional jumping through scores of 13-16, with how I interpreted the jumping. I interpreted the jump forward as "increase the instruction pointer by n+1 if jumping, else increase by 2" and the jump backward as "decrease the instruction pointer by n if jumping, else increase by 2". This definition is used by the online interpreter which I used as reference; however, some select Beatnik programs may have trouble with this.


Screenie of the Beatnik interpreter running "Hello, aunts! Around, around, swim!":


Other example programs:

Truth machine (made by me):

Code:
Truth beyond frontiers remains, but amazingly, falsities stay constant, existing greater.


Print "I LOVE YOU" (made by me, in a way that flows like a story):

Code:
He arrived.
 
He arrived at my door extremely late one day.
 
If you only did uninteresting, idle things in your life, always acting as if nothing he does will change your opinion ... can go well.
 
But one awful dilemma I face, is that growing emotion ruins my serious, careful way of thinking. If a love flame is forced and futile, why bother kindling another one?
 
Yet, you think, it might not be a bad idea. Relationships always work out, and this can be an escape from a tense, complex life. Unmarried at home, lost in a loud, irregular reality ... maybe sometime, just maybe, it's time I found the one.
 
If he's a guy who is faithful, kind, and will be mine joyously to the end, I will prove to him I shall cherish and treasure him just as much. But how do I say it? I can't place the words...
 
"You absolutely need to know", I say, nervously, "that I...I...I..."


The download for the interpreter is right here. Go ahead, and tell me what you think!
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement