Declaration DescriptorsSymbol Table DetailsIdentifier Descriptors

Identifier Descriptors

Identifier descriptors are actually quite simple. There is one such descriptor for each distinct identifier used in the program.3 A C language structure specification for the type identdesc used to store identifier descriptors is shown in figure *.

 
typedef struct iddesc {
  char *name;               /* The character string for the identifier */
  struct iddesc *hashlink;  /* Link for hash chains used by scanner    */
  union dcldesc *declstack; /* Head pointer for stack of declarations  */
                            /*    in open scopes.                      */
} identdesc;
Declaration for Type `identdesc'
 

The name field is just a pointer to the characters that form the identifier. The hashlink field is used to maintain lists of identifier with the same hash value when building the hash table used by the scanner. It will not be of concern to you when doing semantic processing. The declstack component is to be used as a pointer to the head of the linked list representing the stack of declarations of the identifier found in scopes that are still open. The scanner initializes this field to NULL.


Computer Science 434
Department of Computer Science
Williams College

Declaration DescriptorsSymbol Table DetailsIdentifier Descriptors