Super SNUSP
SNUSP's mirrors and tape, with a command for almost every printable character.
Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Super SNUSP starts from SNUSP, the brainfuck that runs on a grid and turns at the mirrors / and \. It keeps the mirrors, the skips and the tape, and gives nearly all of the 95 printable characters a job. Letters set the cell to their code, digits write a decimal number, and a stack beside the tape feeds the arithmetic and bitwise operators.
Read the story
It stays Turing complete for the plainest reason. Every SNUSP command is still there, with ( and ) standing in for - and +.
The machine
| Char | Does |
|---|---|
" ' | Start here going right; end the run |
/ \ | Turn as in SNUSP |
! ? and the backtick | Skip the next cell; skip it if the cell is 0; skip it if negative |
< > | Move along the tape |
( ) _ ~ | Subtract 1, add 1, negate, bitwise not |
A to Z, a to z, 0 to 9 | Set the cell to a letter's code or a decimal number |
{ } $ | Push the cell; copy the stack top into it; drop |
+ - * : % ; | Arithmetic with the stack top; : and ; round down |
& | ^ [ ] | Bitwise and, or, xor and shifts with the stack top |
= | A random number between the cell and a popped value |
. # | Print a byte; print in decimal |
, @ | Read a byte; read a decimal number |
The specification leaves some things open. In this implementation the operators leave the stack top in place and leaving the grid ends the run. The specification says a program without " starts at the bottom right, but its own cat only works from the top left, so this implementation starts there.
Example
The Hello World stores the letters on the tape from right to left.
The Hello World stores the letters on the tape from right to left. Then a loop through four mirrors prints a cell, steps back and stops at the empty cell before the first one.
A cat program. It reads a byte and, unless it is 0, loops through the mirrors to print it and read the next one.
Decimal output and the stack. 6 is pushed, the cell becomes 7 and is multiplied by the stack top.
Patterns it teaches
- Two-dimensional control flow: mirrors and skips on a grid.
- Stack machines: a stack beside the tape holds the second operand.
Further
See also
Two-dimensional languages
Cell-based
Write your own in Run Convert a program from Super SNUSP
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: super-snusp.
Command line
shib run super-snusp -e ',!/ ?\'\''
\,./' --input 'Cat'shib manual super-snuspSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/super-snusp.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org