1: /*
   2:  * Structure of a tree node.
   3:  */
   4: 
   5: typedef struct node *nodeptr;
   6: 
   7: struct node {
   8:    int n_type;          /* node type */
   9:    int n_line;          /* line number in source program */
  10:    int n_col;           /* column number in source program */
  11:    union {
  12:       int n_val;        /* integer-valued fields */
  13:       char *n_str;      /* string-valued fields */
  14:       nodeptr n_ptr;            /* subtree pointers */
  15:       } n_field[4];
  16:    };
  17: 
  18: /*
  19:  * Macros to access fields of parse tree nodes.
  20:  */
  21: 
  22: #define TYPE(t)     t->n_type
  23: #define LINE(t)     t->n_line
  24: #define COL(t)      t->n_col
  25: #define TREE0(t)    t->n_field[0].n_ptr
  26: #define TREE1(t)    t->n_field[1].n_ptr
  27: #define TREE2(t)    t->n_field[2].n_ptr
  28: #define TREE3(t)    t->n_field[3].n_ptr
  29: #define VAL0(t)     t->n_field[0].n_val
  30: #define VAL1(t)     t->n_field[1].n_val
  31: #define VAL2(t)     t->n_field[2].n_val
  32: #define VAL3(t)     t->n_field[3].n_val
  33: #define STR0(t)     t->n_field[0].n_str
  34: #define STR1(t)     t->n_field[1].n_str
  35: #define STR2(t)     t->n_field[2].n_str
  36: #define STR3(t)     t->n_field[3].n_str
  37: 
  38: /*
  39:  * External declarations.
  40:  */
  41: 
  42: extern nodeptr tree;        /* parse tree space */
  43: extern nodeptr tfree;       /* free pointer for tree space */
  44: extern nodeptr tend;        /* end of tree space */
  45: extern int tsize;       /* parse tree size (integers) */
  46: extern nodeptr tree1();     /* tree node allocator routines */
  47: extern nodeptr tree3();
  48: extern nodeptr tree4();
  49: extern nodeptr tree5();
  50: extern nodeptr tree6();
  51: extern nodeptr yylval;      /* parser's current token value */
  52: 
  53: /*
  54:  * Node types.
  55:  */
  56: 
  57: #define N_ACTIVAT    1      /* activation control structure */
  58: #define N_ALT        2      /* alternation operator */
  59: #define N_AUGOP      3      /* augmented operator */
  60: #define N_BAR        4      /* generator control structure */
  61: #define N_BINOP      5      /* other binary operator */
  62: #define N_BREAK      6      /* break statement */
  63: #define N_CASE       7      /* case statement */
  64: #define N_CCLS       8      /* case clause */
  65: #define N_CLIST      9      /* list of case clauses */
  66: #define N_CONJ      10      /* conjunction operator */
  67: #define N_CREATE    11      /* create control structure */
  68: #define N_CSET      12      /* cset literal */
  69: #define N_ELIST     14      /* list of expressions */
  70: #define N_EMPTY     15      /* empty expression or statement */
  71: #define N_FIELD     16      /* record field reference */
  72: #define N_ID        17      /* identifier token */
  73: #define N_IF        18      /* if-then-else statement */
  74: #define N_INT       19      /* integer literal */
  75: #define N_INVOK     20      /* procedure call */
  76: #define N_KEY       21      /* keyword */
  77: #define N_LIMIT     22      /* LIMIT control structure */
  78: #define N_LIST      23      /* [ ... ] style list */
  79: #define N_LOOP      24      /* while, until, every, or repeat */
  80: #define N_NOT       25      /* not prefix control structure */
  81: #define N_NEXT      26      /* next statement */
  82: #define N_OP        27      /* operator token */
  83: #define N_PROC      28      /* procedure */
  84: #define N_REAL      29      /* real literal */
  85: #define N_RES       30      /* reserved word token */
  86: #define N_RET       31      /* fail, return, or succeed */
  87: #define N_SCAN      32      /* scan-using statement */
  88: #define N_SECT      33      /* s[i:j] (section) */
  89: #define N_SLIST     34      /* list of statements */
  90: #define N_STR       35      /* string literal */
  91: #define N_SUSP      36      /* suspend statement */
  92: #define N_TO        37      /* TO operator */
  93: #define N_TOBY      38      /* TO-BY operator */
  94: #define N_UNOP      39      /* unary operator */
  95: 
  96: /*
  97:  * Node constructor macros.
  98:  */
  99: 
 100: #define ACTIVNODE(a,b,c)    tree6(N_ACTIVAT,LINE(a),COL(a),a,b,c)
 101: #define ALTNODE(a,b,c)      tree5(N_ALT,LINE(a),COL(a),b,c)
 102: #define AUGOPNODE(a,b,c)    tree6(N_AUGOP,LINE(a),COL(a),a,b,c)
 103: #define BARNODE(a)      tree4(N_BAR,LINE(a),COL(a),a)
 104: #define BINOPNODE(a,b,c)    tree6(N_BINOP,LINE(a),COL(a),a,b,c)
 105: #define BREAKNODE(a,b)      tree4(N_BREAK,LINE(a),COL(a),b)
 106: #define CASENODE(a,b,c)     tree5(N_CASE,LINE(a),COL(a),b,c)
 107: #define CCLSNODE(a,b,c)     tree5(N_CCLS,LINE(a),COL(a),b,c)
 108: #define CLISTNODE(a,b,c)    tree5(N_CLIST,LINE(a),COL(a),b,c)
 109: #define CONJNODE(a,b,c)     tree6(N_CONJ,LINE(a),COL(a),a,b,c)
 110: #define CREATENODE(a,b)     tree4(N_CREATE,LINE(a),COL(a),b)
 111: #define CSETNODE(a,b)       tree5(N_CSET,tline,tcol,a,b)
 112: #define ELISTNODE(a,b,c)    tree5(N_ELIST,LINE(a),COL(a),b,c)
 113: #define EMPTYNODE       tree1(N_EMPTY)
 114: #define FIELDNODE(a,b,c)    tree5(N_FIELD,LINE(a),COL(a),b,c)
 115: #define IDNODE(a)       tree4(N_ID,tline,tcol,a)
 116: #define IFNODE(a,b,c,d)     tree6(N_IF,LINE(a),COL(a),b,c,d)
 117: #define INTNODE(a)      tree4(N_INT,tline,tcol,a)
 118: #define INVOKNODE(a,b,c)    tree5(N_INVOK,LINE(a),COL(a),b,c)
 119: #define KEYNODE(a,b)        tree4(N_KEY,LINE(a),COL(a),b)
 120: #define LIMITNODE(a,b)      tree5(N_LIMIT,LINE(a),COL(a),a,b)
 121: #define LISTNODE(a,b)       tree4(N_LIST,LINE(a),COL(a),b)
 122: #define LOOPNODE(a,b,c)     tree6(N_LOOP,LINE(a),COL(a),a,b,c)
 123: #define NOTNODE(a)      tree4(N_NOT,LINE(a),COL(a),a)
 124: #define NEXTNODE(a)     tree3(N_NEXT,LINE(a),COL(a))
 125: #define OPNODE(a)       tree4(N_OP,tline,tcol,a)
 126: #define PROCNODE(a,b,c,d)   tree7(N_PROC,LINE(a),COL(a),a,b,c,d)
 127: #define REALNODE(a)     tree4(N_REAL,tline,tcol,a)
 128: #define RESNODE(a)      tree4(N_RES,tline,tcol,a)
 129: #define RETNODE(a,b)        tree5(N_RET,LINE(a),COL(a),a,b)
 130: #define SCANNODE(a,b,c)     tree6(N_SCAN,LINE(a),COL(a),a,b,c)
 131: #define SECTNODE(a,b,c,d)   tree7(N_SECT,LINE(a),COL(a),a,b,c,d)
 132: #define SLISTNODE(a,b,c)    tree5(N_SLIST,LINE(a),COL(a),b,c)
 133: #define STRNODE(a,b)        tree5(N_STR,tline,tcol,a,b)
 134: #define SUSPNODE(a,b)       tree4(N_SUSP,LINE(a),COL(a),b)
 135: #define TOBYNODE(a,b,c,d)   tree6(N_TOBY,LINE(a),COL(a),b,c,d)
 136: #define TONODE(a,b,c)       tree5(N_TO,LINE(a),COL(a),b,c)
 137: #define UNOPNODE(a,b)       tree5(N_UNOP,LINE(a),COL(a),a,b)

