esolang

Cool Cell

30,000 byte cells and jumps to labels, but no way to print a cell. It prints only what is written in the program.

ChuckEsoteric08 · Turing complete: with unbounded memory · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello, World!

The idea

ChuckEsoteric08 made Cool Cell as a Turing machine that would compile to Quests. It turned into brainfuck with a fixed memory. A program is a row of commands split by ;, each one a letter with its argument written right after it.

Read the story

The only output commands, t and h, print their own argument. So a program reads a number, puts its digits in cells, tests the cells and picks which text to print.

The machine

There are 30,000 cells of one byte, counted from 1. The pointer starts at cell 1.

CommandDoes
sXPoint at cell X
rXPoint at the cell whose number cell X holds
iX dXAdd X to the cell, or take X from it
pXWrite each digit of the input number into the cells from X on
aXDeclare the label X
gXJump to label X
zX oXJump to X if the cell is 0, or if it is not
fDtXJump to X if the cell holds the digit D
tXPrint X
hXPrint X and halt
#A comment

A cell does not wrap one step at a time. The whole change is made first, and a result above 255 becomes 0 while a result below 0 becomes 255. So i288 leaves 0, not 32, and d123 leaves 255.

Example

The truth machine writes the first digit of the input into cell 1.
Expected: 0

The truth machine writes the first digit of the input into cell 1. On 1 it jumps to loop and prints 1 forever. On 0 it goes on to h0, which prints 0 and halts. The second version tests the digit first and prints Error! for anything but 0 or 1.

Expected: Error!

d123 sets the cell to 255 and i1 takes it past 255, so it becomes 0 and z0 jumps.

Expected: 0

Further

Cell-based

Write your own in Run Convert a program from Cool Cell

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: cool-cell.

Command line

shib run cool-cell -e 'tHello, World!;'
shib manual cool-cell

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/cool-cell.js

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

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