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

[GNU-COBOL] Yet Another Grammar question



Here's another one for the COBOL gurus...

Okay, my next grammar question concerns my interpretation of the
definition of "imperative statement".

First, the standard (page IV-39) says:
An imperative statement begins with an imperative verb and specifies an
unconditional action to be taken by the object program or is a
conditional statement that is delimited by its explicit scope terminator
(delimited scope statement).

Is this saying that only the conditional statement is delimited by a
scope terminator, or is it that both imperatives and conditionals are
delimited?

Second, the standard on the same page says:
An imperative statement may consist of a sequence of imperative
statements, each possibly separated from the next by a separator.

What, then, is the difference between a statement and a sentence?  Does
a sentence in this case require a separator?  Is the separator above
necessarily a period, or does it also include END-ADD and such?

Third, I read the rest of this section to say that if we have nested
imperatives, such as:

ADD 5 TO FOO
	ON SIZE ERROR ADD 3 TO BAR

But, if the answer to my first question is, no, we don't need a closing
delimiter, and since and "imperative statement" can be more than one
statement, how would we differentiate between more imperative statements
and those that should logically follow the original ADD?

For example, how do we interpret:

ADD 5 TO FOO
	ON SIZE ERROR ADD 3 TO BAR
		      ACCEPT BAZ
                      ADD 9 TO OTHER

Based on this ambiguity, I'm inclined to believe that some kind of
delimiter is required at the end of the "imperative statement".

But, since "NOT ON SIZE ERROR" cannot occur within one of the nested
ADDs, we can write the following without any ambiguity or explicit
delimiters on the "imperative statement":

ADD 5 TO FOO
	ON SIZE ERROR ADD 3 TO BAR
		      ACCEPT BAZ
                      ADD 9 TO OTHER
	NOT ON SIZE ERROR PERFORM SOME-PAR

I am at a loss as to how to interpret the standard in this matter.  Does
anyone have an idea as to the correct interpretation?

Thanks!
laura
--
Laura Tweedy .. ltweedy@bellatlantic.net

--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@acm.cs.umr.edu with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@acm.cs.umr.edu.