Ozone
Ozone is an stack-based language created by User:Set. Program flow in Ozone is controlled by the mechanism of spawning new stacks, copying them, and executing.
Language Overview
An Ozone program is a set of characters that will be pushed onto stack 0 and set to execute when the program is run. All stacks initialize to (0), and when the last item on a stack is popped, it will go back to (0).
Parentheses are used around the lists. For example (100,52,8) would be a valid list. For ease of programming, lists are pushed onto the stack beginning with the last item, so that you don't have to write everything backwards. Within a list, angles are used around sets of characters. So (1,<Hello World>,7) would be a valid list.
Command | Description |
---|---|
s*
|
Spawn new stack numbered * |
v*() or *2
|
Push list onto stack *. If () is given, use that, if *2 is given, use that stack as the list. |
e*
|
Execute stack *. This will interpret the top item as a command, then pop it and continue all the way through the stack. |
c*
|
Displays the top of stack * as an ASCII character |
n*
|
Display top of stack * as a number |
p*
|
Pop item at top of stack * |
u*
|
Increment stack * |
d*
|
Decrement stack * |
+*
|
Pops stack * and adds |
-*
|
Pops stack * and subtracts |
**
|
Pops stack * and multiplies |
/*
|
Pops stack * and integer divides |
i*
|
Accept a character of input and direct to stack * |
b*
|
Break (stop executing and clear stack) if stack * is <= 0 |
[n*] can be substituted in anything. It will be interpreted as the value of stack *. Stacks can push lists onto themselves, where they will appear right after the command that did that.
Examples
These examples may have bugs in them, since there isn't an interpreter to test them with.
Hello, World!
This will output "Hello, World!"
Easily-readable w/comments:
(s1v1(<Hello, World!>) |Push the string "Hello, World!" onto stack 1 s2v2(< |Begin pushing a list onto stack 2 c1p1 |Print stack 1 and pop b1v02>) |Break if 0, push stack 2 onto stack 0, end list v02) |Push stack 2 onto stack 0
Fibonacci
This will output the Fibonacci sequence.
Standard:
(s1v1(1)n1n1s2v21v21s3v3(<+2n2v12+1n1v21v03>)v03)
Easily-readable w/comments:
(s1v1(1)n1n1 |Push 1 onto stack 1 and print twice s2v21v21 |Push stack 1 onto stack 2 twice s3v3 |Begin pushing a list onto stack 3 (<+2n2 |Add stack 2 and display v12 |Push stack 2 onto stack 1 +1n1 |Add stack 1 and display v21 |Push stack 1 onto stack 2 v03>) |Push stack 3 onto stack 0, end list v03) |Push stack 3 onto stack 0
Everything else
The author thinks this language is Turing-complete, but has no current proof. Currently, there is no interpreter, since the author does not know how to implement one.