esolang

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

Expected: Hello World!

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

FunctionDoes
w3...Write the next 3 values
rkPrint k: and read a value into k
vknMake the variable k, of type n
skn12Set k to 12
c=vkn12...Run the next function only if k is 12
ValueIs
n12 z1212 and -12
u1212, unsigned
d12n7 d12z712.7 and -12.7
vkThe variable k
cHThe character H
ss slA 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 !.
Expected: 12 !
Expected: say

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.

Expected: k: 49

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

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 linecode

Source

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