=,-&~
A stack language whose programs look like a long row of dashes.
AmNow, 2021 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
AmNow made =,-&~ in 2021 so that code would look like a lot of dashes. Every command is a word of one or two characters taken from - = ≡ ~ ∽ ∸, and the words stand between spaces. A number is built from 0 by adding 1, 10 and 100, so 32 is - ≡ ≡ ≡ = =.
Read the story
The stack can also be turned round. ∸ brings the bottom value to the top and -- sends the top value to the bottom, which makes the stack a ring of cells. That is how the specification shows it is Turing complete, by turning every brainfuck command into a few words.
The machine
| Word | Does |
|---|---|
- | Push 0 |
= ≡ ~ | Add 1, 10 or 100 to the top |
∽ | Negate the top |
∸ -- | Move the bottom value to the top; move the top value to the bottom |
-= -≡ -~ | Pop; swap; duplicate |
-∽ ... -∸ | Skip past the loop if the top is 0; go back while it is not |
=- == =≡ =~ | Add, subtract, multiply, divide the top two |
=∽ =∸ | Read a number; read a character as its code |
≡- ≡= | Print and pop the top as a number; as a character |
The specification does not say which way round == subtracts. Its Fibonacci program brings its count to the top before each == to count down, and that only works if the top is the first number. So == is the top minus the one below.
Example
The truth machine on 0, and the Fibonacci program, which prints 0 1 1 and then one more number for each…
The truth machine on 0, and the Fibonacci program, which prints 0 1 1 and then one more number for each step of its count.
The spaces between the numbers are the program's own - ≡ ≡ ≡ = = ≡=, which prints character 32.
Patterns it teaches
- Stack machines: a stack that is also a ring.
- Turing completeness: shown with a table from brainfuck.
Further
See also
Stack-based
Write your own in Run Convert a program from =,-&~
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: u3d-2c-2d-26-7e.
Command line
shib run u3d-2c-2d-26-7e -e '=∽ -∽ -~ ≡- -∸ ≡-' --input '0'shib manual u3d-2c-2d-26-7eSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/u3d-2c-2d-26-7e.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org