This double meaning of =, together with the absence of reserved words
makes PL/1 parsing extremely hard. Consider for example
IF (1) = (2);
now what does that mean?
Given a declaration
DCL IF (25) BIN FIXED (31);
that is, if IF is an array of integers, the "IF" statement above is a
valid assignment
of 2 to the array element 1. The PL/1 compiler does not know that the
statement
above is no IF statement before it encounters the semicolon; before that
it has
to consider both possibilities ... this is completely different from
most other
languages (only Fortran has similar issues).
I always thought that nobody would be as silly as to name his or her
identifiers IF,
but then I observed a program containing the following:
DCL IA BIN FIXED (15) /* index for TABA */
DCL IB BIN FIXED (15) /* index for TABB */
DCL IC BIN FIXED (15) /* index for TABC */
DCL ID BIN FIXED (15) /* index for TABD */
DCL IE BIN FIXED (15) /* index for TABE */
DCL IF BIN FIXED (15) /* index for TABF */
the coder probably didn't even notice the use of IF as variable name :-))
Long live PL/1 :-)))
Kind regards
Bernd
Am 16.07.2019 um 20:04 schrieb Seymour J Metz:
One of the things that I liked about Algol was that "=" was always a comparison operator; assignment was
":=". But even in PL/I that particular error is impossible: the "=" in "IF foo=bar" can
never be interpreted as assignment.
--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN