esolang

':]'

One variable, and a face for everything you can do to it.

Cinnamony · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: hello world

The idea

Cinnamony made :], a language written almost only in smileys. There is one variable, and each smiley does one thing to it or with it. :D makes it bigger, D: makes it smaller, ): sets it to 0 and :( ends the script. Strings go in curly quotes, and a statement takes one line.

Read the story

The same smiley means different things by its place. :) alone empties the variable, :0 :) says it, and :) :| fills it from the keyboard.

The machine

StatementDoes
:0 xSay x, a string, a number or the variable :)
:0 :|Read a line and say it
:)Set the variable to blank
:) xSet the variable to x
:) :|Set the variable to a line of input
:|Read a line
:D D: ):Add 1, take 1, set to 0
:(End the script
:]] n ... :[[Repeat n times
:]] :) == i ... :[[Repeat until the variable is i
>:0A comment to the end of the line

A loop tests before each round, and <, >, <= and >= work like ==. Input that is a whole number becomes a number.

Example

The truth machine.

The truth machine. On 0 the loop never runs and the last line says 0. On 1 it says 1 forever.

Expected: 0

The looping counter counts to 15. It counts to 4, and each round says as many stars as the counter, then a line feed written as a string that spans two lines.

Expected: * ** ***

Patterns it teaches

Further

Also in Camouflage

Write your own in Run Convert a program from ':]'

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: robotic-smiley-face.

Command line

shib run robotic-smiley-face -e ':0 :|
:(' --input 'cat'
shib manual robotic-smiley-face

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/robotic-smiley-face.js

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

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