Linecode
A whole program on one line, with no spaces, no brackets and no ends.
PiggyPig, 2023 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
PiggyPig made Linecode in 2023. A program is a single line, and nothing in it separates one thing from the next. Every function, value and operation starts with a letter or a sign that says how much follows, so the line can be read from left to right without a delimiter.
Read the story
Values carry a prefix. n12 is the number 12, cH is the character H and ss is a space. Operations come first, as in +n12n13. There is no loop and no jump, so every command runs at most once.
The machine
| Function | Does |
|---|---|
w3... | Write the next 3 values |
rk | Print k: and read a value into k |
vkn | Make the variable k, of type n |
skn12 | Set k to 12 |
c=vkn12... | Run the next function only if k is 12 |
| Value | Is |
|---|---|
n12 z12 | 12 and -12 |
u12 | 12, unsigned |
d12n7 d12z7 | 12.7 and -12.7 |
vk | The variable k |
cH | The character H |
ss sl | A space and a line break |
The operations + - * / ^ % = < > & | take two values and _ ~ \ ! t take one. A variable keeps one type, n, u, d, c or t, and a value set into it must have that type. The debug command g is not implemented, because the specification gives it no meaning.
Example
The second line writes three values, the number 12, a space and !.
The second line writes three values, the number 12, a space and !. The third makes k a number, sets it to 12, and writes say because k equals 12.
rk asks with k: and reads 7, and *vkvk multiplies k by itself.
Patterns it teaches
- Encoding tricks: prefixes that say how much follows stand in for every delimiter.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from Linecode
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: linecode.
Command line
shib run linecode -e 'w3cscacy'shib manual linecodeSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/linecode.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org