Intel AEDIT-86 Life Jacket User Manual


 
AEDIT -86 User's Guide
CALC
Command
7.6
Expression Evaluation
Operators
in
the
CALC
command have an implied order that determines how operands
and
operators
are
grouped
and
evaluated.
Table
7-1
lists
the
CALC
command
operators from highest
to
lowest precedence (i.e.,
those
that
take
effect first
are
listed first).
Operators
in
the
same
line
are
of
equal
precedence.
The
evaluation order is
the
same
as
that
used
in
most programming languages.
It
is
controlled first by parentheses,
then
by operator precedence,
and
finalJy by
operator
associativity.
The
CALC
command
first evaluates operands and operators enclosed
in paired parentheses
as
subexpressions, working from innermost to outermost paren-
theses pairs.
The
value
of
the
sUbexpression
is
then used as an operand
in
the
remain-
der
of
the
expression.
The
precedence
and
associativity rules are demonstrates by the following examples:
01
+
n2
* n3
**
-
n4
is equivalent
to
01 +
(n2
*
(n3
**
(-n4»)
n 1
SHR
3 ::> n2
SHL
n7 + 4 * #2
is equivalent to
(nl
SHR
3) ::>
(n2
SHL
(n7 + (4 *
(#2»»
02
+ 3 < > n4 - 5 & n4 - 2 = = n5
is equivalent to
«n2
+
3)
< >
(n4
-
&
«n4
- 2)
==
n5)
7.7
Examples
See
also
Chapter
8 on Advanced
AEDIT-86
Usage for examples using the
CALC
command.
7.7.1 Example 1
S3
The
value
of
the
S-variab]e S3 is displayed at the message line;
no
assignment.
7.7.2
Example 2
nl
= n ( n ( n2 = 2 * n3) )
Assuming
that
N3
contains 3
and
N6
contains
8,
and all other N-\'ariables
are
zero.
Then
2 *
N3
=
6;
therefore,
N2
gets 6,
and
N6
is the index for the
"outer"
N
(because
N
(6)
is equivalent to
N6,
thus
giving
Nt
= N
(N6».
N6
contains
8;
thus
N 1 =
N8.
Because
N8
contains zero, N 1 gets this value
(0),
and
0 is displayed on
the
message line.
7.8
Errors
The
following messages
are
issued under the
CALC
command.
When
an
error
is
detected,
the
corresponding
error
message is displayed on
the
MESSAGE
line,
followed by a portion
of
the
command
where
the
error
was detected.
7-5