esolang

Dogless

One string with a marker in it. Each step rewrites the string, and what is left at the end is the output.

Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 13 known programs · Test method

Run it

Expected: abcdef

The idea

Dogless is a spiritual successor to dupdog. A program is a string, and its first | is the marker. The character after the marker is the instruction. It is taken out of the string together with its parameters, and then it changes the string. An ordinary letter just moves to the left of the marker, so a plain string walks past the marker one character at a time.

Read the story

The run ends when there is no marker left, or when the marker reaches the end and is taken out. The string is then the output. There is no input; the program is its own data.

The machine

InstructionDoes
any other characterMoves to the left of the marker
\xPuts x to the left of the marker, even a command
|Nothing
$abReplaces the first a in the string with b
"text"Deletes up to the next quote
?Reverses the whole string
^Swaps the parts before and after the marker
~Appends the string as it was, ~ included
!Deletes everything, marker too
<X >XRuns X on the part before or after the marker only

Inside < and > the part is the whole string for X, so its own first | is its marker. Two > in a row skip ahead past the next marker.

Example

In the second line ?
Expected: fedcba
Expected: hellobabb
Expected: abcdegf

In the second line ? leaves abc|def and reverses it to fed|cba, and the letters walk past the marker. In the third $ab replaces the first a in the string with b. In the last one the first > hands de|fg to >?, which reverses only fg.

The specification shows the first step of 14 examples. Run on from there, 13 of them have one possible end, and all 13 are checked. The other is ~, which copies the program onto its own end, so abc|~def grows forever.

Patterns it teaches

Further

Unknown year

Self-modifying

Write your own in Run Convert a program from Dogless

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run dogless -e 'abc|def'
shib manual dogless

Source

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

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

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