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

Re: gnubol: How do we parse this language, anyway?



Randall Bart wrote:

> At 09:09 AM 11/21/99 , Michael McKernan wrote:
>
> >I am maintaining
> >that an unmatched END-x should imply an appropriate END-x for any
> >unterminated conditional part that exists when it is encountered.
> >This isn't the letter of the law, but it does not affect correct
> >programs, and is arguably less astonishing than the strict
> >interpretation.
>
> I agree.
>
>
So:
add
    size
        subtract
            size
                add size
            not size
               display
.

If you take this approach you have to fill in a lot of gaps in the standard. Which
verb does the not size match with? Presumably since you are allowing nested
conditionals, it is allowed to match it to the last verb.

But the standard (on my reading) clearly says that this is the matching in a
slightly different scanario:

add a to b
    size
        subtract c from d
    not size
       display.

Why does the not size match with the add not the subtract? Well nested
conditionals are not allowed, so the not size cannot match with that, so it
matches with the add.

Maybe it isn't clear actually; we need some results from actual compilers.

However lets say the not size binds to the subtract.

add
    size
        subtract
            not size
               display.

How would you specify both size and not size for a verb? The only way you seem to
be end-verb for the nested verbs. But end-verb existed only since cobol 85, and
size/not size from memory predate this. So this interpretation would break
existing code. Which is not likely to be correct.

Thus I predict the not size will bind to the add.

Tim Josling



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