Oxon
Jump to navigation
Jump to search
Oxon is an esoteric programming language. Programs written in it have to use the source code for memory, making Oxon Self-modifying.
When a program is run, a copy is made of that program, which is what is executed. The original program stays unchanged.
Language
Data types
| Data type | How to write |
|---|---|
| Integer | ( ) |
| String | " " |
| String at program line | * * |
There are 3 different ways of representing information in Oxon:
- (x) - interprets x as an integer
- "x" - interprets x as a string
- *x* - Interprets the contents of line x of the program as a number, if only containing numerical characters, else interpret as a string
Commands
In Oxon, every program line begins with a command, followed occasionally by reporters and arguments. The commands available are:
| Command | What it does |
|---|---|
| P | Prints argument A on a new line. If A is a number, print the ASCII character corresponding to that number. |
| W | Writes argument A to program line B. |
| F | If argument A is equal to argument B, go to program line C. |
| E | Stops program. |
Reporters
Likewise, these are the reporters available:
| Reporter | What it does |
|---|---|
| A | Takes arguments A and B. if they are both numbers, add them. If they are both strings, join them. |
| S | Takes arguments A and B. if they are both numbers, subtract them. |
| I | Takes user input. No arguments. |
Comments
Comments are represented by text inside square brackets - [text]
Examples
Cat
PI
Truth machine
F(I)(1)(4) P"0" E P"1" F(1)(1)(4)
Calculator
Type the first number, then the second number, then the operation to do. It can add, subtract, and multiply.
[First number of input]
[Second number of input]
[Operation to perform]
[Number used for multiplying]
W(I)(1)
W(I)(2)
W(I)(3)
F(*3*)("+")(12)
F(*3*)("*")(14)
F(*3*)("-")(20)
E
PA(*1*)(*2*)
E
WA(*2*)(*4*)(4)
WS(*1*)(1)(1)
F*1*(0)(18)
F(1)(1)(14)
P*4*
E
PS(*1*)(*2*)
E
99 bottles of beer on the wall
W"99"(11) PA*11*" bottles of beer on the wall," PA*11*" bottles of beer!" P"Take one down, pass it around," FS(*11*)(1)(0)(9) WS(*11*)(1)(11) PA*11*" bottles of beer on the wall!" F(1)(1)(2) P"No more bottles of beer on the wall!" E [Number for how many bottles of beer goes here.]