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

Re: PERFORM token (was RE: gnubol: Hacks needed to parse COBOL



>>>>> "Bob" == RKRayhawk  <RKRayhawk@aol.com>
>>>>> wrote the following on Fri, 3 Dec 1999 09:52:29 EST

  Bob> In a message dated 12/3/99 8:19:26 AM EST, mck@tivoli.mv.com
  Bob> writes: ....  

 varying_phrase
    : VARYING identifier 
      FROM (identifier | INTEGER)
      BY (identifier | INTEGER) 
      UNTIL condition
    ;

  >>>
  Bob> ...  This is a side note not responsive to the main point of
  Bob> your post, the VARYING UNTIL clause can be optionally three
  Bob> levels deep

Oops!  There I go creating extensions again.  My grammar permits
unlimited repetitions of the VARYING phrase by virtue of this element
which appears in two places in the main rule.

		      ( varying_phrase )+

I never thought to look it up since I saw no reason for it to be
limited.  I still don't.  This grammar is not what I'm using, but it
required less explanation than the real one.

  Bob> It is interesting that the FROM token can occur also in
  Bob> arithmetic statements and so we may need precedence markers on
  Bob> VARYING FROM clauses and SUBTRACT statements just to get them
  Bob> fitted out correctly precedence wise. That comment applies to
  Bob> bison. But the precedence issue and shift/reduce behavior is
  Bob> just as relevant to PCCTS, is it not? How do you establish
  Bob> token precedence, and how to override in these kind of
  Bob> statements.

There's no notion of shift/reduce in a top down parser and there is
no precedence other than that embodied in the rules.  I haven't
considered any of these things from an LR point of view, but they're
not a problem for a predictive parser.

  Bob> And just to make sure that we don't run out of monkey wrenches
  Bob> to monkey around with, notice that AFTER can occur in WRITE
  Bob> and INSPECT statements, where our shift/reduce concerns will
  Bob> surely be distinct from those in the varying VARYING
  Bob> clause. And come to think about it AFTER can also appear in a
  Bob> completely different role in the PERFORM's TEST clauses. It
  Bob> thus weaves in and out of the PERFORM statement's shift /
  Bob> reduce domain. A very cool token if there ever was one. %prec
  Bob> can help here in bison, how are such precedence governed
  Bob> shift/reduce concerns addressed in PCCTS.



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