Web pdp-10.trailing-edge.com

Trailing-Edge - PDP-10 Archives - steco_19840320_1er_E35 - 10,5676/teco/manual/tecexp.rnm
There is 1 other file named tecexp.rnm in the archive. Click here to see a list.
```.Chapter Expressions
.hl1 Introduction
Expressions in TECO do not follow the normal rules for evaluation.  That
is the expression 2+1*3 does not have the same result in FORTRAN as it does
in TECO.  This chapter will explain how expressions in TECO differ from
those found in the normal programming languages (FORTRAN, BASIC, etc.).
.hl1 Evaluation
Expressions are evaluated from left to right in TECO.  That is
the expression 2+1*3 will first do the addition and then the multiplication.
The result of this expression is 9, while programming languages like
FORTRAN would produce the result of 5.  If the user wishes to override the
normal evaluation the user can enclose the expression in parentheses that
is to be evaluated first.  An example of this is the expression 2+(1*3)
will cause the 1*3 to be evaluated first then 2 will be added to the result
of the multiplication.
.hl1 Operators
TECO contains the normal addition, subtraction, division and multiplication
operators.  Additionally it has operators for logical AND and logical OR.
An operator may appear between any two values.
.note BEWARE
A common user error is to have a unary minus after some command
that returned a value.  That is a command that returned either
a true or false value.  TECO will cause the minus to become a
subtraction instead of the unary operator because of the returned value.
.end note
The addition operator in TECO is the plus sign, "+".  The operator
must appear between two values.
.hl2 Unary plus
The unary plus operator in TECO is the plus sign, "+".  The operator must
appear before a single value to be considered the unary operator.
.hl2 Subtraction
The subtraction operator in TECO is the minus sign, "_-".  The operator
appears between two values.  If the operator is before an operator then it
is not a subtraction operator, but the unary minus operator.
.hl2 Unary minus
.hl2 Division
.hl2 Multiplication
.hl2 Logical AND
.hl2 Logical OR
.hl2 Parentheses
.HL1 Values
.hl2 Numerics
.hl3 Decimal
.hl3 Octal
.hl2 Strings
.hl2 Q-registers
```