From Esolang
Jump to: navigation, search

This is a string oriented code golf language. It is good for challenges similar to "99 Bottles of Beer" (hence its name).


// Line 1: String declarations, separated with spaces, all on one line, single character names.
a="bottle" b="of beer" c="on the wall"
// All lines after this are loops and/or statements
// Loop line 1: The loop specifications: count from, count to, variable name
99 2 i
// Loop line 2: The string with substitutions to output. Arithmetic can be performed on the variable
%i %as %b %c, %i $as $b,\nTake one down and pass it around, %{i-1} %as %b %c.\n
// Statement: starts with a semicolon, can include substitutions
;1 %a %b %c, 1 %a %b,\nGo to the store and buy some more, 99 %as %b $c\n
//End of program is a colon

Infinite loops are created by putting just the name of a variable on a line, for example:


counts infinitely.

You can optionally make infinite loops with braces. Assignments are supported on separate lines.

String and integer variables are supported. Maybe more depending on implementation.

Input is received via the > command, as in >a to input to a. Strings are not automatically coerced to integers, you need the operator i for that. Example:


Variable names are always one letter long.

The ) instructions jumps to the beginning of the block if the variable specified is not equal to 0 or "" (empty). Example:


Blocks are delimited with braces: { }. Fibonacci example: (A statement by itself on a line is printed)

Statements are separated by semicolons (;), a literal semicolon is represented by \;.

j=0 k=1 l=0
i {
    l=j; j=k; k=${l+k}

Turing complete

The language is Turing complete because of the ) operator.

Golfed example

a=" bottle" b=" of beer" c=" on the wall"
99 2 i
%i%as%b%c, %i$as$b,\nTake one down and pass it around, %{i-1}%as%b%c.\n
;1%a%b%c, 1%a%b,\nGo to the store and buy some more, 99%as%b%c\n:

Total: 186 characters