Annotation of researchv10dc/cmd/bison/gram.h, revision 1.1.1.1

1.1       root        1: /* Data definitions for internal representation of bison's input,
                      2:    Copyright (C) 1984, 1986 Bob Corbett and Free Software Foundation, Inc.
                      3: 
                      4: BISON is distributed in the hope that it will be useful, but WITHOUT ANY
                      5: WARRANTY.  No author or distributor accepts responsibility to anyone
                      6: for the consequences of using it or for whether it serves any
                      7: particular purpose or works at all, unless he says so in writing.
                      8: Refer to the BISON General Public License for full details.
                      9: 
                     10: Everyone is granted permission to copy, modify and redistribute BISON,
                     11: but only under the conditions described in the BISON General Public
                     12: License.  A copy of this license is supposed to have been given to you
                     13: along with BISON so you can know your rights and responsibilities.  It
                     14: should be in a file named COPYING.  Among other things, the copyright
                     15: notice and this notice must be preserved on all copies.
                     16: 
                     17:  In other words, you are welcome to use, share and improve this program.
                     18:  You are forbidden to forbid anyone else to use, share and improve
                     19:  what you give them.   Help stamp out software-hoarding!  */
                     20: 
                     21: /* representation of the grammar rules:
                     22: 
                     23: ntokens is the number of tokens, and nvars is the number of variables (nonterminals).
                     24: nsyms is the total number, ntokens + nvars.
                     25: 
                     26: Each symbol (either token or variable) receives a symbol number.
                     27: Numbers 0 to ntokens-1 are for tokens, and ntokens to nsyms-1 are for variables.
                     28: Symbol number zero is the end-of-input token.  This token is counted in ntokens.
                     29: 
                     30: The rules receive rule numbers 1 to nrules in the order they are written.
                     31: Actions and guards are accessed via the rule number.
                     32: 
                     33: The rules themselves are described by three arrays: rrhs, rlhs and ritems.
                     34: rlhs[r] is the symbol number of the left hand side of rule r.
                     35: The right hand side is stored as symbol numbers in a portion of ritems.
                     36: rrhs[r] contains the index in ritems of the beginning of the portion for rule r.
                     37: The length of the portion is one greater
                     38:  than the number of symbols in the rule's right hand side.
                     39: The last element in the portion contains minus r, which
                     40: identifies it as the end of a portion and says which rule it is for.
                     41: 
                     42: The portions of ritems come in order of increasing rule number and are
                     43: followed by an element which is zero to mark the end.  nitems is the
                     44: total length of ritems, not counting the final zero.  Each element of
                     45: ritems is called an "item" and its index in ritems is an item number.
                     46: 
                     47: Item numbers are used in the finite state machine to represent
                     48: places that parsing can get to.
                     49: 
                     50: Precedence levels are recorded in the vectors sprec and rprec.
                     51: sprec records the precedence level of each symbol,
                     52: rprec the precedence level of each rule.
                     53: 
                     54: Precedence levels are assigned in increasing order starting with 1
                     55: so that numerically higher precedence values mean tighter binding
                     56: as they ought to.  Zero as a symbol or rule's precedence means none is assigned.
                     57: 
                     58: Associativities are recorded similarly in rassoc and sassoc.  */
                     59: 
                     60: 
                     61: #define        ISTOKEN(s)      ((s) < ntokens)
                     62: #define        ISVAR(s)        ((s) >= ntokens)
                     63: 
                     64: 
                     65: extern int nitems;
                     66: extern int nrules;
                     67: extern int nsyms;
                     68: extern int ntokens;
                     69: extern int nvars;
                     70: 
                     71: extern short *ritem;
                     72: extern short *rlhs;
                     73: extern short *rrhs;
                     74: extern short *rprec;
                     75: extern short *sprec;
                     76: extern short *rassoc;
                     77: extern short *sassoc;
                     78: extern short *rline;           /* Source line number of each rule */
                     79: 
                     80: extern int start_symbol;
                     81: 
                     82: 
                     83: /* associativity values in elements of rassoc, sassoc.  */
                     84: 
                     85: #define RIGHT_ASSOC 1
                     86: #define LEFT_ASSOC 2
                     87: #define NON_ASSOC 3
                     88: 
                     89: /* token translation table:
                     90: indexed by a token number as returned by the user's yylex routine,
                     91: it yields the internal token number used by the parser and throughout bison.
                     92: If translations is zero, the translation table is not used because
                     93: the two kinds of token numbers are the same.  */
                     94: 
                     95: extern short *token_translations;
                     96: extern int translations;
                     97: extern int max_user_token_number;
                     98: 
                     99: /* semantic_parser is nonzero if the input file says to use the hairy parser
                    100: that provides for semantic error recovery.  If it is zero, the yacc-compatible
                    101: simplified parser is used.  */
                    102: 
                    103: extern int semantic_parser;
                    104: 
                    105: /* pure_parser is nonzero if should generate a parser that is all pure and reentrant. */
                    106: 
                    107: extern int pure_parser;
                    108: 
                    109: /* error_token_number is the token number of the error token.  */
                    110: 
                    111: extern int error_token_number;

unix.superglobalmegacorp.com

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