Implementing the Evaluator
A traditional stack ADT has the following
operations:
- Make: return a new, empty stack
- Push: add an item to the top of a stack
- Pop: remove an item from the top of a
stack
- Empty?: return whether a stack is empty
This ADT limits all accesses to the top of
the stack only. We will extend this ADT to
also allow inspection of the stack anywhere
in its interior:
- Top-minus offset: return the stack
element that is offset elements down
from the top.
Note that any modification of the stack
is done at the top by Push or Pop.
This ADT is called a Random Access Stack, or
RA-stack.