MarioLANG
The program is a Super Mario level. Mario walks over it, falls off ledges and rides elevators, and the items he touches are brainfuck.
Wh1teWolf, 2009 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 5 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
Wh1teWolf made MarioLANG in 2009, inspired by RubE On Conveyor Belts. The source looks like a level: rows of = ground, | walls, # elevators, and Mario running across them. Underneath is brainfuck's tape. Every + or . Mario walks over or falls through is done, and loops are built from turning him around with < and >.
Read the story
There is no official interpreter and no exact spec. Try It Online runs T.J.S.1's C++ interpreter, and the details follow the programs it runs.
The machine
Mario starts at the top left, walking right. Each tick he does what he stands on, then falls one row if there is no ground below him, else takes one step.
| Char | Does |
|---|---|
= \| | Ground and wall |
# " | An elevator and its end. Standing still on # he rides up or down to the " in that column |
) ( | Move the memory pointer |
+ - | Add or take one |
. : | Print the cell as a byte, or as a number and a space |
, ; | Read a byte (-1 at the end) or a number |
> < @ | Walk right, walk left, turn around |
^ | Jump one row up |
! | Stop walking |
[ | Skip the next command he meets if the cell is 0 |
The run ends when Mario falls off the bottom of the level or stands still on plain ground.
Example
Count up to 81 and print it as a byte, on one flat floor.
Count up to 81 and print it as a byte, on one flat floor.
A cat. ,+[ reads a byte and adds one, so the end of input (-1) becomes 0 and [ skips the <. Otherwise Mario turns back, takes the one away, prints the byte, stops on the elevator and rides up to start again.
A truth machine. ; reads a number and : prints it. A 1 makes [ let the < through, and Mario runs back and forth over the : forever; a 0 skips it and he stops at !.
Patterns it teaches
- Two-dimensional control flow: loops are elevators and turnarounds, and gravity is a free jump.
- Camouflage: a tape machine dressed as a platform game.
- Turing completeness: unbounded cells and loops make it as strong as brainfuck.
Further
- esolangs.org/wiki/MarioLANG
- T.J.S.1's interpreter, which TIO runs
See also
Two-dimensional languages
Cell-based
Write your own in Run Convert a program from MarioLANG
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: mariolang.
Command line
shib run mariolang -e '>;>:[<!
=======' --input '0'shib manual mariolangSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/mariolang.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org