A
A is a programming language that uses only the letter A in its source code. Its creation year is uncertain but no later than 2008.
Description
A program with less than 8 As is interpreted as a single command in Brainfuck as follows:
Number of As | Brainfuck | Description |
---|---|---|
0 | > | Move the pointer to the right |
1 | < | Move the pointer to the left |
2 | + | Increment the memory cell under the pointer |
3 | - | Decrement the memory cell under the pointer |
4 | . | Output the character signified by the cell at the pointer |
5 | , | Input a character and store it in the cell at the pointer |
6 | [ | Jump past the matching ] if the cell under the pointer is 0
|
7 | ] | Jump back to the matching [ if the cell under the pointer is nonzero
|
If a program has 8 or more As, the program is interpreted recursively by taking the command corresponding to the remainder when the number of As is divided by 8, and appending it to the program corresponding to a string of As of length equal to the quotient when the number of As is divided by 8. In other words, the number of As is divided by 8, where the remainder, then the quotient, is interpreted. This has the effect of converting the number of As to base 8, then interpreting each digit from left to right.
Programs in A are constructed similarly to those in Unary, albeit more efficiently. For instance, the cat program written in Brainfuck as ,[.,]
requires only 23855 As (56457 in octal), as opposed to 56623 0s in Unary.
Any program in A has the same length as the corresponding Ellipsis program (in non-compatibility mode); therefore, a program in either language can be converted to the other by a simple text substitution.
See also
External links
- Specification and converter (from the Wayback Machine; retrieved on 19 March 2011)