TextGarbage
Variables, arithmetic, ifs and functions, written with no spaces and one character per word.
Dominicentek · Turing complete: unknown · ●○○ easy · esolangs.org
Tested with 7 known programs · Test method
Run it
The idea
Dominicentek made TextGarbage, first under the name Gibberish. It is an ordinary small language with variables, arithmetic, ifs, functions and goto. The trick is the spelling. Every command is one letter, every argument is one character, and nothing separates them. So a program is one long run of letters that looks like noise.
Read the story
A value is either a variable, named by one character, or c followed by one character, which is a constant. A digit after c is that number and anything else is its character code. So cH is 72 and c7 is 7, and a variable named c can be set but never read.
The machine
| Command | Arguments | Does |
|---|---|---|
v | name, value | Set a variable |
i | name | Read a line of input into a variable |
o n | value | Print as a character; print as a number |
m | name, value, op, value | Set a variable to two values joined by a add, s subtract, m multiply, d divide or r remainder |
c | value, test, value | Run the block up to e only if the test holds, e equal, n not equal, g greater or l less |
f r | name | Make the block up to e a function; run it |
l g | name | Mark a label; go to it |
x | Exit |
Characters that are no command are ignored. The specification leaves the input format open. In this implementation input comes a line at a time; a whole number is read as that number and any other text as the code of its first character. Numbers are whole and 32 bits wide.
Example
Hello World prints each letter as a constant.
Hello World prints each letter as a constant. Read it as o cH, o ce, o cl and so on.
The truth machine reads x. If it is 1, it marks a label l, prints 1 and goes back to it for ever. Otherwise it skips the block and prints 0.
The calculator reads a number, an operator and a number. It builds the codes of +, -, *, / and % in the variables a, s, m, d and r, then compares the operator with each.
Further
See also
Also in Hostile
Write your own in Run Convert a program from TextGarbage
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: textgarbage.
Command line
shib run textgarbage -e 'ixcxec1llnc1glenc0' --input '0'shib manual textgarbageSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/textgarbage.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org