beautypg.com

Interpreter operation, Operand stack – AMT Datasouth PAL User Manual

Page 10

background image

4

PAL Language Reference

PAL requires the user to separate each object with at least one of the preceeding whitespace
characters, or one of the following special characters.

Character

Description

Octal
Code

Hexadecimal
Code

(

Left/Open Parenthesis

050

28

)

Right/Close Parenthesis

051

29

<

Left/Open Angle Bracket or Less Than

074

3C

>

Right/Close Angle Bracket or Greater Than

076

3E

[

Left/Open Square Bracket

133

5B

]

Right/Close Square Bracket

135

5D

{

Left/Open Brace

173

7B

}

Right/Close Brace

175

7D

/

Forward Slash

057

2F

%

Percent

045

25

The special characters listed above each have a special meaning for PAL. The user should only use
one or more of these characters to separate objects when the user also wishes PAL to perform the
action associated with the character.

2.4.

Interpreter Operation

Normally the PAL interpreter performs a function in response to each object received. For data
objects, PAL usually just stores the object within the printer's memory. Executable objects instruct
PAL to perform some operation. The operation usually involves one or more of the data objects
previously received.

The interpreter immediately performs the appropriate function for each object upon receipt of the
object. However, PAL does not consider an object fully received until it receives the separation
character which follows the object. Therefore, if the host computer sends the printer a command
without following the command with a space or other separation character, the printer will not
respond to the command until it receives the separation character. Until PAL receives the
separation character, PAL cannot know for sure whether or not it has received all the characters of
the object.

2.5.

Operand Stack

As PAL receives data objects from the host, it pushes the objects onto an internal structure known
as the operand stack. PAL places each successive object on top of the previous object on this stack
of objects. As long as the interpreter continues to receive data objects, it will continue pushing the
objects onto this stack.

When PAL receives an object which indicates some action for the interpreter to perform, the action
will usually involve zero or more data objects know as operands or parameters. For example, a div
(divide) operation requires two operands — the divisor and the dividend. In order to perform the
operation, PAL pops the top two operands off the operand stack. It then divides one operand by
the other operand in order to calculate the quotient. PAL then pushes the quotient onto the operand
stack.