F Code

Using the Stack. The F code performs mathematical and string processing operations on constants or on data stored in specified attributes. F correlatives are made up of operands and operators in reverse Polish notation (Lukasiewicz high Polish) separated by semicolons. Unlike the A code, the F code cannot use dictionary names to reference attributes.

Format

F [;] element [;element ;…]

Parameter(s)

element

Can be any of these expressions:

expression

Can be one or more arithmetic or relational operators which operate on any of these operands:

attributes

Specified either by attribute number (AMC) or by attribute name.

literals

Appear in single or double quotes.

system variables

 

functions

 

INFO/ACCESS parses the expression from left to right, putting each element on the stack as an operand until it encounters an operator. The operation is then performed. Exceptions are described in the following topics:

Referencing Attributes

Numeric Constants

Arithmetic Operators

Relational Operators

Applying Conversion Codes

Special Function Codes

Description

The F code performs operations on the last one or two entries pushed onto a stack. The result of the operation is placed at the top of the stack.

The three figures which follow illustrate the way the stack processes elements pushed onto it by the F correlative in this command line:

F ; C3 ; C4 ; C5 ; * ; + ; C6 ; –

This example uses only constants and operators; it is intended only to show how stack operations are performed. Each figure shows what happens when one of the operators is pushed onto the stack.

In the illustration below, three elements are placed on the stack. The multiplication operator acts on the top two elements, placing the result of 20 on top of the stack. Notice that the result replaces the two operands.

In the illustration below, the addition operator acts on the two elements in the stack, 3 and 20. The result, 23, is pushed onto the stack.

In the illustration below, the subtraction operator causes the top element in the stack, 6, to be subtracted from the second element, 23. At the end of these operations, the result, 17, is the only element remaining in the stack.

See Also

Performing Arithmetic Operations

A Code