Uxntal stacks
In concatenative programming, there are no precedence rules, the calculations are merely performed in the sequence in which they are presented. The order with which elements come off a stack is known as last in, first out. In the stack a b c, the c item was the last to be added, and will be the first to be removed.
#01 #02 #03 ADD01 05
All programming in Unxtal is done by manipulating the working stack, and return stack. Each stack contains 255 bytes, items from one stack can be moved into the other. Here are some stack primitives and their effect:
POP | a b | Discard top item. |
---|---|---|
NIP | a c | Discard second item. |
SWP | a c b | Move second item to top. |
ROT | b c a | Move third item to top. |
DUP | a b c c | Copy top item. |
OVR | a b c b | Copy second item to top. |
A byte is a number between 0-255(256 values), a short is made of two bytes, each byte in a short can be manipulated individually:
#0a #0b POP 0a #12 #3456 NIP 12 56 #1234 DUP 12 34 34