hny021
Jump to navigation
Jump to search
| Designed by | User:Hakerh400 |
|---|---|
| Appeared in | 2021 |
| Computational class | Turing complete |
| Major implementations | See below |
| File extension(s) | .txt |
hny021 is a Turing-complete esoteric programming language invented by User:Hakerh400 in 2021. It is also the first language ever created in 2021.
Overview
Source code consists of two arrays of natural numbers. Their length must be the same and they must contain at least one element. The first array is called A and the second array is called B.
We internally keep track of three variables:
h- Initially 0n- Initially 2y- Initially 1
Perform these steps iteratively until y becomes zero, in which case the program halts:
- Let
abe the element ofAat indexh - Let
bbe the element ofBat indexh - Increment
hby 1 and if it becomes equal to the length of the arrays then reset it to 0 - Check if
yis odd - Perform integer division
yby 2 - Perform integer division
nby 2 - If
ywas odd theny = y + n * aandn = n * b
Interpreter
Here is a simple interpreter in Python:
A = [6, 1, 5] B = [8, 4, 8] [h, y, n] = range(0, 3) while y: a = A[h] b = B[h] h += 1 if h == len(A): h = 0 odd = y & 1 y //= 2 n //= 2 if odd: y += n * a n *= b