LS Basic
A small BASIC that reads only the sum of each word's letters, so any word of the right score will do.
Simplemaker, 2020 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
Simplemaker wrote LS Basic, short for Letter-Sum Basic, in 2020. Every word is worth the sum of its letters, from a = 1 up to z = 26. print scores 77 and so does nurse, so the two are the same command. Variables and labels are scores as well. apple and disco both score 50 and name one variable.
Read the story
A plain program reads like BASIC, and the same program can be rewritten as a string of unrelated words. The cat, Input Apple Print Apple, becomes Smaller disco muses diner.
The machine
| Words | Scores | Does |
|---|---|---|
print v | 77 | Writes v in decimal |
printchar v | 107 | Writes the character with code v |
input v | 80 | Reads a whole number into v |
let v equal ... done | 37, 56, 38 | Works out the words between in reverse Polish |
lbl l goto l | 26, 57 | Marks a place; jumps to it |
if a c b l | 15 | Jumps to l when a c b holds |
end | 23 | Halts |
The test c in if is lesser 78, equal 56 or greater 74. The operators in let are plus 68, minus 76, times 66, divide 53 and mod 32. The only constants are the variables zero, one and ten, which start as 0, 1 and 10. Line breaks mean nothing.
Example
The cat, plain and hidden.
The cat, plain and hidden.
Arithmetic is reverse Polish between let and done. Two is one one plus, and four is two two times.
The truth machine in its hidden form. alb scores 15 like if, term 56 like equal, and unaided 58 like loop. On 0 it jumps to the label vigil, which scores 59 like null, and prints zero.
The Hello World makes base 70, as ten times eight minus ten, and steps from there to each letter. It prints HI WORLD!.
Patterns it teaches
- Camouflage: a program can hide as a list of everyday words.
- Encoding tricks: many words share a score, so every name has many spellings.
Further
See also
Also in Camouflage
Write your own in Run Convert a program from LS Basic
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: ls-basic.
Command line
shib run ls-basic -e 'Input Apple
Print Apple' --input '42'shib manual ls-basicSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/ls-basic.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org