esolang

Emoji-gramming

Four faces for four commands, the zodiac and the clock for variables, and hearts for numbers.

2017 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 3 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: A

The idea

Emoji-gramming, whose proper name is 💻, appeared on esolangs.org in 2017. It is a small register machine written entirely in emoji. Each line is one command followed by two operands.

Read the story

There are 24 variables, the twelve signs of the zodiac, ♈ to ♓, and the twelve clock faces, 🕐 to 🕛. The only numbers are five hearts, the powers of two from 1 to 8 and a broken heart for 0. Everything else is built by adding.

The 25th variable is 🚨, the line counter. It can be read and written like any other, and writing it is how a program jumps.

The machine

LineDoes
😊XYSet X to Y
😇XYAdd Y to X
😈XYSubtract Y from X
😵XYIf X equals Y, skip the next line
😊📢YPrint the character with code Y
😊X🎤Read a character into X
Constant💔💜💕💞💖
Value01248

The counter starts at 0 and grows by 1 before every line, so the first line is line 1. A line that does not begin with a command is a comment, but it still has a number. Setting 🚨 to 8 makes line 9 the next one. The program ends when the counter runs past the last line.

The Python interpreter reads a whole line of input for 🎤 and keeps only its first character. The specification calls that a bug; this implementation keeps it, as Try It Online runs that interpreter.

Example

The first program adds eight 8s and a 1 to make 65 and prints A.
Expected: 321

The first program adds eight 8s and a 1 to make 65 and prints A. The second counts down. Lines 1 to 7 put 3 in ♈ and 48, the code of 0, in ♉. Line 8 is a comment that marks the loop. Lines 9 to 11 print the digit 48 + ♈; line 12 takes one away. Line 13 skips line 14 once ♈ is 0, and line 14 sets the counter to 8, so line 9 comes next.

Patterns it teaches

  • Counter machines: unbounded variables, adding, subtracting and a test for equality.
  • Turing completeness: a writable line counter is a goto, and with unbounded integers that is enough.

Further

Also in Turing tarpits

Write your own in Run Convert a program from Emoji-gramming

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run emoji-gramming -e '😊♈💜
😇♈💕
😊♉💖
😇♉♉
😇♉♉
😇♉💖
😇♉💖
loop
😊♊♉
😇♊♈
😊📢♊
😈♈💜
😵♈💔
😊🚨💖'
shib manual emoji-gramming

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/emoji-gramming.js

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

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