ACCUMULATOR

From Esolang
Jump to navigation Jump to search

ACCUMULATOR is a programming language designed by UndoneStudios. It was designed mainly to solve the uselessness problem of the accumulator in most languages that have an accumulator. It is a very basic language, though the creator has an interest in developing and improving the language; the last addition was in 20/11/2024, where the E function was added to the JavaScript interpreter. It has 8 operations (in order of addition; the oldest is first):

  • A - increments the accumulator
  • M - decrements the accumulator
  • O - outputs the accumulator
  • C - concatenates the accumulator to itself
  • R - resets the accumulator to 0
  • U - outputs Unicode value of accumulator
  • B - backspaces the output
  • E - runs the first few characters of the output as ACCUMULATOR code (a rudimentary loop command). The number of characters is the accumulator's value.

This language is case-sensitive.

Interpreters

The official JavaScript interpreter

UndoneStudios created this interpreter, which is online at https://sectorcorruptor.github.io/accumulator.html. It is the first interpreter that exists for this language.

Python

Also created by UndoneStudios

cmd = "++>"
while 1:
    code = input(cmd)
    accumulator = 0
    for i in code:
        if i == "A":
            accumulator += 1
        elif i == "M":
            accumulator -= 1
        elif i == "O":
            print(accumulator)
        elif i == "C":
            accumulator = int(str(accumulator)+str(accumulator))
        elif i == "R":
            accumulator = 0
        else:
            print("Invalid")