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 22/12/2022, where the C function was added to the JavaScript interpreter. It has 4 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

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, and is at version 1.1.

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))
        else:
            print("Invalid")