esolang

flag

The spaces at the start of a line say how many times it runs. Tabs are forbidden.

None1, 2023 · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello World!

The idea

None1 made flag in 2023. Each line begins with a flag of spaces, and the number of spaces is the loop. No spaces runs the line once, one space runs it forever, two run it while the current cell is not 0, and three or more run it one time fewer than the spaces. Most characters print themselves, so almost any line of plain text is a quine.

The machine

CodeDoes
?Read a byte into the cell
!Print the cell
*Add 1 to the cell
: ;Move left, move right
_Print the next character, even a special one
anything elsePrint itself

The cells are bytes on a bounded tape. A tab anywhere in the program is an error, and so is printing or reading one.

Example

The third line has four spaces, so its code runs three times.
Expected: Quine
Expected: ababab

The third line has four spaces, so its code runs three times.

Further

Ideas it shows

flag builds on Brainfuck.

Brainfuck derivatives

Cell-based

Write your own in Run Convert a program from flag

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run flag -e 'Quine'
shib manual flag

Source

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

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

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