esolang

EmojiCoder

Every number is written in moons, a new moon for 0, a full moon for 1.

Sarah Nathanson and Jeremey, 2015 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 5 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: 42

The idea

Sarah Nathanson and Jeremey made EmojiCoder at HackRPI 2015. Each line is one command, written as an emoji, then a modifier saying whether the argument is a character or a number, then the argument in binary. 🌚 is a 0 and 🌝 is a 1, so 🌚🌝🌚🌚🌚🌚🌚🌝 is 65, or A.

Read the story

The machine is small. It has an accumulator for arithmetic, a second register x, a stack and a string builder. There are no jumps. Control flow is a comparison that skips the next line and a command that repeats the next line a fixed number of times, so every program ends, which esolangs.org records by calling it total.

The machine

CodeDoes
👋Print the argument (🔡 as a character, 🔢 as a number)
📦 ➕ ➖ ✖Set, add to, subtract from, multiply the accumulator
📫 📪 📝Print the accumulator, print x, print a newline
👇 👆 🔻 🔺Push the argument, pop, push the accumulator, load it from the top
🎒 🚥 🚦 🔹 🔸Set x; push it; load it from the top; copy between x and the accumulator
➕✖ ➖✖ ✖✖Add, subtract, multiply by x
🔛Compare x with the accumulator (0 <, 1 =, 2 >); if false skip the next line
🔁Run the next line as many times as the argument
📧 📥 📤 📨Set, extend, shorten and print the string builder

This implementation leaves out ✋, which prints the top of the stack, division and the two random commands, because the specification does not say how they print or round.

Example

The first sets the accumulator to 7, multiplies it by 6 and prints it.
Expected: ***

The first sets the accumulator to 7, multiplies it by 6 and prints it. The second repeats the line after it three times, and that line prints 42, which is *.

Patterns it teaches

Further

Stack-based

Write your own in Run Convert a program from EmojiCoder

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run emojicoder -e '🔁🔢🌚🌚🌚🌚🌚🌚🌝🌝
👋🔡🌚🌚🌝🌚🌝🌚🌝🌚'
shib manual emojicoder

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/emojicoder.js

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

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