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: Ron Norman
Subject: Re: [open-cobol-list] How does Cobol parse the Procedure Division ?
Date: Tue, 24 Sep 2013 15:56:38 -0400

periods are not required to end a single statement but do act as a final scope delimiter. 

To find the history on this you would have to go back to the 1960's and Grace Hopper. 
I recall published standards for Cobol 1968, 1974, 1985 and then 2002. 

Cheers,
Ron Norman


On Sep 24, 2013, at 15:44, Patrick <address@hidden> wrote:

Hi Mike

Thanks once again for your helpful feedback.

I am not sure if I have any real proposals here for open Cobol but if we could continue the discussion without a fight breaking out, something valuable might come out of this.

I am a recent learner and the periods VS END-verb was very confusing for me.

At 37 I guess I am a "young" coder and I don't mind the END-verb at all. I would also have been happy with periods too but I am not happy with implicit statement ends, this reminds me of _javascript_ with optional semi-colons.

If everything was just periods or END-verbs it would be so much easier to learn. Furthermore some verbs do not have an END-verb option such as MOVE.

Does anyone know of anywhere I could read about the discussions that might have taken place about this?

It seems to me that having 3 different ways to end statements was a way to keep everyone happy and that thousands would be furious if their style was omitted.

Again I don't really have a suggestion that would not upset others but maybe if I understand the problem I can figure out some little work around or at least give tips to others in a tutorial-Patrick








On 09/24/2013 01:21 PM, Michael Anderson wrote:
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



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

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