Stare/1.0

This document lays out the specification for the 1.0 dialect of Stare, a product of the Zodiac Working Group.
== The Stack ==
A Stare stack is a stack of long integers (number of bits depends on what the compiler used to compile the program defines as a long).
== Syntax ==
A Stare program consists of a series of newline-separated lines of one of the following syntaxes:
 =[<list of values>]
 #<ToS>=<instructions>
 _<SoS>=<instructions>
 *=<instructions>
An = line denotes the current stack. It should occur at the very beginning of the program to define the starter stack.
A # line denotes a command executed based on the top of the stack. When the program checks this line, it calls peek(stack) and compares it to the value between the # and the =. If they match, it executes that line.
An _ line works like a # line, but the program compares the number to the size of the stack instead.
A * line is executed no matter what.
A line that starts with any other character is a syntax error in Stare 1.0.
Instructions and lists of values are separated by spaces.
== Instructions ==
Instructions are each single characters with alternative words. They are executed in sequence, making them an imperative sublanguage
Command (single character)	Command (full text)	Action
+ 	ADD 	pop a value called a and a value called b, push b+a
- 	SUB 	push b-a
* 	MULT 	push b*a
/ 	DIV 	push b/a
% 	MOD 	push b%a
! 	NOT 	Pop a, push !a
: 	DUP 	Pop a and push it twice
& 	BWAND 	pop a, pop b, push b&a
| 	BWOR 	a
^ 	BWXOR 	pop a, pop b, push b^a (bitwise xor)
~ 	BWNOT 	pop a, push ~a (bitwise NOT)
\ 	SWAP 	Pop a, pop b, push a, push b
$ 	DROP 	pop a
p(<value>) 	PUSH(<value>) 	push <value> onto the stack
. 	PUTCH 	print(chr(pop a))
, 	GETCH 	push(ord(getch()))
N/A 	PRINTS 	Print a null-terminated string from the stack (the top character being the start of the string)
< 	LT 	Pop a, pop b, push 1 if b<a, else push 0
> 	GT 	Pop a, pop b, push 1 if b>a, else push 0
; 	HALT 	Halt the program
== Execution ==
This section assumes you are interpreting Stare, but can be adapted for compilers.
The Interpreter starts by executing the first line, which generally is an =[] clause and defines the starter stack.
From then on , the Stare interpreter works on a loop, executing the list of expressions in sequence. It starts by peeking at the top of the Stack and getting its length and storing those two values. It then goes through each line (excluding the first), calling its instructions if the conditions are met. The conditions are compared to stored values, so if instruction A is called and changes the stack such that instruction B's condition is met, instruction B will still not be called until the next iteration. This loop continues until the program is explicitly halted.
== Examples ==
Hello World:
 =[0 10 33 100 108 114 111 119 32 44 111 108 108 101 72]
 *=PRINTS HALT
This program starts by creating a stack with the ASCII values of "Hello, World!\n" (null-terminated) on it in the order such that the last character is at the top of the stack (the end of the expression between the brackets.)
It then executes a line (which is executed no matter what) that prints out that string (popping it from the stack in the process) and then stops the program. Simple!