home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Icon 8.1 / msm-2 / iconc.sit / tree.h < prev   
Encoding:
Text File  |  1992-12-04  |  3.6 KB  |  67 lines  |  [TEXT/MPS ]

  1. /*
  2.  * Structure of a tree node.
  3.  */
  4.  
  5. typedef    struct node    *nodeptr;
  6.  
  7. /*
  8.  * Kinds of fields in syntax tree node.
  9.  */
  10. union field {
  11.    long n_val;         /* integer-valued fields */
  12.    char *n_str;         /* string-valued fields */
  13.    struct lentry *lsym;  /* fields referencing local symbol table entries */ 
  14.    struct centry *csym;  /* fields referencing constant symbol table entries */
  15.    struct implement *ip; /* fields referencing an operation */
  16.    struct pentry *proc;     /* pointer to procedure entry */
  17.    struct rentry *rec;     /* pointer to record entry */
  18.    unsigned int *typ;    /* extra type field */
  19.    nodeptr n_ptr;     /* subtree pointers */
  20.    };
  21.  
  22. /*
  23.  * A store is an array that maps variables types (which are given indexes)
  24.  *  to the types stored within the variables.
  25.  */
  26. struct store {
  27.    struct store *next;
  28.    int perm;               /* flag: whether store stays across iterations */
  29.    unsigned int *types[1]; /* actual size is number of variables */
  30.    };
  31.  
  32. /*
  33.  * Array of parameter types for an operation call.
  34.  */
  35. struct symtyps {
  36.    int nsyms;                /* number of parameter symbols */
  37.    struct symtyps *next;
  38.    unsigned int *types[1];   /* really one for every symbol */
  39.    };
  40.  
  41. /*
  42.  * definitions for maintaining allocation status.
  43.  */
  44. #define NotAlloc 0   /* temp var neither in use nor reserved */
  45. #define InUnse   1   /* temp var currently contains live variable */
  46. /*            n < 0     reserved: must be free by node with postn field = n */
  47.  
  48. #define DescTmp 1    /* allocation of descriptor temporary */
  49. #define CIntTmp 2    /* allocation of C integer temporary */
  50. #define CDblTmp 3    /* allocation of C double temporary */
  51. #define SBuf    4    /* allocation of string buffer */
  52. #define CBuf    5    /* allocation of cset buffer */
  53.  
  54. struct freetmp {     /* list of things to free at a node */
  55.    int kind;         /*   DescTmp, CIntTmp, CDblTmp, SBuf, or CBuf */
  56.    int indx;         /*   index into status array */
  57.    int old;          /*   old status */
  58.    struct freetmp *next;
  59.    };
  60.  
  61. struct node {
  62.    int n_type;            /* node type */
  63.    char *n_file;        /* name of file containing source program */
  64.    int n_line;            /* line number in source program */
  65.    int n_col;            /* column number in source program */
  66.    int flag;
  67.    int *new_