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

gnubol: Free-form problem



Well, I've reached my first impasse, but I trust if I had later
materials, I might know what to do.  I've been trying to compose the
grammar outline from the vanilla '85 standard without dependence on
the syntactic significance of area A. (I am plagiarizing freely from
the Tweedy/Slaughter grammar, of course.)

My problem arises in Identification Division where, for example, the
syntax for the AUTHOR paragraph is defined thusly,

   [ AUTHOR.  [comment-entry] ... ]

and is further elucidated by this syntax rule:

   The comment-entry may be any combination of the characters from
   the computers character set. The continuation...

So, as you see, neither the PERIOD nor the other fixed id-division
paragraph names are excluded from the definition of comment-entry. 
Not even the next division header stops this thing.

I can put together this rather ugly hack to approximate the rule, but
I had to exclude the paragraph and division names from comment-entry.

#tokclass ID_PARA_END 
   { INSTALLATION DATE_WRITTEN DATE_COMPILED SECURITY 
     ENVIRONMENT DATA PROCEDURE }
    ...

    ( { AUTHOR PERIOD PERIOD   (~ID_PARA_END)* }
      { INSTALLATION  PERIOD   (~ID_PARA_END)* }
      { DATE_WRITTEN  PERIOD   (~ID_PARA_END)* }
      { DATE_COMPILED PERIOD   (~ID_PARA_END)* }
      { SECURITY      PERIOD   (~ID_PARA_END)* }
    ) 

Which says to eat all the tokens that are not in the ID_PARA_END
list.  This is obviously the wrong strategy.

What's the right answer?

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.