Skull
Numbered cells, braces to change them and bars to print them.
Emil Svensson, 2008 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Emil Svensson made Skull in 2008. The specification says the name comes from the sketch he had drawn next to the language draft. A program adds to and takes from numbered cells, loops while a cell is not 0 and prints cells. The only other thing to choose is how a cell prints, as a character or as a number, and that is a mode you switch.
Read the story
The specification shows it is Turing complete because a Minsky machine compiles into it.
The machine
| Command | Does |
|---|---|
{x[+y]} {x[-y]} | Add y to cell x, or take y off |
{x[y]} | Set cell x to y, which only the compiler has |
{x{ ... }} | Repeat while cell x is not 0 |
|x| | Print cell x |
:ASC: :NUM: | Print as characters, or as numbers, from here on |
Cells start at 0. Text after // is a comment. The Perl script Skull2C compiles Skull to C, and this implementation follows it. Cells are C ints, and a program starts in ASCII mode, as the compiled C does, though a comment on the specification says it starts with numbers.
Example
Ten cells hold the letters, and the bars print them in the order of the text.
Ten cells hold the letters, and the bars print them in the order of the text.
Addition moves cell 0 into cell 1 one at a time, so 4 and 2 make 6.
The second sum switches the mode for each print, so the signs come out as characters and the numbers as numbers.
Patterns it teaches
- Counter machines: cells that only go up and down by a count, and a loop that runs while one is not 0.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from Skull
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: skull.
Command line
shib run skull -e ':NUM:{0[+4]}{1[+2]}{0{{0[-1]}{1[+1]}}}|1|'shib manual skullSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/skull.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org