esolang

SuperMarioLang

A brainfuck tape worked by Mario, who walks along the ground, falls into holes and rides elevators.

2009 · Turing complete: yes · ●●○ moderate · esolangs.org

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

Run it

Expected: b

The idea

SuperMarioLang builds on MarioLANG, which made a program look like a level of Super Mario. Mario starts at the top left, walking right. Ground is =, and where there is none he falls. The items he walks over or falls through are commands on a tape of numbers, much like brainfuck. Loops are built out of the level itself; elevators carry Mario back up, and [ lets him skip a turn.

Read the story

This implementation runs SuperMarioLang on MarioLANG's rules. TIO's Hello World runs on them unchanged, but whatever SuperMarioLang adds on top is not implemented.

The machine

Each step Mario does what is in his cell. Then he rides an elevator if he stands still on one, falls if there is no ground under him, and otherwise walks one cell. Falling off the bottom ends the program.

PieceDoes
= \|Ground and wall
# "Elevator start and end; standing still on #, Mario rides to the " in his column
) (Move the memory pointer right, left
+ -Add one, take one away
. ,Write the cell as a character, read one (-1 at the end)
: ;Write the cell as a number, read one
> < @ !Walk right, walk left, turn round, stop
[Skip the next command if the cell is 0
^Jump up one row

On an elevator Mario picks up the items he passes. Standing still on plain ground, he is done.

Example

The cat is MarioLANG's own.
Expected: cat

The cat is MarioLANG's own. Mario reads a character and adds one. If that made 0, the input has run out, [ skips the < and Mario walks off the level. Otherwise he turns at <, takes the one back off, prints the character and stops on the elevator, which lifts him back to the start.

Expected: Hello, World!

TIO's Hello World falls down the first column, rides the first elevator and falls down the third column, picking up 5, 3 and 3 pluses, 11 in the first cell. Then it loops between two elevators the way brainfuck's Hello World loops between brackets.

Further

Ideas it shows

Two-dimensional languages

Cell-based

Write your own in Run Convert a program from SuperMarioLang

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run supermariolang -e ',+.
===' --input 'a'
shib manual supermariolang

Source

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

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

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