esolang

dd

One instruction. It prints itself.

A, 2018 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: dd

The idea

User A published dd on 4 July 2018. It has one instruction, dd, and that instruction prints dd. Everything else does nothing. So any program made only of dd is a quine, and almost any text is a dd program, which the specification offers as a way to write polyglots.

Read the story

There is no input, no memory and no jump. esolangs.org files it under finite state automata.

The machine

TextDoes
ddPrint dd
anything elseNothing

The JavaScript reads from left to right and uses both d of a pair, so ddd holds one pair and prints dd, not dddd. A line break between two d keeps them apart.

Example

The longer example has four pairs.
Expected: dd

The longer example has four pairs. The fifth would be the last two d, but a line break stands between them.

Expected: dddddddd

Patterns it teaches

  • Quine: every program of only dd prints itself.
  • Polyglot: any text is also a dd program, which prints dd for each pair of d in it.

Further

Also in Jokes

Write your own in Run Convert a program from dd

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run dd -e 'dd'
shib manual dd

Source

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

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

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