PostScript uses a postfix interpreter which means that operands are pushed onto a stack and the operators pop a certain number of operands off when they are called (Foley, et al, 1992). This is a big change from other programming languages, you have to remember that the operands are placed before the operator and that the operands are in reverse order.
PostScript has the standard data types as well as the flow- of-control operators, so it can perform most of the tasks that languages like C or Pascal can handle.
The PostScript language provides a unique data structure known as a dictionary. A dictionary is a structure in which are stored key-value pairs, where the key and the value can be any valid PostScript language objects. Presenting a key to the PostScript interpreter will cause it to perform a name lookup, and execute the resulting object found in the dictionary. This mechanism provides an extremely flexible foundation for the language. New procedures can easily be created, and existing operator names can be redefined.
The PostScript language also provides several other standard data structures :
All of these data types are maintained as PostScript objects, which are manipulated on the operand stack. A dictionary can contain any of these data types as a value. The notion of a variable usually means a dictionary entry in the PostScript language.
A PostScript dictionary is the only way to store PostScript objects for later recall ( other than leaving a reference to them on the operand stack ). The standard operator for making a dictionary entry is the def operator, which makes a definition in the current dictionary. This mechanism is used for conventional purposes such as defining and using variables or procedures, but it can also be used for more complex data structures. ( PostScript Language Program Design, Adobe Systems Incorporated, Addison-Wesley Publishing, 1988 )
The PostScript language is stack-based so that a program can be evaluate with very low overhead in processing and storage. Each instruction can be acted upon immediately, without the need to buffer large amounts of the program.
PostScript is interpreted rather than compiled. The most obvious reason is device independence. If the program remains in source form until it reaches its final destination, it is extremely portable to new computer environments, processor, etc. Also, it is an interpreted language because documents are often transmitted long distances, archived, or saved and printed many times, and this enables the documents to remain in ASCII text source form for better life expectancy and resiliency in a device-independent environment.
The program is usually structured in two parts (Adobe 1990):
The prolog contains the definitions of any procedures the application uses in the script and is included as the first part of a PostScript file.
The script describes the specific elements of each page to be produced. This is the section where calls to procedure definitions and PostScript operators are listed. It also includes the necessary operands and data for the program to run.
While this structuring is only a convention, it has many benefits if adhered to. There is also a document structure convention which uses comment information to let PostScript manipulation programs behave more efficiently. The "Special Comments" are like:
Adobe have developed this structure for programming but some PostScript manipulation/generation programs still do not follow these well thought out structuring conventions. One noticeble program is Microsoft Word. Although some programs do not follow these structuring conventions, the output from these programs are similar.
Dividing the program up in this manner allows the size of each page description to be decreased, which reduces the size of the file and hence the transmission time.
PostScript is also useful as an interchange format. PostScript programs can be created and interpreted as ASCII files. This allows the storage and transmission of these files between different computers and operating systems (Adobe 1990).
PostScript views all graphical entities as being the same (Foley, et al, 1992). This means that a line, an arc, a string of text, and a sampled image, can all be manipulated by exactly the same operators. A seperate operator is not necessary to rotate text 45 degrees and a box by 45 degrees. Translation, rotation and scaling are controlled by one operator each, which makes it easier to remember how to perform each operation.