esolang

Emoji

A stack language where every command is an emoji: πŸ’¬ quotes a string and ➑ prints it.

2015 Β· Turing complete: unknown Β· ●●○ moderate Β· esolangs.org

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

Run it

Expected: Hello, World!

The idea

Emoji dates from 2015. Its commands are single emoji, and almost everything else in a program is ignored. The values on the stack are Python's own, because the interpreter TIO runs, emoji.py, is a small Python program that hands the work to Python: strings, whole numbers, floats, booleans and lists.

Read the story

Code is data. β›½ … 🚘 pushes a piece of program as a string, πŸƒ runs it, and πŸ”ƒ is a while loop built from two such strings, a condition and a body.

The machine

CodeDoes
πŸ’¬textπŸ’¬Push a string
β›½code🚘Push code as a string; they nest
➑Print, with a newline
πŸ”’ πŸ“₯ πŸ’Ώ πŸ“€String to float, int(), round, round up
πŸ‘« 🌊 πŸ‘ͺ 🍴 πŸ’ΈAdd, subtract, multiply, divide, modulo
πŸ‘¬ 🐣 πŸ”Equal, less, greater
🚲 🚳 🚴True, false, not
πŸ”š … 🐧If: skip to the matching 🐧 when false
πŸ”™ … 🐧Else
πŸ”ƒLoop: pop a body and a condition, run while the condition is true
πŸƒRun a string as code
πŸ‘₯ πŸ”€Duplicate, swap
πŸ”£ πŸ” πŸ‚Character to code, code to character, number to hex
πŸ“² πŸ“±Store a value under a name, read it back
πŸ“ƒ βœ‚ πŸ”‘Length, substring, index
πŸ“š πŸ“ŒNew list, append
πŸ”Š πŸ”‰Upper case, lower case

πŸ‘« joins as text when either side is a string, and 🍴 always gives a float. Numbers typed as strings need πŸ”’, which gives a float; πŸ“₯ turns that into a whole number.

This implementation follows emoji.py at github.com/vpzomtrrfrt/emoji.py. TIO passes arguments that start on the stack as strings; in this implementation each line of input is one. Python's % formatting of strings is left out, and an error ends the run without the state dump the reference prints.

Example

The second multiplies two floats, so Python prints 42.0.
Expected: 42.0
Expected: 3 2 1

The second multiplies two floats, so Python prints 42.0. The third is a countdown: the condition prints the number, takes one off and leaves a copy to test; the body is empty.

Patterns it teaches

Further

Also in Camouflage

Write your own in Run Convert a program from Emoji

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run emoji -e 'πŸ”’πŸ’¬1πŸ’¬πŸ”’πŸ‘«βž‘' --input '41
'
shib manual emoji

Source

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

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

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