ABCDE

From Esolang
Jump to navigation Jump to search

ABCDE is a Turing complete extension to ABCD made by User:CodeLongAndProsper90.

Extra commands

Name Function
E Marks the beginning of a loop
F Jumps back to the next E if the current cell is not zero
G Moves the tape up by one
H Moves the tape down by one

ABCDE is Turing complete since it can be compiled to Brainf*** trivially.

Cat

 AEGDCHF

Hello world

AAAAAAAAEGAAAAEGAAGAAAGAAAGAHHHHBGGAGAGBGGAEHGHBGGGCGBBBCAAAAAAACCAAACGGCHBCHCAAACBBBBBBCBBBBBBBBCGGACGAAC

Long output

Unlike ABCD, ABCDE can do string output easier if you can factor.

Compiler

An ABCDE to BrainF compiler can be written in 4 lines:

  import sys
  with open(sys.argv[1]) as input, open(sys.argv[2], 'w') as output:
    code = input.read()
    code = code.replace('A', '+').replace('B', '-').replace('C', '.').replace('D',',').replace('E', '[').replace('F',']').replace('G', '>').replace('H', '<')
    output.write(code)

See also