esolang

Lenta

Befunge's grid on top of brainfuck's tape, with one buffer in between.

Milcho, 2011 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello World!

The idea

Milcho made Lenta in 2011. The program is a grid that the pointer crosses as in Befunge, turned by the mirrors / and \. The data is a tape of cells as in brainfuck. Between them sits the buffer, and nearly every command works through it. An operator takes the current cell and the buffer and leaves its result in the buffer, : writes the buffer into the cell, and ; reads it back.

Read the story

The specification calls itself version 0.11 and a work in progress, and says its examples had not been tested. Its link to an interpreter in Python carries one test, the Fibonacci program on the input 5. This implementation follows that interpreter.

The machine

CommandDoes
$Start here, moving right
+ - * _ %Cell plus, minus, times, floor-divided by, mod the buffer, into the buffer
< > =1 if the cell is less than, greater than, equal to the buffer
& | !And, or of the cell and the buffer; not the buffer
0Clear the buffer
[ ]Move one cell left or right
{ }Move as many cells as the buffer says
: ; ~Buffer into the cell, cell into the buffer, swap them
@Put the index of the cell in the buffer
/ \Mirrors
' ,Print the buffer as a character, as a number
.Read a number or a character
"Put the code of the next character in the buffer and step over it
?Skip the next command if the buffer is 0 or less
#Halt

True means 1 or more. Every other character, the space too, is passed over. A line of digits in the input is read as one number; any other line gives its characters one at a time.

Example

Hello World quotes each letter with " and prints it with '.

Hello World quotes each letter with " and prints it with '. The second l needs no quote, since the buffer still holds the first.

The addition reads two numbers, prints their sum and loops back along the second row until both numbers are 0. The sums come out with nothing between them, so 2 and 3 and then 0 and 0 print 50. The first ? skips the / on the way in, so only the way back turns there.

Expected: 50

The Fibonacci program reads N and prints the first N numbers of the sequence, each with a comma.

Expected: 0,1,1,2,3,5,8,

Patterns it teaches

Further

Two-dimensional languages

Cell-based

Write your own in Run Convert a program from Lenta

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run lenta -e '$ "H'\''"e'\''"l'\'' '\''"o'\''" '\''"W'\''"o'\''"r'\''"l'\''"d'\''"!'\'' #'
shib manual lenta

Source

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

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

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