esolang

Dashes

Twelve commands, and every one of them is a dash.

DigitalDetective47, 2021 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello, world!

The idea

DigitalDetective47 made Dashes in 2021. Its commands are the hyphen-minus and eleven other dash characters from Unicode, among them the hyphen, the non-breaking hyphen, the figure dash, the en and em dash, the minus sign and the two-em and three-em dash. Several of them look alike. Any other character is a comment.

Read the story

Underneath is a small machine. A stack holds whole numbers of any size, and a tape of them runs without end in both directions. Values move between the two through the current cell.

The machine

CharCode pointDoes
-U+002DPush 1
‐U+2010Push the next input character, or -1 at the end
‑U+2011Pop and print it as a character
‒U+2012Pop and drop
– —U+2013, U+2014Move the head left or right
⁃U+2043Pop, add the current cell, push
−U+2212Negate the top
⸺U+2E3APop into the current cell
⸻U+2E3BPush the current cell
―U+2015Pop, and if it is 0 jump past the matching ⎯
⎯U+23AFJump back to the matching ―

Popping an empty stack stops the program with an error, and so does printing a value below 0 or above 1,114,111.

Example

The cat.

The cat. It tests each character plus one, which is 0 only at the end of input, where ‐ gives -1. Its two short loops run at most once, so they work as an if, and each leaves a 1 or a 0 on the stack for the outer loop to test.

-⁃⸺ adds one to the current cell, and ⸻⁃⸺ doubles it. So 65 is 1 doubled six times, plus 1, and ⸻‑ prints it.

Expected: A

The infinite loop is -―-⎯. It pushes a 1 before every test.

From brainfuck

The specification shows that Dashes is Turing complete with a table that turns each brainfuck command…

The specification shows that Dashes is Turing complete with a table that turns each brainfuck command into Dashes.

brainfuckDashes
< >– —
+-⁃⸺
--−⁃⸺
.⸻‑
,‐⸺
[⸻―
]⸻⎯

[ pushes the cell for ― to test, and ] pushes it again before it jumps back to that same test. The usual brainfuck Hello World of 106 commands becomes 268 dashes, and they print Hello World!

Patterns it teaches

Further

Cell-based

Stack-based

Write your own in Run Convert a program from Dashes

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run dashes -e '‐⸺-⁃—⸻–-⁃―⸻‑‒-—⸻–⎯―‐⸺-⁃—⸻–-⁃―⸻‑‒-—⸻–⎯⎯' --input 'Hello, world!'
shib manual dashes

Source

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

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

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