esolang

Slam

A program is a slam poem. Each line means the product of the lengths of its words.

ArthroStar11, 2021 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: HI

The idea

ArthroStar11 made Slam in 2021 so that programs read like slam poetry, in the spirit of Beatnik and Length. Only word lengths count, punctuation included. Hey you be! is 3 times 3 times 3, which is 27, the command that prints a character. Arguments are lines too, so Lovely!! greetings stands for 8 times 9, the code of H. Every opcode is a composite number, so it can be written with more than one word. Each stanza is a subroutine, and the first stanza is the main program.

The machine

NumberDoes
4 nCall stanza n
6Return
8, 9Loop start and end, while the boolean is true
10, 12, 14 a bBoolean = variable a =, >, < variable b
15Invert the boolean
16, 18, 20, 21, 22 a bHold = a + b, a − b, a × b, a / b, a % b
24, 25Read a number or a character into hold
26, 27Print hold as a number or a character
28 n, 30 nStore hold in variable n, load variable n
32 nHold = n

Example

The poem is 32 72, 27, 28 4, 32 1, 28 5, 16 4 5, 27.

The poem is 32 72, 27, 28 4, 32 1, 28 5, 16 4 5, 27. It prints 72, keeps it in variable 4, keeps 1 in variable 5, and prints their sum, 73.

Further

Ideas it shows

Pseudonatural

Write your own in Run Convert a program from Slam

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run slam -e 'Oh to be nice
Lovely!! greetings
Hey you be!
Beloved is me
Hark
Love blindly!
I
Hate noone!!
Hark!
To be nice
Hark
Hark!
How you are'
shib manual slam

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/slam.js

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

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