Ash

From Esolang
Jump to navigation Jump to search
Ash
Paradigm(s) Imperative
Designed by User:Hakerh400
Appeared in 2025
Computational class Turing complete
Major implementations Implemented
File extension(s) .txt

Ash is an esolang invented by User:Hakerh400 in 2025.

Overview

Memory is represented as a tape infinite in both directions. The tape is divided into cells. Each cell contains a bit. Initially, every bit is random, except the bit at the position of the memory pointer, which is 1.

Instructions:

  • < - Move memory pointer left
  • > - Move memory pointer right
  • ~ - Write a random bit into the current cell
  • , - Input a bit into the current cell
  • . - Output the bit from the current cell
  • [] - Repeat the code from brackets while the current bit is 1

I/O format

Every input bit is prepended with bit 1, and infinitely many 0 bits are appended to the end of input. For example, the input string 1011 becomes

11101111000000000...

This preprocessing applies to the input, but not the output.

Syntactic sugar

The syntax name := code replaces the string name with code in the rest of the program.

Examples

All examples in this section start with the following definitions:

l1 := <<[<<~[>>>0<<0]>>]>
r1 := <<[>>~[<0>>0]<<]>
l2 := <<[L'~[R' >0 L' 0]R']>
r2 := <<[R'~[<<<0 R' 0]L']>
rand := ~
init := >0>
L' := <<<<
R' := >>>>
L := l2 L'
R := r2 R'
0 := [~]
1 := r1
flip := l2 [<<0>>0] r1 L' <[>]> R
in := ,
out := .
init

Note the literal string init after the definitions. It prepares the memory.

Cat

in [in out in]

Invert bits

in [in flip out in]

Reverse bits

0 R R in [R in R in]
L L [R out L L L]

Randomize bits

Replace each input bit with a random bit.

in [rand out in in]

External resources