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

Re: gnubol: Re: ref touch points



>>>>> "Bob" == RKRayhawk  <RKRayhawk@aol.com>
>>>>> wrote the following on Sat, 4 Dec 1999 11:45:54 EST

  Bob> In a message dated 12/3/99 11:51:19 PM EST, mck@tivoli.mv.com
  Bob> writes responses to an original post of mine :

  Bob> << However, it is likewise reasonable to suggest that
  Bob> qualification can and perhaps should be accomplished in
  Bob> syntax. Qualification actually involves a tree walk of
  Bob> portions of the symbol table. That can occur as the {OFIN ref}
  Bob> recurse reduces step by step, or at the single action where
  Bob> the reference is reduced, or in the various verb constructs
  Bob> that real in the references.
 
  Bob>  This is actually one of the places that we agree.  Be careful
  Bob> about resolution, though.  COBOL is not C.  COBOL requires
  Bob> only that qualification be sufficient to disambiguate
  Bob> references.  That means we have to do bottom-up lookup,
  Bob> starting with the data-name and marching upward in each tree
  Bob> to find the qualifiers.  We must also examine every instance
  Bob> of the data-name, even after we've found a match, to insure
  Bob> that the reference is truly unambiguous.
 
  Bob> The step by step synchronous walk makes the most sense, in
  Bob> effect the grammar parse engine is enabling the walk in
  Bob> exactly the correct fashion. Why waste that opportunity. So
  Bob> anyway, if you do manifest type according to a few
  Bob> distinctions for rule identification of syntax errors, you are
  Bob> incidentally enabling qualification _resolution_ in syntax and
  Bob> providing atleast for the possibility of eliminating that from
  Bob> semantics.
 
  Bob>  If I understand what you're saying here, I think I have
  Bob> refuted it in the last paragraph.
  >>>

  Bob> This issue may look different under LR and LL.

No, I have not made myself clear.  This is not a parsing issue.
Let's say we have the following records.

      01 A.			01 B.
         02 B.			   02 B.
	    03 C.		      03 C.
	       04 D.		         04 D.
	          05 X.			    05 Y.
		     06 Z PIC 9.	       06 Z PIC X.

The programmer may legitimately reference Z of Y and it is a unique
reference.  Since the name at the top of the tree need not be among
the qualifiers, it becomes very inefficient to do the lookup
top-down.  What we do instead, is form chains while we're building
the symbol table of all the symbol table entries that have the same
name, then use those chains to accomplish the lookup bottom-up.  We
are now searching only the trees that contain the data-name instead of
searching every tree in the program.

Best regards,

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.