esolang

QuineFuck

Brainfuck where the comments speak. Any text without a command in it is a quine.

None1 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello World!

The idea

None1 made QuineFuck from brainfuck with one change. Brainfuck skips every character that is not one of its eight commands. QuineFuck prints it instead, at the moment the program reaches it. So Hello World! prints itself, and so does any other text that avoids +-<>.,[]. The specification lists two quines, Quine and Fuck!.

The machine

CharDoes
> <Move the pointer right or left
+ -Add or take 1 from the cell
. ,Print the cell; read a byte into it
[ ]Loop while the cell is not 0
anything elsePrint itself

The specification's interpreter is in Python. Cells are bytes, the tape reaches both ways and the end of input reads as 0. It reads its input with one input(), so a program sees one line.

Example

The last one prints 5 = as text, then counts 7 times 7 plus 4 into a cell, which is 53, the code of 5.
Expected: QuineFuck
Expected: 5 = 5

The last one prints 5 = as text, then counts 7 times 7 plus 4 into a cell, which is 53, the code of 5.

Patterns it teaches

  • Quine: here a quine needs no trick at all.
  • Every text runs: any text is a program, and most of it is output.

Further

QuineFuck builds on Brainfuck.

Brainfuck derivatives

Write your own in Run Convert a program from QuineFuck

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run quinefuck -e 'Quine'
shib manual quinefuck

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/quinefuck.js

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

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