99 (Esolang)

From Esolang
Jump to navigation Jump to search
Not to be confused with 99 (Joke language).
The title of this language is normally italicised.

99 is an imperative esoteric programming language with only one literal, 9. The language only relies on 3 characters - Spaces, newlines, and the number 9 - making it similar to the Whitespace programming language. Other characters are always ignored.

The language was created solely for the purpose of creating an interpreter for in PPCG, and its specification was written by PPCG user Calvin's Hobbies. The name might be inspired by 99 bottles of beer.

Specification

Programs written in 99 are always written in one or more lines. Each of these lines are statements, and imply a command. These lines is excecuted from top to bottom. If not a nop, each line should have at least one continuous string of adjacent nines. The command depends on the format of the line.

Variables

A continuous string of nines is called a variable. When the program initializes, all variables will have the same value as their name. Hence, 999 will have the value of 999. Variables are also mutable, meaning they can be reassigned.

In the following table, variables are signified by V. Their values will also be signified by V.

Commands
Command Function Structure Example
Nop Do nothing when there is nothing.

Mainly used for Goto statements and comments.

Output Outputs a value if there is only one variable.

If the variable has an odd number of digits, V/9 will be output.

If the variable has an even number of digits, the ASCII character with the exact same ASCII value as V/9 % 128 will be output.

V
9

Prints 1

99

Prints a vertical tab, which has an ASCII code of 11 (It is unprintable on most computers)

Input Inputs a value if there is only one variable with a leading space.

If the variable has an odd number of digits, its value will be set to the input integer times 9.

If the variable has an even number of digits, the ASCII value of the input ASCII character times 9 will be input.

 V
Assignment Assigns a value to the first variable if there are multiple variables on the line.

The first variable will be the sum of every alternate variables subtracted by the rest. In other words, V = V - V + V - V + V - V +....

V V V V V V...
999 9 9 99

Sets 999 to 9 - 9 + 99, which is 99

Goto If all variables except the first one is zero, jump to the line with the index equal to the first variable if there are multiple variables on the line with a leading space.

This behaves like a nop if the other variables are not zero. The program terminates if the first variable is a negative number or a number bigger than the highest possible index.

Line indexing is 0-indexed.

 V V V V V V...
 9 9 9
  9 9 9

First sets 9 to 9 - 9 = 0, then goes to the 0th line, effectively creating an infinite loop.

Examples

Hello world

999 9 9
99 99999999 999 9
99
99 99999 9 999 9
99
99 99 999 999999
99
99
99 9999999 9999 999 9
99
99 99 9999999 9 999 9 999 9 999 9
99
99 99 999999 9 999999 9
99
9999
99 99999 999 999999 999 9
99
99 9999999 9999 9 999 9
99
99 99 999999 9
99
99 99 999999 999 9
99
99 99999 9999999 9
99

This program eventually prints every character in the string "Hello, World!" individually.

External resources