1 /* START OF: rdc_tracing_fcns_.incl.pl1 * * * * * * * * * * * * * * * * */ 2 3 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 4 /* */ 5 /* N^H__^Ha_^Hm_^He: rdc_tracing_fcns_.incl.pl1 */ 6 /* */ 7 /* This include segment is used by compilers generated by the reduction_compiler. */ 8 /* It includes a PRINT_REDUCTION procedure which prints eached matched reduction, and a */ 9 /* PRINT_TOKENS procedure which print the tokens which match the reduction. This output */ 10 /* helps trace the flow of control through the reductions. */ 11 /* */ 12 /* E^H__^Hn_^Ht_^Hr_^Hy: PRINT_REDUCTION */ 13 /* */ 14 /* This entry prints the matched reduction. */ 15 /* */ 16 /* U^H__^Hs_^Ha_^Hg_^He */ 17 /* */ 18 /* call PRINT_REDUCTION(NRED) */ 19 /* */ 20 /* 1) NRED is the number of the matched reduction. */ 21 /* */ 22 /* E^H__^Hn_^Ht_^Hr_^Hy: PRINT_TOKENS */ 23 /* */ 24 /* The entry prints the tokens which matched the matching reduction. */ 25 /* */ 26 /* U^H__^Hs_^Ha_^Hg_^He */ 27 /* */ 28 /* call PRINT_TOKENS (DIRECTION, FIRST, LAST) */ 29 /* */ 30 /* 1) DIRECTION is +1 in a non-PUSH DDOWN LANGUAGE translator, and -1 in a PUSH DOWN */ 31 /* LANGUAGE translator. */ 32 /* 2) FIRST is number of the first syntax specification of this reduction. */ 33 /* 3) LAST is the number of the last syntax specification of this reduction. */ 34 /* */ 35 /* S^H__^Ht_^Ha_^Ht_^Hu_^Hs */ 36 /* */ 37 /* 0) Created by: G. C. Dixon, February, 1981 for reductions command, version 2.3 */ 38 /* */ 39 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 40 41 PRINT_REDUCTION: 42 proc (NRED); 43 44 dcl NRED fixed bin, 45 ioa_ entry() options(variable); 46 47 call ioa_ ("^a", RED_TEXT(NRED)); 48 49 end PRINT_REDUCTION; 50 51 52 PRINT_TOKENS: 53 proc (DIRECTION, FIRST, LAST); 54 55 dcl DIRECTION fixed bin, 56 (FIRST, LAST) fixed bin; 57 58 dcl Itoken fixed bin, 59 count fixed bin; 60 61 dcl ioa_$nnl entry() options(variable); 62 63 if Ptoken = null then do; 64 call ioa_$nnl ("<NO TOKENS LEFT>^/"); 65 return; 66 end; 67 68 if DIRECTION = -1 then do; /* PUSH DOWN LANGUAGE */ 69 count = FIRST - LAST + 1; 70 if count = 0 then do; 71 call ioa_$nnl ("^/"); 72 return; 73 end; 74 PTOKEN_REQD = addr(TOKEN_REQUIREMENT(FIRST)); 75 if TOKEN_REQD.FORM = 0 & TOKEN_REQD.TYPE = 0 then 76 count = count - 1; /* A <no-token> syntax function does not match a */ 77 /* token. */ 78 do Itoken = 1 to count-1 while(token.Plast ^= null); 79 Ptoken = token.Plast; 80 end; 81 do Ptoken = Ptoken repeat token.Pnext while (Ptoken ^= Pthis_token); 82 call ioa_$nnl ("^a ", token_value); 83 end; 84 call ioa_$nnl ("^a^/", token_value); 85 end; 86 else do; 87 count = LAST - FIRST + 1; 88 do Itoken = 1 to count; 89 call ioa_$nnl ("^a ", token_value); 90 Ptoken = token.Pnext; 91 end; 92 call ioa_$nnl ("^/"); 93 Ptoken = Pthis_token; 94 end; 95 96 end PRINT_TOKENS; 97 98 99 100 /* END OF: rdc_tracing_fcns_.incl.pl1 * * * * * * * * * * * * * * * * */