esolang

OLNMLN

One line, no more lines needed. A pointer rolls to the right, and only a jump sends it back.

Grs · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 30 known programs · Test method

Run it

Expected: Hello World!

The idea

OLNMLN stands for OneLineNoMoreLinesNeeded, and Grs first called it OneLine. A whole program is one line. A pointer starts on the leftmost character and rolls to the right like a ball down a hill. Each character it lands on is a command, and a few commands take the characters after them as their data.

Read the story

There is no loop command. A capital letter sends the pointer to just after the first other copy of the same letter in the program. Two As make a jump, and a jump back to the left makes a loop. Data lives on a stack of strings and floats and in one variable.

The machine

CommandDoes
ˇxPush the character x; ˇ{ is a line feed and ˇ} a tab
p1234Push the next four characters as a float
^ r c iPrint the top; drop it; duplicate it; reverse the stack
+ - * / %Pop a and then b, push a+b, a-b, a*b, a/b or a%b
dPop; skip the next character if the value is above 0 or not a number
=Pop two; skip the next character if they are equal
j0006 nMove the pointer by the next four characters, or by a popped value
wPrint the next eight characters
A to ZGo to just after the first other copy of this letter
# @ &Pop into the variable; push it; print it
. , :Add 1 to the variable; take 1 away; add a popped value
> $ ?Push a line of input; the same as a float when it is all digits; push its characters
} )Turn the top into a float; into a string
sStop

Every number is a float and prints the way Python prints it, so 2 prints as 2.0. Every other character is passed over, and the program also stops past its last character.

Example

The first Hello World leans on w, which prints the eight characters after it.

The first Hello World leans on w, which prints the eight characters after it. That is why the second w sits inside the word World. The second one pushes the letters backwards and prints them off the top.

Expected: Hello World!

The truth machine. $ reads 0 as a float, d pops it and skips nothing, and the first A sends the pointer past the second A, where it prints 0 and stops. On 1 the d skips that A, the B jump runs instead and the two Cs loop, printing 1 forever.

Expected: 0

The cat reads a line, prints it with a line feed and jumps back to the first A. The j0006 at the start steps over that A the first time. The program ends when the input does.

Expected: cat

The Deadfish interpreter keeps the accumulator in the variable. It tests each command with = and a pair of letters, and the other four Zs lead back to the one after j0007. On iisiso it counts 1, 2, 4, 5 and 25 and prints 25.0.

Expected: 25.0

In the FizzBuzz and 99 bottles of beer programs, FizzBuzz never stops, and the bottles end at 0.0.

Patterns it teaches

  • Stack machines: a stack of strings and floats, with one variable beside it.

Further

Also in Functional and concatenative

Write your own in Run Convert a program from OLNMLN

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run olnmln -e 'ˇA^'
shib manual olnmln

Source

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

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

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