Next: 1.4 Interpreter recursion
Up: 1. Onyx Language Reference
Previous: 1.2 Syntax
  Contents
  Index
Stacks in Onyx are the core data structure that programs act on. Stacks store
objects in a last in, first out (LIFO) order. Onyx includes a number of
operators that manipulate stacks.
Each Onyx thread has four program-visible stacks associated with it:
- Operand stack (ostack):
- Most direct object manipulations are done using
the operand stack. Operators use the operand stack for inputs and
outputs, and code generally uses the operand stack for a place to store
objects as they are being manipulated.
- Dictionary stack (dstack):
- The dictionary stack is used for looking up
names. Each thread starts with with four dictionaries on its dictionary
stack, which are, from top to bottom:
- userdict
- globaldict
- systemdict
- threaddict
The dictionary stack is manipulated via the
begin and
end operators. The initial
dictionaries on the dictionary stack cannot be removed.
- Execution stack (estack):
- The interpreter uses the execution stack to
store objects that are being executed. The application generally does
not need to explicitly manipulate the execution stack, but its contents
are accessible, mainly for debugging purposes.
- Index stack (istack):
- The interpreter uses the index stack to store
execution offsets for arrays that are being executed. There is a one to
one correspondence of the elements of the execution stack to the
elements of the index stack, even though the elements of the index stack
that do not correspond to arrays have no meaning. The index stack does
not affect execution, and exists purely to allow useful execution stack
traces when errors occur.
The application can also create additional stacks and manipulate them in much
the same way as the operand stack can be manipulated.
Next: 1.4 Interpreter recursion
Up: 1. Onyx Language Reference
Previous: 1.2 Syntax
  Contents
  Index
Jason Evans
2002-03-30