esolang

Beatnik

Programs are English prose. Each word's Scrabble score is the instruction it stands for.

Cliff L. Biffle, 2001 · Turing complete: no · ●●○ moderate · esolangs.org

Tested with 3 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: H

The idea

Cliff L. Biffle made Beatnik around 2001. A program is a list of words. Add up each word's letters with Scrabble values and you get a number. That number is the command. 7 adds, 9 prints, 17 stops.

Read the story

So the hard part is not the logic. It is finding words with the right score that still read like a sentence. Most Beatnik programs end up as odd, dreamy text, which is where the name comes from.

The author says the published spec has an error and will not say where, so this implementation runs "Beatnik at face value" and takes the spec as written as correct. Values are small and there is one stack, so it is not Turing complete.

The machine

One stack of integers. Words are separated by whitespace; only letters count. Letter values: A E I L N O R S T U 1, D G 2, B C M P 3, F H V W Y 4, K 5, J X 8, Q Z 10.

ScoreDoes
5Push the next word's score
6Pop and discard
7Pop two, push their sum
8Read a byte and push it (-1 at end)
9Pop and print as a character
10Pop two, push second minus first
11Swap the top two
12Duplicate the top
13, 14Pop; if zero (13) or not zero (14), skip n words past the next word, whose score is n
15, 16Pop; if zero (15) or not zero (16), go back n words from the next word
17Stop

Any other score does nothing. Popping an empty stack gives 0. A jump back past the start lands on the first word.

Example

Hello scores 8 and reads A.

Hello scores 8 and reads A. aunts scores 5, so it pushes the score of Around, which is 7. The second around scores 7 and adds. swim scores 9 and prints 65 + 7, the letter H.

Patterns it teaches

Try this

  1. Find a word that scores 5 and one that scores 9, and write a program that prints ! (33).
  2. Read a character and print it twice.
  3. Hard: print Hi with a sentence a person could say out loud.

Further

Pseudonatural

Stack-based

Write your own in Run Convert a program from Beatnik

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: beatnik.

Command line

shib run beatnik -e 'Hello, aunts! Around, around, swim!' --input 'A'
shib manual beatnik

Source

Module
langs/stack/ports.js
Interpreter
langs/stack/beatnik.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org