1           /* START OF:        rdc_start_.incl.pl1             *  *  *  *  *  *  */
  2 
  3           /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
  4           /*                                                                    */
  5           /* N^H__^Ha_^Hm_^He:  rdc_start_.incl.pl1                                                 */
  6           /*                                                                    */
  7           /*      This include segment is used by compilers generated by the    */
  8           /* reduction_compiler.  Such compilers include a SEMANTIC_ANALYSIS    */
  9           /* subroutine generated by the reduction_compiler.  This subroutine   */
 10           /* compares a chain of input tokens with token requirements           */
 11           /* specified in reductions.  This include segment declares the        */
 12           /* structure of the input tokens (which are generated by lex_string_),*/
 13           /* defines the beginning of the SEMANTIC_ANALYSIS procedure, and      */
 14           /* declares Pthis_token, a global pointer variable which points to    */
 15           /* the "current" token being referenced by SEMANTIC_ANALYSIS.         */
 16           /*                                                                    */
 17           /* S^H__^Ht_^Ha_^Ht_^Hu_^Hs                                                               */
 18           /*                                                                    */
 19           /* 0) Created:  April, 1974 by G. C. Dixon                            */
 20           /*                                                                    */
 21           /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
 22 
 23      dcl  Pthis_token                   ptr;                /* ptr to the "current" token being acted upon.   */
 24 ^L
 25 %include lex_descriptors_;
 26 ^L
 27 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  **  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
 28 
 29 
 30 SEMANTIC_ANALYSIS:  procedure;                              /* procedure which analyzes the syntax and        */
 31                                                             /* semantics of the tokens in the input list.     */
 32 
 33      dcl                                                    /*        automatic variables                     */
 34           LTOKEN_REQD_VALUE             fixed bin(18),      /* length of a token requirement.                 */
 35           NRED                          fixed bin,          /* number of the reduction tokens are being       */
 36                                                             /* compared to.                                   */
 37           PRED                          ptr,                /* ptr to the reduction tokens are being          */
 38                                                             /* compared to.                                   */
 39           PTOKEN_REQD                   ptr,                /* ptr to token requirement descriptor associated */
 40                                                             /* with reduction tokens are being compared to.   */
 41           PTOKEN_REQD_VALUE             ptr,                /* ptr to a token requirement.                    */
 42           STOKEN_FCN                    bit(1) aligned,     /* return value from a relative syntax function.  */
 43           CODE                          fixed bin(35),      /* an error code.                                 */
 44           I                             fixed bin,          /* a do-group index.                              */
 45           NUMBER                        fixed bin(35);      /* fixed binary representation of a decimal       */
 46                                                             /* number character string.                       */
 47 
 48      dcl                                                    /*        based variables                         */
 49           1 RED                         aligned based (PRED),
 50                                                             /* descriptor for reduction tokens are being      */
 51                                                             /* compared to.                                   */
 52             2 TOKEN_REQD                unaligned,
 53               3 IFIRST                  fixed bin(17) unal, /* index of first token requirement.              */
 54               3 ILAST                   fixed bin(17) unal, /* index of last  token requirement associated    */
 55                                                             /* with this reduction.                           */
 56           1 TOKEN_REQD                  aligned based (PTOKEN_REQD),
 57                                                             /* a token requirement descriptor.                */
 58             2 FORM                      fixed bin(17) unal, /* form of the token requirement:                 */
 59                                                             /*  -1 = relative token requirement function;     */
 60                                                             /*       TYPE = index of the particular token     */
 61                                                             /*              function in the token_fcn array.  */
 62                                                             /*   0 = built-in token requirement function;     */
 63                                                             /*       TYPE = as defined below.                 */
 64                                                             /*  >0 = absolute token requirement:              */
 65                                                             /*       FORM = index(TOKEN_STRINGS,TOKEN_REQD);  */
 66                                                             /*       TYPE = length(TOKEN_REQD);               */
 67             2 TYPE                      fixed bin(17) unal, /* TYPE of built-in token requirement function:   */
 68                                                             /*   1 = compile test to see if input token       */
 69                                                             /*       chain is exhausted (<no-token>).         */
 70                                                             /*   2 = compile test for any token value         */
 71                                                             /*       (<any-token>).                           */
 72                                                             /*   3 = compile test for a PL/I identifier       */
 73                                                             /*       (<name>) of 32 or fewer characters.      */
 74                                                             /*   4 = compile test for token which is a        */
 75                                                             /*       <decimal-integer>.                       */
 76                                                             /*   5 = compile test for token which is a single */
 77                                                             /*       backspace character (<BS>).              */
 78                                                             /*   6 = compile test for a token which is a      */
 79                                                             /*       <quoted-string>.                         */
 80 ^L
 81           1 TOKEN_REQD_STRING           aligned based (PTOKEN_REQD),
 82                                                             /* overlay for an absolute token requirement      */
 83                                                             /* descriptor.                                    */
 84             2 I                         fixed bin(17) unal, /* index into list of token strings of the        */
 85                                                             /* absolute token string assoc w/ descriptor.     */
 86             2 L                         fixed bin(17) unal, /* length of the absolute token string.           */
 87           TOKEN_REQD_VALUE              char(LTOKEN_REQD_VALUE) based (PTOKEN_REQD_VALUE);
 88                                                             /* absolute token string which token is reqd      */
 89                                                             /* to match in order for tokens which are         */
 90                                                             /* "current" on the list to match the reduction.  */
 91 
 92      dcl                                                    /*        builtin functions                       */
 93          (addr, max, null, search, substr, verify)
 94                                         builtin;
 95 
 96      dcl                                                    /*        entries                                 */
 97           cv_dec_check_                 entry (char(*), fixed bin(35)) returns (fixed bin(35));
 98 
 99      dcl                                                    /*        static variables                        */
100           BACKSPACE                     char(1) aligned int static init ("^H");
101 
102           /* END OF:          rdc_start_.incl.pl1             *  *  *  *  *  *  */