axo
Jump to navigation
Jump to search
axo is a language inspired by Befunge, invented by Jannis Harder in 2004. "axo" is pronounced like the German words "ach so".
The axo interpreter has three modes which have slightly different operation. It uses an unlimited stack, and 2048 memory cells of 32 bit signed integers. Popping from an empty stack produces zero (0).
Command mode
Command | Description |
---|---|
"
|
Switch to string mode. |
'
|
Switch to raw mode. |
^ , < , > , %
|
Change direction to up/left/right/down. |
+ , - , *
|
Pop two values, and push their sum/difference/product. |
/
|
Pop two values, and push their quotient and remainder. |
\
|
Exit program. |
& , |
|
Rotate the stack left/right (pop+enqueue/dequeue+push). |
$
|
Pop a value, and change direction depending on the value mod 4. |
#
|
Pop a value, and skip the next command if the value is zero. |
[
|
Duplicate the top of the stack. |
]
|
Pop a value, and discard it. |
(
|
Pop a value, and print it as an ASCII character to stdout. |
)
|
Read a character from stdin, and push its ASCII value. |
{
|
Pop a value, and print it as a number to stdout. |
}
|
Read one or more lines from stdin, until one contains a signed integer, and push it. |
: , .
|
Pop a value, and store it to register a/b. |
; , ,
|
Push the value in register a/b. |
?
|
Change to a random direction. |
_
|
Go home (goto 0,0 heading right). |
@
|
Empty the stack. |
!
|
Rotate the direction 90° clockwise. |
=
|
Pop two values, read the memory at the first value, push it, and write back the second value. |
~
|
Print debug information to stderr. |
0 -9
|
Pushes the digit. |
Raw mode
Command | Description |
---|---|
'
|
Switch to command mode. |
Any other character pushes its ASCII value.
String mode
Command | Description |
---|---|
"
|
Switch to command mode. |
^ , < , > , %
|
Change direction to up/left/right/down. |
+ , - , *
|
Pop two values, and push their sum/difference/product. |
/
|
Pop two values, and push their quotient and remainder. |
\
|
Exit program. |
$
|
Push value 10 (linebreak). |
Any other character pushes its ASCII value.
External resources
- Original interpreter (from the Wayback Machine; retrieved on 8 August 2007) by Jannis Harder, written in C99 (very buggy).
- Working interpreter (from the Wayback Machine; retrieved on 23 April 2007) by Jannis Harder, written in C++.
- axo programs (from the Wayback Machine; retrieved on 13 June 2007) by Jannis Harder
- 99 bottles of beer in axo