/\

From Esolang
Jump to navigation Jump to search

/\ is an esoteric programming language by User:Dragoneater67 in 2026 that uses balanced trinary.

Overview

All memory is stored in unbounded integer accumulators and a shared queue of unbounded integers. Each line is a - separated list of balanced trinary integers where:

  • / is 1
  • | is 0
  • \ is -1

Each line has it's own accumulator. All of the lists are parsed simultaneously forever in an implicit loop (when the end of the list is reached, it just wraps back to the start). Each integer is added to the corresponding accumulator and if the result is not 0, the result is enqueued, if the result is 0, the contents of the queue are dequeued to the current list.

Examples

Looping counter

/

Implementations

Python

import sys

if len(sys.argv) < 2:
    print(f"usage: python {sys.argv[0]} [filename]")
with open(sys.argv[1]) as f:
    p = f.read().split('\n')

l = []
a = []
q = []
for r in p:
    if len(r) == 0:
        continue
    s = r.split('-')
    l.append([])
    a.append(0)
    x = l[len(l) - 1]
    for i in s:
        n = 0
        for j in i:
            d = 0
            if j == '/':
                d = 1
            elif j == '|':
                d = 0
            elif j == '\\':
                d = -1
            else:
                continue
            n = n * 3 + d
        x.append(n)

n = 0
while True:
    for i, x in enumerate(l):
        a[i] += x[n % len(x)]
        if a[i] != 0:
            q.append(a[i])
        else:
            for e in q:
                x.append(e)
            q = []
    n += 1