esolang

2.+-

Deadfish under four new names, printing letters instead of numbers, with a fifth command to bring the old names back.

2018 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello world

The idea

2.+- is a variation of Deadfish from 2018. It keeps the one accumulator and the four commands, but names them 2, ., + and -, after what they do. The one real change is the output. Where Deadfish prints the accumulator as a number, . prints the character with that code, so a program can write words.

Read the story

The fifth command, =, gives a command another name. s=2o=.i=+d=- brings back Deadfish's letters, and after it any Deadfish program runs, printing characters.

The machine

CommandDoes
2Square the accumulator
+ -Add 1, take 1 away
.Print the accumulator as a character
x=yLet x stand for the command y

As in Deadfish, an accumulator of -1 or 256 becomes 0 after every command. The specification leaves that open, and 2.+- follows Deadfish. There are no loops and no input, so a program runs straight through once.

Example

The Hello world reaches 72 as 2 squared plus 4, squared, plus 8.

The Hello world reaches 72 as 2 squared plus 4, squared, plus 8. It then walks up and down to each next letter, 79 steps down from o to the space. The w comes from going down to 11, squaring to 121 and taking 2 away.

The same text comes from Deadfish's own Hello world, behind the four new names.

Expected: Hello world

Further

Also in Jokes

Write your own in Run Convert a program from 2.+-

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run 2 -e '++2++++2++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------------------.---------------------2--.--------.+++.------.--------.'
shib manual 2

Source

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

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

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