Stack architecture: Instructions and operands are implicitly taken from the stack. A stack cannot be accessed randomly.
Stack machines use one- and zero- operand instructions. All instructions implicitly operate on elements at the top of the stack.
Push XandPop Xinstructions require a single memory address operand.- Binary instructions (such as
Add,Mult) use the top two items in the stack.
When working with stack architectures, arithmetic expressions should be structured with postfix notation ( as opposed to infix notation, ).
Parentheses are not needed to find order of operations, can be represented as in postfix notation, and could generate instructions such as:
Push X
Push Y
Mult
Push W
Push U
Mult
Add
Pop Z
The result of each binary operation is stored at the top of the stack.