The language itself, which is typically interpreted, is stack-based in the same manner as an RPN calculator. A program pushes arguments to an operator onto a stack and then invokes the operator. Typically, the operator will have some result which is left at the top of the stack. As an example, let us say we want to multiply 12 and 134. We would use the following PostScript code:
12 134 mul
The first two words '12' and '134' push the numbers 12 and 134 onto the stack. 'mul' invokes the multiply operator which pops two values off the stack, multiplies them, and then pushes the result back onto the stack. The resulting value can be left there to be used by another operator later in the program.
To follow the conventions used by Adobe in their manuals, I will synopsize operators using the following scheme: arg-1 arg-2 ... operator result. This scheme means that, to use operator, you must push arguments arg-1, arg-2, and so on before invoking the operator. operator will return the result: result. Many operators return no result (they have some side-effect); these will be shown as returning '-'.
[ Main Page ] [ Next Page ]