esolang

Mash

One to three symbols at the start of a line, and the only loop is forever.

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

Tested with 3 known programs · Test method

Run it

Expected: Hello World

The idea

Twingamerdudes made Mash in C# in one or two weeks. Each line starts with a command of one to three symbols. Variables live by index. _Name makes a variable and +_ hands out a value, and the nth value goes to the nth variable made. A value cannot be changed once given, except by the arithmetic commands.

Read the story

There is no loop that stops. ( runs its line forever, { does the same when the last comparison held, and - makes the whole program start again each time it ends. The cat has to delete its variable at the end of every round, or the next round would make a second Input and keep printing the first.

The interpreter is a download that is not in the specification. Where the specification leaves something open, this implementation chooses, and its manual says what.

The machine

CommandDoes
$text;Print the text
_Name #NameMake a variable; delete it
+_value +_^Give the next variable a value, or a line of input
%NamePrint a variable
=a,b !a,b >a,b <a,bCompare two values
*cmd @cmdRun the command if the last comparison held; if it did not
{cmd (cmdRun the command forever if it held; forever
-Run the whole program forever
m+a,b,NameStore a+b; also m-, mx and m/
v/^Pause, which does nothing

A line that starts with no command is a comment. Every print ends with a line feed.

Example

The truth machine.

The truth machine. On 0 it prints 0 once; on 1 the last line prints 1 forever.

Expected: 0

An example of @, an else for the comparison above it.

Expected: Not True

m+ stores only into a variable that already has a value. The calculator gives its Output a 0 before it adds.

Expected: 5

Further

Also in Turing tarpits

Write your own in Run Convert a program from Mash

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run mash -e '=1,2
@$Not True;'
shib manual mash

Source

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

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

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