Fromage
Ten commands, and every one of them works on a single bit.
2000 · Turing complete: unknown · ●●● hard · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
The name stands for FReakish Outright Mad languAGE. Fromage survives on a backup of its old website, and the specification keeps the C implementation from there, squeezed into eight lines. This implementation follows that C one character at a time.
Read the story
The pointer names one bit. Bits 0 to 7 together are a byte, highest bit first, and two bits past them do the input and output. Toggling bit 8 prints the byte, and toggling bit 9 reads a byte into it, so both always stay 0.
The machine
| Command | Does |
|---|---|
> < | Move the pointer one bit |
: | Toggle the bit |
( ... ) | Skip what is inside, always |
{ ... } | Loop for ever |
[ A ; B ] | Do A if the bit is 1, else B |
Everything else is a comment. A loop ends only when a skip inside it, by (, [ or ;, passes its }. At the end of input the C reads 255, eight ones.
Example
The Hello world toggles bits 1 and 4 of a byte of 0 to make 72, an H, and then walks to bit 8 and toggles…
The Hello world toggles bits 1 and 4 of a byte of 0 to make 72, an H, and then walks to bit 8 and toggles it to print. Each later line toggles only the bits in which the next letter differs. The words at the ends of the lines are comments. It prints Hello world and a line feed, without the comma.
The cat reads a byte at bit 9 and tests bits 7 down to 0 with eight nested ifs. Only a byte of eight ones gets to the ( in the middle, which skips past the loop's } to the ) at the very end. Any other byte comes back out to bit 8, which prints it.
Patterns it teaches
- Turing tarpit: bits, one if and one endless loop.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from Fromage
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: fromage.
Command line
shib run fromage -e '>>>>>>>>{>:<<[<[<[<[<[<[<[<[(]>]>]>]>]>]>]>]>:})' --input 'abc'shib manual fromageSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/fromage.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org