esolang

ABC

One accumulator, a handful of letters, and a loop that can only go back to the very start.

Orange, 2008 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: 1337

The idea

Orange made ABC in 2008, and the specification calls it very simple and easy to implement. It has one accumulator. a and b count it up and down, and c prints it. $ switches c between printing a number and printing a character, so text is spelled by counting from one code to the next. The only control flow is l, which jumps back to the start without resetting anything. A program runs straight through once, or forever.

Read the story

The specification says ABC has nothing to do with the real programming language of that name.

The machine

CharDoes
a bAdd 1, take 1 away
cPrint the accumulator, as a number or in ASCII mode as a character
dNegate it
rSet it to a random number from 0 to itself
nSet it to 0
$Switch ASCII mode on or off
lGo back to the start of the program
;Print it as a number, a space and a character

Every other character does nothing. The specification gives two interpreters that differ. This implementation follows the Java one, because the specification's 1337 example prints 1337 only there. The Python one puts a space after each number.

Example

The accumulator goes to 1, 3, 3 and 7, and c prints it each time with nothing in between.

The accumulator goes to 1, 3, 3 and 7, and c prints it each time with nothing in between.

Expected: Hello, World!

The Hello World switches to ASCII mode, counts 72 for the H and walks up and down from letter to letter. Twice n starts again from 0, for the comma and for the closing 33. The line breaks are characters it ignores.

Further

Also in Turing tarpits

Write your own in Run Convert a program from ABC

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: abc.

Command line

shib run abc -e 'acaaccaaaac'
shib manual abc

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/abc.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org