[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnubol: subsets
>>>>> "Bob" == RKRayhawk <RKRayhawk@aol.com>
>>>>> wrote the following on Sat, 20 Nov 1999 20:26:04 EST
Bob> In a message dated 11/18/99 8:51:23 AM EST, Michael McKernan
Bob> mck@tivoli.mv.com writes:
Bob> << There was a thread a while back on a similar ... subject,
Bob> when Laura was in the midst of the Russian Armory experiment.
Bob> As I remember it went something like this.
ADD a TO b
ON SIZE
<many statements>
SUBTRACT c from d
ON SIZE
<many more statements>
END ADD
Bob> Now, the SUBTRACT is illegal because it is not an imperative
Bob> statement, not having an END SUBTRACT. The imperative
Bob> statement requirement is the same kind of legalistic
Bob> prohibition. Accepting the fragment as written causes no
Bob> difficulty in parsing, and its meaning is clear, but it
Bob> appears to require an extraordinary effort to diagnose because
Bob> you have to be aware that the SUBTRACT is in the scope of a
Bob> construct that does not allow conditional statements when you
Bob> arrive at the END ADD.
>>>
Bob> I think that I am at long last getting to the END :-) of this
Bob> thing and it looks a whole lot more reasonable to me now. I
Bob> think it is not political at all. A way of looking at this is
Bob> that the explicit scope terminators enable us to put anything
Bob> within anything. That is in part what they are for. So a
Bob> conditional statement becomes an 'imperative statement'
Bob> because of the presence of the scope terminating element.
Bob> That is really easy actually.
It's only not requiring them that's political, by which I simply mean
being influenced by other than technical considerations.
Bob> See, it is like this. You do not need to keep track of the
Bob> fact that the inner arithmetic statement is within the
Bob> conditional branch of some other arithmetic statement. All
Bob> you need to do is to define an explicitly terminated
Bob> arithmetic statement as distinct from an arithmetic statement
Bob> that is not explicitly terminated. That is much easier than
Bob> doing anything like keeping track of the from within where
Bob> issue.
Yup. That's what you have to do. I don't think that's reasonable.
It means I get to (almost) duplicate every rule that admits of a
possible conditional phrase. This is the tentative grammar I have for
ADD.
add_stmt
: ADD
( CORR identifier TO identifier { ROUNDED }
| ( identifier | numeric )+
( giving_phrase
! TO ( identifier | numeric ) giving_phrase
| TO ( identifier { ROUNDED } )+
)
)
{ size_err }
{ END_ADD }
;
giving_phrase
: GIVING ( identifier { ROUNDED } )+
;
size_err
: {ON} SIZE {ERROR} statement
{ ( NOT {ON} SIZE )? NOT {ON} SIZE ERROR (statement)+ }
| NOT {ON} SIZE {ERROR} statement
{ ( {ON} SIZE )? {ON} SIZE ERROR (statement)+ }
;
You're asking me to add a rule similar to the following for every
verb that might include a conditional phrase.
imperative_add_stmt
: ADD
( CORR identifier TO identifier { ROUNDED }
| ( identifier | numeric )+
( giving_phrase
! TO ( identifier | numeric ) giving_phrase
| TO ( identifier { ROUNDED } )+
)
)
( size_err END_ADD
| { END_ADD }
)
;
and in size_error and other conditional sections, change <statement>
to a new rule <imperative>. Maybe it could be done, but there's damn
little payoff for adding that much stuff, and I expect we'd have to
fight the tool in a number of places.
Perhaps my use of the terms "political" and "legalistic" sound a bit
too harsh, but it's hard not to see that they've left a loophole
solely for the purpose of not making existing code invalid. There's
nothing especially wrong with that, but we don't have a floor and
ceiling standard, so I choose to compile all correct programs and a
few that are not. I don't think that's especially wrong either.
BTW, you will note that size error is indifferent to the order of the
phrases, something that you seemed concerned about. I do want to
compile all correct programs.
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.