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

Re: gnubol: refmod and soft edges



I have tried to add sufficient error productions and superstructure to allow
reasonable recovery from errors so that the statement structure does not get
broken gratuitously. For example (much paraphrased)

if *error* else [then] imperative_statements|NEXT SENTENCE
[conditional_statement] [end-if]

So you won't get a spurious error when you hit the else or end-if.

Error productions and extensions both come at a cost of making it harder to write
a grammar that works. They tend to generate a blizzard of conflicts. Definitely
not fun, when you have 1000 productions already, just for the nucleus.

For example, I decided to allow the paragraph name to be omitted (with warning)
at the start of a section, or at the start of the procedure division, because IBM
allows this. It took me 90 minutes last night to get this working; at one stage I
was on the point of giving up.

So at this stage I am trying to go for a 90:10 rule - whatever better error
messages and syntax recovery I can do without too much grief. Someone would need
to convince me that

a) We know what the common errors are. We don't have this data as far as I know.
b) The relevant productions can be added to the grammar without excessive pain.

Tim Josling

RKRayhawk@aol.com wrote:

> ...
> I am holding onto this line discussion not to tire you of it. What I foresee
> is that when we get to the conditionals, we are going to face great
> difficulty in maintaining scope recursion...
>
>
> If we build the parser from the tokens up, we will miss the major problems at
> the top until it is too late.
>
> ...  It is not that I am in favor of lots of
> low level rules for fun...
>
> ...(decorate the rules with error productions)...
>
> Bob Rayhawk




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