Silberjoder
Self-modifying Brainfuck and Aubergine merged into one language, so that every program in either still runs.
Quintopia, 2016 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 4 known programs · Hello World on Try It Online: identical except the line end · Test method
Run it
The idea
Quintopia made Silberjoder for the CALESYTA 2016 contest. The goal was to please one judge, who wanted another relative of Aubergine, and to annoy everyone else with yet another brainfuck derivative. So it is both. Programs of Self-modifying Brainfuck and of Aubergine are valid Silberjoder with the same behaviour.
Read the story
Both parents run from a tape that holds the program itself. Silberjoder copies the source onto a tape of unbounded integers and runs from there. Brainfuck commands use register c as the data pointer, and c starts just past the program, so < steps back into the code.
The machine
A tape infinite both ways and four registers. a, b and i (the instruction pointer) start at 0, and c at the length of the program.
Three characters that form an Aubergine instruction run as one. The first is the operation, the other two its arguments.
| Operation | Does |
|---|---|
=xy | x = y |
+xy | x = x + y |
-xy | x = x − y |
:xy | If y is not 0, i = x |
An argument is a register (a b c i), the cell a register points at (A B C), o for input or output, or 1. After an Aubergine instruction, i moves on by 3.
Any other character runs as brainfuck on the cell at c, > < + - . , [ ], where a bracket looks for its partner in the tape as it is now. Then i moves on by 1. The run ends when i reaches a 0 with only 0s after it.
Example
The first is the quine.
The first is the quine. -cc subtracts c from itself, so the pointer is at cell 0, the program's first character. Then [.>] prints cells until the 0 after the program. The second is the truth machine. It reads a digit into the cell after the program, prints it, and subtracts cell 0, which is the character 0. For a 1 the loop prints the program's last character, 1, forever.
Patterns it teaches
- Code as data: the source is the tape, and
<from the start position reaches into it. - Self-modifying code: brackets are matched against the tape at the moment they run.
- Quine: printing yourself is a seven-character loop.
Further
- esolangs.org/wiki/Silberjoder
- The reference interpreter in Python 2: github.com/quintopia/Silberjoder
See also
Silberjoder builds on Brainfuck.
Self-modifying
Brainfuck derivatives
Write your own in Run Convert a program from Silberjoder
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: silberjoder.
Command line
shib run silberjoder -e '-cc[.>]'shib manual silberjoderSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/silberjoder.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org