From Esolang
(Redirected from A colon semicolon)
Jump to: navigation, search

A:; is an esoteric programming language created by User:OriginalOldMan. Each A:; program has a series of statements separated by semicolons. Each A:; statement has a series of arguments separated by colons. All A:; programs must be written on one line.


Only 12 variables can be used in A:;. They are:

b,c,j,l,o,q,r,t,u,v,w and x

Variables in A:; can contain strings or numbers. A variable can be set by entering its name as the first argument of a statement, and the value you want to set it to as the second argument. Variables cannot be set equal to other variables. The following example sets the variable j equal to "Hello World":

j:Hello World 

Variables set to number values should be in decimal form:



When using a command in A:; the command is entered as the first argument in the statement.

Command Description Example
p The p command is used to print variable values to the standard output.

It can only print the values of variables.

j:Hello World\n;p:j (Prints "Hello World")
a The a command is used to add two numbers together

The value of the variable in the second argument is added to the value of the variable in the first argument

j:1.0;l:2.0;a:j:l (Adds the value of l to j so that j is equal to 3.0)
s The s command is the same as the a command except for the fact that it subtracts instead of adding j:1.0;l:2.0;s:j:l (Subtracts the value of l from j so that j is equal to -1.0)
m The m command is the same as the s and a commands except for the fact that it multiplies j:2.0;l:3.0;m:j:l (Multiplies j by the value of l so that j is equal to 6.0)
d The d command is the same as the m command except for the fact that it divides j:4.0;l:2.0;d:j:l (Divides j by the value of l so that j is equal to 2.0)
g The g command is used to go to a certain statement.

The only argument in this command specifies the number of the statement to go to. (Note that the first statement in a program is statement 0)

j:Hello World\n;p:j;g:1 (Infinitely prints "Hello World")
i The i command is used to get input in the form of a string from the user.

The only argument in this command is the name of the variable that the input will be stored in.

i:j;p:j (An example of a cat program)
n The n command is the used to get input in the form of a number

Otherwise, it is the same as the i command

n:j;n:l;a:j:l;p:j (Adds together two numbers inputted by the user, and prints the sum)
? The ? command is used as an if statement.

The first and third arguments determine the variables to be compared. The second argument determines the way in which the variables should be compared (=,<,or >). The fourth argument determines how many of the following statements are part of the if statement's block. If statements can only compare variables.

n:j;l:2.0;b:The input was greater than 2;?:j:>:l:1;p:b (Prints "The input was greater than 2" if the user input was greater than 2)
k Ends the program

Example programs

Hello World:

j:Hello World\n;p:j

Cat program:


Deadfish interpreter:




Bottles of beer:

b:99;c:1;j: bottles of beer on the wall, \n;o: bottles of beer. \nTake one down, pass it around,\n;l:No bottles of beer on the wall!;p:b;p:j;p:b;p:o;s:b:c;?:b:<:c:1;g:13;g:5;p:l;

Interpreter in Ruby

A quickly written interpreter for A:; written in Ruby.

print Dir.pwd
print ">>"
file = File.open(gets.delete("\n"), "rb")
program = file.read
program = program.gsub("\\n","\n")
$stmts = program.split(';')
$stmc = 0
$vars = [0,0,0,0,0,0,0,0,0,0,0,0]
def getAdress(char)
   case char
       when 'j'
       return 0
       when 'l'
       return 1
       when 'b'
       return 2
       when 'o'
       return 3
       when 'c' 
       return 4
       when 'q'
       return 5
       when 'r'
       return 6
       when 't'
       return 7
       when 'u'
       return 8
       when 'v'
       return 9
       when 'w'
       return 10
       when 'x'
       return 11
def run(stmt)
   tokens = stmt.split(':')
   case tokens[0]
       when 'p'
       print $vars[getAdress(tokens[1])]
       when 'i'
       tvar = gets
       $vars[getAdress(tokens[1])] = tvar[0..-2]
       when 'n'
       $vars[getAdress(tokens[1])] = Integer(gets)
       when 'g'
       $stmc = tokens[1].to_f - 1
       when '?'
       case tokens[2]
           when '='
           if $vars[getAdress( tokens[1])].to_s != $vars[getAdress(tokens[3])].to_s
               $stmc = $stmc + tokens[4].to_f
           when '<'
           if $vars[getAdress(tokens[1])].to_f >= $vars[getAdress(tokens[3])].to_f
               $stmc = $stmc + tokens[4].to_f
           when '>'
           if $vars[getAdress(tokens[1])].to_f <= $vars[getAdress(tokens[3])].to_f
               $stmc = $stmc + tokens[4].to_f
       when 'a'
           $vars[getAdress(tokens[1])] = $vars[getAdress(tokens[1])].to_f + $vars[getAdress(tokens[2])].to_f
       when 's'
       $vars[getAdress(tokens[1])] = $vars[getAdress(tokens[1])].to_f - $vars[getAdress(tokens[2])].to_f
       when 'm'
       $vars[getAdress(tokens[1])] = $vars[getAdress(tokens[1])].to_f * $vars[getAdress(tokens[2])].to_f
       when 'd'
       $vars[getAdress(tokens[1])] = $vars[getAdress(tokens[1])].to_f / $vars[getAdress(tokens[2])].to_f
       when 'k'
       $vars[getAdress(tokens[0])]= tokens[1]
while $stmc < $stmts.count
   $stmc = $stmc + 1

There also exists a C interpreter, predominantly because User:Deciode felt like writing some C.