[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnubol: Nested Conditionals, Extensions and Warnings
At 05:52 12/3/99 , Tim Josling wrote:
>For example, I decided to allow the paragraph name to be omitted (with
>warning)
>at the start of a section, or at the start of the procedure division,
>because IBM
>allows this. It took me 90 minutes last night to get this working; at one
>stage I
>was on the point of giving up.
COBOL-20XX, allows the procedure division or any section to begin without a
paragraph name. I'm no expert in writing grammar, but it seems to me that
should be easy to implement, except for providing the warning.
This brings up a question: Do we need to warn extensions to COBOL-85 if
the code is valid in the draft? I say we don't -- what purpose would be
served?
At 12:13 12/3/99 , William M. Klein wrote:
>ON THE OTHER HAND, as I am not one of the people who will be (can be with the
>"holes" in my technical knowledge) "building" the actual parser, if someone
>convinces me that it is MUCH CLEANER to allow for the nested conditionals,
>then I will "shut up" (well knowing me, make that "be a little more quiet"
><G>)
Nested conditionals will still be an extension in the standard, and
therefore they should get warnings.
At 16:00 12/4/99 , William M. Klein wrote:
>3) The following *IS* illegal
>
> If A = B
> Add 1 to A
> On Size Error
> Add 1 to B
> On Size Error
> Display "illegal"
> Else
> Display "It's a no-no"
> .
>
>because the 2nd add is STILL a conditional (where an imperative is required)
I'm with you so far.
>and that even adding a SINGLE "END-ADD" before the Else wouldn't solve the
>problem *IF* it were matched with the 1st nested IF (not the 2nd - which is
>what would happen by the "implicit scope terminator rule).
You just lost me. If we add END-ADD before the ELSE, the 2nd ADD is
imperative, the 1st ADD is conditional but implicitly terminated by ELSE.
Re Various stuff about SEARCH/EVALUATE:
I don't understand the issue.
SEARCH
WHEN
EVALUATE
WHEN
WHEN
is analogous to
ADD
SIZE ERROR
SUBTRACT
NOT SIZE ERROR
The rule (explicitly stated in the draft) is that the conditional phrase
binds to the most recent antecedent that could use that phrase, regardless
of what comes after.
At 09:38 12/3/99 , William M. Klein wrote:
>1) The "after" variation of VARYING (i.e. handling of more than one level of
>VARYING) is explicitly DIS-allowed for inline PERFORMs. Most (but not all)
>compilers enforce this strictly. FYI, this rule/restriction will be removed
>in the next Revision, so it would be a "nice" extension to allow it.
Really? What an odd restriction. Any idea why?
>2) END-PERFORM is indeed unique in that it is REQUIRED for inline PERFORMs
>and PROHIBITED for out-of-line PERFORMs. Again, Micro Focus has a documented
>extension (also flagged) that allows it to be omitted for SOME inline
>performs, but this is NOT something that I would suggest doing. (No-one that
>I know of allows it for an out-of-line PERFORM.)
I think some early COBOL-85 compilers allowed optional END-PERFORM on
out-of-line PERFORM, because the standard implied it was allowed. The
correction amendment fixed this. We CAN'T allow it, because it's
ambiguous, eg,
PERFORM 3 TIMES
ADD 1 TO X
PERFORM THIS-PARAGRAPH
END-PERFORM
PERFORM THAT-PARAGRAPH
END-PERFORM
At 16:00 12/3/99 , Michael McKernan wrote:
>Oops! There I go creating extensions again. My grammar permits
>unlimited repetitions of the VARYING phrase by virtue of this element
>which appears in two places in the main rule.
>
> ( varying_phrase )+
Actually the second and subsequent phrases are introduced by the key word
AFTER instead of VARYING.
--
RB |\ Randall Bart
aa |/ Barticus@usa.net 1-818-985-3259 Barticus@att.net
nr |\ 8321 Burnet Av #1, North Hills, CA 91343
dt ||\ Computer Programmer since 1972
a |/ I Love You 12 years Unisys/Burroughs experience
l |\ MS^7=6/28/107 Will work for paycheck
l |/ DOT-HS-808-065 http://users.aol.com/PanicYr00/RBResume.html
--
This message was sent through the gnu-cobol mailing list. To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body. For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.