Instruction manual

USER GROUP NEWS
Issue 3 - Vol 2
MDP
PRODUCT
INFORMATION
BROAD
BUT
NOT
A
LHvIITING
LIBRARY
SET
LIBRARY
ELEMENTS
MAY
BE
EASILY
REPLACED
WITH
ELEMENTS
~10RE
FOCUSED
ON
THE
NEEDS
OF
THE
PROJECT.
The following text describes the
Rational
language interface to the
Modular
Development
Language.
RATIONAL
LANGUAGE
DESCRIPTION
Rational
is
MDL/u
except for one aspect. Since control
flow
is
central to any program, regardless of the
specific application, the primary task for
Rational
is
to conceal this
part
of
MDL/u
from
the
user, by producing
decent control
flow
structure.
THE
IF
STATEMENT
The
standard
construct.
if
a
condition
is
true,
do
a
group
or
things
for example
if
(x
> 100)
{print"
error: x > 100" ;
err=
I}
can't
be
implemented directly in
MDL/u.
Instead a programmer
must
translate this relatively clean
thought
into
MDL/u
as
follows:
10
IF
(NOT
(x
> 100))
THEN
40
20
PRINT"
ERROR: x > 100"
30
err = 1
40
When a program doesn't work, or when
it
must
be modified, this must be translated back into a clearer form
before one can
be
sure what it does.
RATIONAL
eliminates this error-prone back-and-forth translation. A group of
statements
can be
treated
as a
unit by enclosing them in
braces"
{"
and"}"
in
Rational.
This
is
true throughout
Rational:
wherever a single
statement
may
be
used, there can be several enclosed braces.
Rational
is
a tree
tormat
language: statements may appear anywhere on a line, and several may appear on one
line if they are separated by a semicolon.
THE
ELS
E CLAUSE
Rational
provides an
else
statement
to handle the construct
ir
a
condition
is
true,
do
this
thing,
otherwise
do
that
thing.
if
(a<b)
{sw=O;
print
a,
b}
else
{sw=l;
print
b,a}
This writes
out
the smaller of a and
b,
then the larger, and sets
sw
appropriately. The syntax
ot
the if
statement
IS
if (legal
MDL/u
condition)
Rational
statement
else
Rational
statement
where the else
part
is
optional.
December 1983
TEKTRONIX
5