[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PERFORM token (was RE: gnubol: Hacks needed to parse COBOL



>>>>> "Bob" == RKRayhawk  <RKRayhawk@aol.com>
>>>>> wrote the following on Fri, 3 Dec 1999 11:40:35 EST

      <snip>

  Bob> This also brings up my favorite subject.  What if the code
  Bob> violates the rule, by say way to many sub-clauses. Will not
  Bob> the error cause the optimistic rules that hard workers have so
  Bob> generously posted to loose control? In the case of an inline
  Bob> perform are we not then in great jeopardy of misinterpreting
  Bob> subsequent code? This exact location in the parse rules also
  Bob> presents an intriguing error possibility.

  Bob> In compilers I have seen, the END-PERFORM is required on the
  Bob> inline perform, but is actually wrong on out-of-line
  Bob> performs. I defy anyone to detect that correctly. Since rules
  Bob> have to be concurrently scoped, any out-of-line perform can
  Bob> quite possibly be scoped internnaly to an inline perform. If
  Bob> you attempt to trap the END-PERFORM on the end of the
  Bob> out-of-line perform where it does not belong, then you swallow
  Bob> the outer inline perform's explicit scope
  Bob> terminator. Consequently spurious END-PERFORM tokens seem
  Bob> destined to fly high into the upper rule hierarchy.

OK, I get the idea, but I still can't share your sense of dread over
it.  The END-PERFORM is no more a part of the syntax of an
out-of-line PERFORM than END-EVALUATE is.  Sure, a containing in-line
PERFORM will be terminated.  Then we'll continue to parse some more
statements that should have been in the loop or whatever.
Eventually, we'll get to an END-PERFORM that can't be accepted and
we'll diagnose it.  In the unlikely case that the programmer has
applied an END-PERFORM to his out-of-line PERFORM, and omitted the
one for the containing in-line PERFORM, he has made a programming
error, but he has written a legitimate COBOL program.

Where's the problem?

Best regards,

Mike



--
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.