From Esolang
Jump to navigation Jump to search

Beatnik is a stack-based esoteric programming language created by Cliff L. Biffle. The code looks like English-language text (typically with sentences that don't make a lot of sense). The words are scored according to the rules of the Scrabble board game, and the score is used to determine the operation.


5 Push the next word's value onto the stack.
6 Pop a number from the stack and discard it.
7 Pop two numbers, add them, and push the result.
8 Input a character and push its value.
9 Pop a number and output it as a character.
10 Pop two numbers, subtract the first one popped from the second one popped, and push the result.
11 Pop two numbers, swap them, and push them back.
12 Pop a number and push it twice.
13 Pop a number and skip ahead n (actually n+1) words if the number is zero.
14 Pop a number and skip ahead n (actually n+1) words if the number isn't zero.
15 Pop a number and skip back n words if the number is zero.
16 Pop a number and skip back n words if the number isn't zero.
17 Stop the program.

Any other Scrabble value, interpreted as a command, is a no-op. Note that the commands corresponding to values 5, 13, 14, 15, and 16 each read an extra word and use it as a parameter (then skip it). A value of less than 5 might make the interpreter mock you for your poor Scrabble skills. A value greater than 23 will earn you "Beatnik applause".

Beatnik does not restrict the vocabulary to Scrabble-valid words, so proper nouns, misspelled words, and phonies are allowed as valid code. Very long or large-value words are sometimes useful to push a large number to the stack (opcode 5), especially for printing strings. Long words may also be used for comedic effect.

  • Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch: Value 110, ASCII value of n, useful for getting to other lowercase letters.
  • pneumonoultramicroscopicsilicovolcanoconiosis: Value 68, ASCII value of D, useful for getting to other uppercase letters.
  • floccinaucinihilipilification: Value 48, ASCII value of 0.
  • jazzier: Value 32, ASCII value of space

Computational class

Since there is only a single stack for data items, and since data items are finite (integers from 0 to 255), and since it is not possible to access values from arbitrarily deep in the stack, Beatnik is not Turing-complete, but it ought to be able to simulate any deterministic Push-down automaton.


The author claims there is an error in the published specification and example program, but does not divulge where this error is. This means the Beatnik language is effectively ill-defined -- the error could be, for example, that the language exists at all -- and effectively unimplementable. Chris Pressey proposes using (when it is not clear from context) the term Beatnik at face value to refer to the language where the specification, as published, is considered correct (and the published example programs are considered incorrect.)

Example programs

These are given in Beatnik at face value.

Rudimentary example

Hello, aunts! Around, around, swim!

Input a character, take its ASCII value, add 7 to it, and output the corresponding ASCII character. For example, if the input character is A, the output character will be H.

Hello, world

See Hello world program in esoteric languages#Beatnik

Alphabet program

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

Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch?! Ha!

Monarchies spoil; language intermediates everyone!

This program iterates from 32 to 127 (open on the right) and prints the character at that index. Thus, it displays the "printable" subset of the ASCII table, from 0x20 (space) to 0x7E (~).

Infinite loop

The simplest construction of an infinite loop in Beatnik (at face value) involves pushing any value (the positivity of which is guaranteed by the language's semantics) and then jumping backward four instructions. The following whimsical example is humorously self-referential:

Ha, an interminable line!

Truth machine

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

This program implements a Truth-machine. If the character inputted is 0, it outputs 0 and terminates, but if the character inputted is 1, it outputs 1 infinitely (warning: this behavior will crash some interpreters).

Scrabble letter values

 1: A   E   I  L NO  RSTU
 2:    D  G
 3:  BC         M  P
 4:      F H             VW Y
 5:           K
 8:          J             X
10:                 Q        Z

External resources