Annotation of researchv10dc/cmd/icon/src/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 tree7();
        !            52: extern nodeptr yylval;         /* parser's current token value */
        !            53: 
        !            54: /*
        !            55:  * Node types.
        !            56:  */
        !            57: 
        !            58: #define N_Activat       1              /* activation control structure */
        !            59: #define N_Alt           2              /* alternation operator */
        !            60: #define N_Augop                 3              /* augmented operator */
        !            61: #define N_Bar           4              /* generator control structure */
        !            62: #define N_Binop                 5              /* other binary operator */
        !            63: #define N_Break                 6              /* break statement */
        !            64: #define N_Case          7              /* case statement */
        !            65: #define N_Ccls          8              /* case clause */
        !            66: #define N_Clist                 9              /* list of case clauses */
        !            67: #define N_Conj         10              /* conjunction operator */
        !            68: #define N_Create       11              /* create control structure */
        !            69: #define N_Cset         12              /* cset literal */
        !            70: #define N_Elist                14              /* list of expressions */
        !            71: #define N_Empty                15              /* empty expression or statement */
        !            72: #define N_Field                16              /* record field reference */
        !            73: #define N_Id           17              /* identifier token */
        !            74: #define N_If           18              /* if-then-else statement */
        !            75: #define N_Int          19              /* integer literal */
        !            76: #define N_Invok                20              /* procedure call */
        !            77: #define N_Key          21              /* keyword */
        !            78: #define N_Limit                22              /* LIMIT control structure */
        !            79: #define N_List         23              /* [ ... ] style list */
        !            80: #define N_Loop         24              /* while, until, every, or repeat */
        !            81: #define N_Not          25              /* not prefix control structure */
        !            82: #define N_Next         26              /* next statement */
        !            83: #define N_Op           27              /* operator token */
        !            84: #define N_Proc         28              /* procedure */
        !            85: #define N_Real         29              /* real literal */
        !            86: #define N_Res          30              /* reserved word token */
        !            87: #define N_Ret          31              /* fail, return, or succeed */
        !            88: #define N_Scan         32              /* scan-using statement */
        !            89: #define N_Sect         33              /* s[i:j] (section) */
        !            90: #define N_Slist                34              /* list of statements */
        !            91: #define N_Str          35              /* string literal */
        !            92: #define N_Susp         36              /* suspend statement */
        !            93: #define N_To           37              /* TO operator */
        !            94: #define N_ToBy         38              /* TO-BY operator */
        !            95: #define N_Unop         39              /* unary operator */
        !            96: 
        !            97: /*
        !            98:  * Node constructor macros.
        !            99:  */
        !           100: 
        !           101: #define ActivNode(a,b,c)       tree6(N_Activat,Line(a),Col(a),a,b,c) 
        !           102: #define AltNode(a,b,c)         tree5(N_Alt,Line(a),Col(a),b,c) 
        !           103: #define AugopNode(a,b,c)       tree6(N_Augop,Line(a),Col(a),a,b,c) 
        !           104: #define BarNode(a)             tree4(N_Bar,Line(a),Col(a),a) 
        !           105: #define BinopNode(a,b,c)       tree6(N_Binop,Line(a),Col(a),a,b,c) 
        !           106: #define BreakNode(a,b)         tree4(N_Break,Line(a),Col(a),b) 
        !           107: #define CaseNode(a,b,c)                tree5(N_Case,Line(a),Col(a),b,c) 
        !           108: #define CclsNode(a,b,c)                tree5(N_Ccls,Line(a),Col(a),b,c) 
        !           109: #define ClistNode(a,b,c)       tree5(N_Clist,Line(a),Col(a),b,c) 
        !           110: #define ConjNode(a,b,c)                tree6(N_Conj,Line(a),Col(a),a,b,c) 
        !           111: #define CreateNode(a,b)                tree4(N_Create,Line(a),Col(a),b) 
        !           112: #define CsetNode(a,b)          tree5(N_Cset,tline,tcol,a,b) 
        !           113: #define ElistNode(a,b,c)       tree5(N_Elist,Line(a),Col(a),b,c) 
        !           114: #define EmptyNode              tree1(N_Empty) 
        !           115: #define FieldNode(a,b,c)       tree5(N_Field,Line(a),Col(a),b,c) 
        !           116: #define IdNode(a)              tree4(N_Id,tline,tcol,a) 
        !           117: #define IfNode(a,b,c,d)                tree6(N_If,Line(a),Col(a),b,c,d) 
        !           118: #define IntNode(a)             tree4(N_Int,tline,tcol,a) 
        !           119: #define InvokNode(a,b,c)       tree5(N_Invok,Line(a),Col(a),b,c) 
        !           120: #define KeyNode(a,b)           tree4(N_Key,Line(a),Col(a),b) 
        !           121: #define LimitNode(a,b)         tree5(N_Limit,Line(a),Col(a),a,b) 
        !           122: #define ListNode(a,b)          tree4(N_List,Line(a),Col(a),b) 
        !           123: #define LoopNode(a,b,c)                tree6(N_Loop,Line(a),Col(a),a,b,c) 
        !           124: #define NotNode(a)             tree4(N_Not,Line(a),Col(a),a) 
        !           125: #define NextNode(a)            tree3(N_Next,Line(a),Col(a)) 
        !           126: #define OpNode(a)              tree4(N_Op,tline,tcol,a) 
        !           127: #define ProcNode(a,b,c,d)      tree7(N_Proc,Line(a),Col(a),a,b,c,d) 
        !           128: #define RealNode(a)            tree4(N_Real,tline,tcol,a) 
        !           129: #define ResNode(a)             tree4(N_Res,tline,tcol,a) 
        !           130: #define RetNode(a,b)           tree5(N_Ret,Line(a),Col(a),a,b) 
        !           131: #define ScanNode(a,b,c)                tree6(N_Scan,Line(a),Col(a),a,b,c) 
        !           132: #define SectNode(a,b,c,d)      tree7(N_Sect,Line(a),Col(a),a,b,c,d) 
        !           133: #define SListNode(a,b,c)       tree5(N_Slist,Line(a),Col(a),b,c) 
        !           134: #define StrNode(a,b)           tree5(N_Str,tline,tcol,a,b) 
        !           135: #define SuspNode(a,b)          tree4(N_Susp,Line(a),Col(a),b) 
        !           136: #define ToByNode(a,b,c,d)      tree6(N_ToBy,Line(a),Col(a),b,c,d) 
        !           137: #define ToNode(a,b,c)          tree5(N_To,Line(a),Col(a),b,c) 
        !           138: #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.