Annotation of 43BSD/contrib/icon/tran/tree.h, revision 1.1

1.1     ! root        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) 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.