Beatnik (programming language)
Beatnik is a simple esoteric programming language, based on a stack. A beatnik program consists of any sequence of English words. Each word is assigned the score you would get for it in a Scrabble game. The value of the score determines what function is performed. Functions include pushing the score of the next word onto the stack, testing the stack and skipping forward or backward in the program and other stack operations.
A 'Hello World' example in 'Beatnik' language. Note: this actually prints "Hi" instead of "Hello, world".
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.
For the technically minded, here is a somewhat formal description of the language. The language is simple enough for a description to fit on a single page.
The interpreter reads the words in the poem, ignoring punctuation and whitespace/newlines. Some functions are one word, other functions have an argument (they are 'two-word functions'). Two-word functions are described below in the form "5,n". This means both the word whose value is 5 and the next word (whose value is 'n') are read.
Word Value | Pseudo-code |
<5 | NOOP. (Optional: Interpreter may mock you) |
5,n | push(n) |
6 | pop() |
7 | push(pop()+pop()) |
8 | push(input()) |
9 | print(pop()) |
10 | push(pop()-pop()) |
11 | a = pop(); b = pop(); push(a); push(b) |
12 | a = pop(); push(a); push(a) |
13,n | if(top()==0) jump(+n) |
14,n | if(top()!=0) jump(+n) |
15,n | if(top()==0) jump(-n) |
16,n | if(top()!=0) jump(-n) |
17 | exit() |
18-23 | NOOP (Optional: may mock you, but only if it has had a bad day) |
>23 | Generate "Beatnik applause" |
Pseudo-code | Meaning |
NOOP | Do nothing |
pop() | remove the value off the top of the stack, and return it |
push(x) | place x on the stack |
print(x) | print the character x |
input() | read a character from the user. Blocks until character is read. |
; | separates multiple statements. They are run in order. |
if(expression) statement | if and only if the expression is true, execute the statement |
jump(x) | move the reading location forward or backwards by x words. |
Here are the scrabble letter values, for reference.
External links
[[Category:Minor esoteric programming languages]] {{compu-lang-stub}} [[de:Beatnik (Programmiersprache)]]