esolang

Lenguage

Only the length of the file matters. Every text of exactly 23,855 characters, whatever it says, is the same cat program.

Pietu1998, 2014 · Turing complete: with unbounded memory · ●○○ easy · esolangs.org

Tested with 1 known program · Test method

Run it

Expected: 23855

The idea

Unary says: a program is a number of zeros. Lenguage, made in 2014 by the esolangs.org user Pietu1998 after a code golf challenge, drops the zeros. Any characters will do. The file's length is the program; its content is ignored completely.

Read the story

So a short story cut to that length and 23,855 copies of the letter x are one and the same program. You can hide a Lenguage program inside any text by trimming or padding it to the right length.

It is a joke about encoding tricks taken as far as it goes: the "code" carries no information at all, except how much of it there is.

The machine

Brainfuck's machine. To find the Brainfuck program inside a file of N characters:

  1. Write N in binary.
  2. Pad it on the left with zeros until its length is a multiple of 3.
  3. Read it three bits at a time:
Bits000001010011100101110111
Brainfuck+-><.,[]

The table is not Unary's, and there is no marker bit. That has a cost: leading zeros vanish when a number is written, so a program cannot start with +. Start with something else (a harmless ><, say) and the +s survive.

Example

cat is ,[.,]:

cat is ,[.,]:

101  110  100  101  111      , [ . , ]
= binary 101110100101111 = 23,855

Any file of exactly 23,855 characters is cat.

Expected: any text
node -e "require('fs').writeFileSync('cat.len', 'x'.repeat(23855))" && shib run lenguage cat.len --input meow

The leading-+ problem. Encode ++++++++[>++++++++<-]>+. (prints A) and decode it again, and the first eight +s are gone. Write >++++++++[<++++++++>-]<+. instead and it works:

Expected: 9444733190039662567108
Expected: A

Patterns it teaches

  • Encoding tricks: the program is a number, and the file is the laziest possible way to write that number.
  • Every text runs: every file of every length is a valid program (as long as its Brainfuck has balanced brackets). But in Lenguage that is trivial, because content does not matter.
  • Turing completeness: as powerful as Brainfuck, and as useless in practice as Unary.

Try this

  1. What does a 1-character file do? A 7-character one? Work it out, then check with -n.
  2. Find the shortest Lenguage program that prints something.
  3. Take a text you like and work out how many characters you must add or cut to make it print A.

Further

Lenguage builds on Brainfuck.

Brainfuck equivalents

Cell-based

Write your own in Run Convert a program from Lenguage

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: lenguage.

Command line

shib run lenguage program.txt --input 'meow'

The program is long; save it as program.txt first.

shib manual lenguage

Source

Module
langs/museum/ports.js
Interpreter
langs/museum/lenguage.js, langs/common.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org