-string
Every word is a variable unless a dash makes it text, and brackets make a line be read twice.
Runius, 2025 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
Runius made -string in July 2025, after This=That. Almost everything in a line is text that gets evaluated. A word with a dash in front is literal text, a bare word is a variable, and a lone dash is a space, usually the only way to get one. Text in square brackets is evaluated first and its result written in its place, so [--Layered] -Parsing becomes -Layered -Parsing and then LayeredParsing. A variable can hold the name of another, like a pointer.
Read the story
There are no numbers to compare and no if. A jump goes to a label whose name is built from text, and a jump to a label that does not exist does nothing. So num2 -Exit makes 0Exit only when the counter is 0, and only then is there a label to land on. The truth machine, A+B and FizzBuzz in the specification all decide that way.
The machine
| Line | Does |
|---|---|
left = right | Store the right side in the variable the left side names |
-out = text | Print the text and a line feed |
! text | Jump to the label the text names, if there is one |
+ text - text | Add or take 1 from the variable the text names, if it holds a whole number |
: name | A label |
| anything else | A comment |
| Token | Gives |
|---|---|
-word | The word itself |
- | A space |
in | A line of input |
word | The value of the variable, or nothing |
[ ... ] | Its result, put in place before the rest is read |
Example
The truth machine jumps to the label named by its input.
The truth machine jumps to the label named by its input. There is a label 0, so 0 prints once; there is no label 1, so 1 falls through into the loop and prints forever.
The A+B program moves 1 from one number to the other until the second one is 0.
The FizzBuzz program counts to 100 with two countdowns, one from 3 and one from 5.
Patterns it teaches
- Counter machines: a label named after a counter's value is a test for 0.
Further
See also
Also in Rewriting
Write your own in Run Convert a program from -string
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: string.
Command line
shib run string -e '-out = in' --input 'meow'shib manual stringSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/string.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org