gnucobol-users
[Top][All Lists]
Advanced

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

Re: [open-cobol-list] How does Cobol parse the Procedure Division ?


From: Aries Software
Subject: Re: [open-cobol-list] How does Cobol parse the Procedure Division ?
Date: Wed, 25 Sep 2013 13:33:02 +0100

Hi Michael

 

The whole point about COBOL is its readability and the more “wordy” the more  easy it is to follow, programmers who are used to writing in C and VB quite often write unintelligible code because of the use of few “words”!

 

Mike

 

From: Michael Anderson [mailto:address@hidden
Sent: 24 September 2013 18:21
To: address@hidden
Subject: Re: [open-cobol-list] How does Cobol parse the Procedure Division ?

 

Patrick,

In the past a period was always required to terminate a statement. It was the onset of the END- verb that made the period completely optional, except at the end of a division, or paragraph. There has been discussions between many cobologists to remove the period completely. However, points you mention, as well as others, make this impossible. However, a negative consensus of Cobol (by non-Coboler's) has been that it is too verbose, too wordy. In my opinion the END- verbs add to this wordiness, and is perceived negatively by young new programmers learning the language, a single character is much more preferable.

There is a difference between reserved words and verbs in Cobol. For example “STRING” is a verb, and a reserved word, but “INTO” is not a verb, but is a reserved word. I think you're correct in that it is the next known verb that terminates a statement without a period.

I would agree that this END-verb verses using a period does probably add to the complexity of the parser, but this also adds to the complexity of learning the language. For example; some programmers use END-verbs all the time, others are not as consistent. Also the compiler will warn of missing END- verbs, but they're only useful to me when coding within the context of upper level verb. So, what is the deal?

 Too me, this feature is useful for readability.

I don't use END- verbs all the time, but when I do, I prefer it to be only within the context of another verb. For example: “If, Evaluate, in-line Perform's and so on..... When NOT in the context of another verb I always use the period, and never the END-verb. I'm definitely not trying to push my coding style on anyone else. However, this makes my code better for me, more readable for me. Especially when looking at large junks of code with END- verbs lets me know I'm working within the context of a higher level verb. Where periods are used in my code, I know without a doubt, that I am working at the outer most context of verbiage. As this madness may upset some traditional programmers, I give much thanks to the compiler guys for supporting this feature. I also prefer FREE FORMAT without column constraints, which also increases the blood-pressure of traditional programmers.

I also prefer to work well with others, so when asked, I have no problem replacing all my periods with END- verbs, but for me this does take-away from the readability and adds to the wordiness.  

--
Mike.

On 09/24/2013 10:07 AM, Patrick wrote:

Hi Everyone
 
It's easy to see how Cobol can be parsed in all of the parts outside of 
the PROCEDURE DIVISION, statements end with periods.
I can't see how the compiler could understand what is going on in 
PROCEDURE though. Every language I know of has some sort of character to 
end a statement. It might be a non printable character but it's there.
 
PROCEDURE ends in a period and paragraphs end in periods but if we have 
a statement like this:
 
MOVE foo TO moo
 
I could see how the compiler would implicitly know that it ends one 
token after TO but we can also have:
 
  MOVE foo TO moo koo boo
 
Does the next reserved word that is not a part of the current sentence 
signify an end to the current statement and the final period indicate 
that there are no further statements coming ?
 
If this is true, was it always this way. From what I understand it was not.
 
If this is true did it dramatically increase the complexity of the compiler?
 
Thanks
 
 
 
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]