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 12/04/2023, where the R function was added to the JavaScript interpreter. It has 5 basic 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

This language is case-sensitive.

Interpreters

The official JavaScript interpreter

UndoneStudios himself created the interpreter, which is online at https://undonestudios.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")