esolang

'A:;'

One line of statements split by semicolons, arguments split by colons, and twelve variables.

OriginalOldMan, 2013 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 5 known programs · Test method

Run it

Expected: Hello World

The idea

OriginalOldMan made A:; in 2013. A program is a single line. Each statement starts with a command letter or a variable name, and the letters a d g i k m n p s and ? are taken by commands. That is why only twelve variables are left, b c j l o q r t u v w x.

Read the story

A variable holds text until arithmetic touches it, and then it is a float. So a:j:l on 1 and 2 gives 3.0, and that is what p prints. This implementation follows the Ruby interpreter in the specification.

The machine

StatementDoes
j:textSet j to the text
p:jPrint j
i:j n:jRead a line as text, or as a whole number
a:j:l s:j:l m:j:l d:j:lj becomes j plus, minus, times or divided by l
g:5Go to statement 5, counting from 0
?:j:=:l:2Compare j and l with = < or >; when false, skip the next 2 statements
kEnd

\n in the source is a line break.

Example

Hello World from the specification.

Hello World from the specification.

The adder from the specification reads two numbers. The sum is a float.

Expected: 5.0

The truth machine. On 0 the first comparison holds, so it prints and ends. i drops the last character of the line, which is meant to be its line break, so the input needs one.

Expected: 0

The 99 bottles program from the specification counts down with s:b:c, and from the second verse on the count is a float, as in 98.0 bottles of beer on the wall. The FizzBuzz in the specification stops at its first comparison, because the Ruby interpreter reads 0 as a variable name and has no variable of that name.

Patterns it teaches

  • Counter machines: the specification compiles a Minsky machine into it with two variables, a and s and a conditional skip.
  • Turing completeness: a goto and a test are all it needs.

Further

Also in Turing tarpits

Write your own in Run Convert a program from 'A:;'

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run a -e 'n:j;n:l;a:j:l;p:j' --input '2
3
'
shib manual a

Source

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

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

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