Defined struct's

node defined in line 7; used 1 times
  • in line 5

Defined typedef's

nodeptr defined in line 5; used 47 times

Defined macros

ACTIVNODE defined in line 100; used 3 times
ALTNODE defined in line 101; used 1 times
AUGOPNODE defined in line 102; used 1 times
BARNODE defined in line 103; used 3 times
BINOPNODE defined in line 104; used 2 times
BREAKNODE defined in line 105; used 1 times
CASENODE defined in line 106; used 1 times
CCLSNODE defined in line 107; used 2 times
CLISTNODE defined in line 108; used 1 times
COL defined in line 24; used 32 times
CONJNODE defined in line 109; used 2 times
CREATENODE defined in line 110; used 2 times
CSETNODE defined in line 111; used 1 times
ELISTNODE defined in line 112; used 2 times
EMPTYNODE defined in line 113; used 12 times
FIELDNODE defined in line 114; used 1 times
IDNODE defined in line 115; used 1 times
IFNODE defined in line 116; used 2 times
INTNODE defined in line 117; used 1 times
INVOKNODE defined in line 118; used 4 times
KEYNODE defined in line 119; used 2 times
LIMITNODE defined in line 120; used 1 times
LINE defined in line 23; used 63 times
LISTNODE defined in line 121; used 3 times
LOOPNODE defined in line 122; used 7 times
NEXTNODE defined in line 124; used 1 times
NOTNODE defined in line 123; used 1 times
N_ACTIVAT defined in line 57; used 1 times
N_ALT defined in line 58; used 1 times
N_AUGOP defined in line 59; used 2 times
N_BAR defined in line 60; used 1 times
N_BINOP defined in line 61; used 1 times
N_BREAK defined in line 62; used 1 times
N_CASE defined in line 63; used 1 times
N_CCLS defined in line 64; used 1 times
N_CLIST defined in line 65; used 1 times
N_CONJ defined in line 66; used 1 times
N_CREATE defined in line 67; used 1 times
N_CSET defined in line 68; used 1 times
N_ELIST defined in line 69; used 2 times
N_EMPTY defined in line 70; used 8 times
N_FIELD defined in line 71; used 1 times
N_ID defined in line 72; used 1 times
N_IF defined in line 73; used 1 times
N_INT defined in line 74; used 1 times
N_INVOK defined in line 75; used 1 times
N_KEY defined in line 76; used 1 times
N_LIMIT defined in line 77; used 1 times
N_LIST defined in line 78; used 1 times
N_LOOP defined in line 79; used 5 times
N_NEXT defined in line 81; used 1 times
N_NOT defined in line 80; used 1 times
N_OP defined in line 82; used 1 times
N_PROC defined in line 83; used 1 times
N_REAL defined in line 84; used 1 times
N_RES defined in line 85; used 2 times
N_RET defined in line 86; used 1 times
N_SCAN defined in line 87; used 1 times
N_SECT defined in line 88; used 1 times
N_SLIST defined in line 89; used 1 times
N_STR defined in line 90; used 1 times
N_SUSP defined in line 91; used 1 times
N_TO defined in line 92; used 1 times
N_TOBY defined in line 93; used 1 times
N_UNOP defined in line 94; used 1 times
OPNODE defined in line 125; used 2 times
PROCNODE defined in line 126; used 1 times
REALNODE defined in line 127; used 1 times
RESNODE defined in line 128; used 1 times
RETNODE defined in line 129; used 2 times
SCANNODE defined in line 130; used 2 times
SECTNODE defined in line 131; used 1 times
SLISTNODE defined in line 132; used 2 times
STR0 defined in line 33; used 18 times
STR1 defined in line 34; never used
STR2 defined in line 35; never used
STR3 defined in line 36; never used
STRNODE defined in line 133; used 1 times
SUSPNODE defined in line 134; used 1 times
TOBYNODE defined in line 135; used 1 times
TONODE defined in line 136; used 1 times
TREE0 defined in line 25; used 43 times
TREE1 defined in line 26; used 26 times
TREE2 defined in line 27; used 15 times
TREE3 defined in line 28; used 2 times
TYPE defined in line 22; used 11 times
UNOPNODE defined in line 137; used 1 times
VAL0 defined in line 29; used 30 times
VAL1 defined in line 30; used 2 times
VAL2 defined in line 31; never used
VAL3 defined in line 32; never used

Usage of this include

Last modified: 1984-11-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1940
Valid CSS Valid XHTML 1.0 Strict