(SIASL)²
Brainfuck on a square matrix, where every instruction is two characters and the order does not matter.
K.avi, 2023 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
K.avi made (SIASL)² in 2023. SIASL stands for "Siasl Is a Silly Language", and the square is there because each instruction is two SIASL instructions. The memory is a square matrix, so the pointer moves in four directions. An instruction is a pair of characters, and it is commutative. +# and #+ are the same instruction, which nearly halves the number of pairs there are.
Read the story
The pairs with # are brainfuck. Around them the specification builds arithmetic with the neighbouring cells, loops that move or count by themselves, an instruction that runs the program backwards, and a way to give any unused pair a meaning of its own.
The machine
| Pairs | Do |
|---|---|
#> #< #^ #v #+ #- .# ,# [# #] | Brainfuck, in four directions |
#* #/ | Multiply or divide by the mult/div value, 2 at the start; ?, reads a new one |
+> *< v/ >- and the rest | Add, multiply, divide or subtract the neighbour in that direction |
[+ -] [> and the rest | Loop brackets that change the cell or move on each pass |
.+ .- .* ./ .? | Print the cell as a signed, hexadecimal, octal or unsigned number, or with six decimals |
>> << ^^ vv | Jump to the end or start of the row, or the first or last cell |
?< ?> | Run backwards from here, or forwards again |
(# s body #) | From now on the pair s runs the body |
Whitespace and {comments} are ignored. A pair that has no meaning yet does nothing. The specification's table has ^- subtract the cell below and v- the cell above, and this implementation does the same. The specification does not say how big the matrix is; this implementation uses 16 by 16.
Example
The Silly.
The Silly. +#+#*#*#+#** makes 81 from 2 times 2 times 2 plus 1, squared, and two more +# make 83, an S. Further on <+ adds the cell on the left, so l starts from the i before it.
Definitions are read when the pair runs, not when it is defined. ?? first only adds 1, because .. means nothing yet. Once .. is defined, ?? adds 1, squares, adds 1 and prints, which gives 5 and then 37. The pair (+ holds a definition itself, and running it makes ?? a plain print.
The cat is brainfuck's ,[.,] written in pairs.
Patterns it teaches
- Turing tarpit: brainfuck underneath, with many more instructions than it needs on top.
Further
See also
(SIASL)² builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from (SIASL)²
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: siasl-2.
Command line
shib run siasl-2 -e '(#??+#..#)
??
(#..**+#.+#)
??
(#(+(#??.+#)#)
??
(+
?? 'shib manual siasl-2Source
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/siasl-2.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org