Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap4_198111 - decus/20-0122/analzr.lst
There is 1 other file named analzr.lst in the archive. Click here to see a list.
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 1
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
    1     /*  ANALYZER                                                                  *
    2                   THE SYNTAX ANALYSIS AND TABLE BUILDING PROGRAM                  *
    3                   OF THE XPL SYSTEM.                                              *
    4                                                                                   *
    5        J. J. HORNING AND W. M. MC KEEMAN      STANFORD UNIVERSITY                 *
    6                                                                                   *
    7        THIS PROGRAM BUILDS TABLES DIRECTLY ACCEPTABLE FOR USE IN                  *
    8           THE COMPILER XCOM OR THE PROTO-COMPILER SKELETON.                       *
    9                                                                                   *
   10     INPUT TO ANALYZER MAY BE NEARLY "FREE FORMAT."                                *
   11     CARDS WITH THE CHARACTER $ IN COLUMN 1 ARE TREATED AS COMMENT OR CONTROL      *
   12        CARDS, AND LISTED UNCHANGED.  THE CHARACTER IN COLUMN 2 IS THE CONTROL     *
   13        CHARACTER, AS FOLLOWS:                                                     *
   14           L   COMPLEMENT LISTING MODE,                                            *
   15           T   COMPLEMENT TRACING MODE,                                            *
   16           P   COMPLEMENT PUNCHING MODE,                                           *
   17           O   COMPLEMENT LINE PRINTER LISTING OF COMPUTED "CARD OUTPUT,"          *
   18           I   COMPLEMENT ITERATIVE IMPROVEMENT MODE,                              *
   19           EOG   END OF GRAMMAR;  (ANOTHER GRAMMAR FOLLOWS).                       *
   20                                                                                   *
   21     BLANK CARDS ARE IGNORED.                                                      *
   22     PRODUCTIONS ARE PLACED ONE TO A CARD.                                         *
   23     A TOKEN IS                                                                    *
   24        ANY CONSECUTIVE GROUP OF NON-BLANK CHARACTERS NOT BEGINNING WITH A  "<"    *
   25           AND FOLLOWED BY A BLANK,                                                *
   26        THE CHARACTER "<"  FOLLOWED BY A BLANK,                                    *
   27        THE CHARACTER "<"  FOLLOWED BY A NON-BLANK CHARACTER AND THEN ANY          *
   28           STRING OF BLANK OR NON-BLANK CHARACTERS UP TO AND INCLUDING THE         *
   29           NEXT OCCURRENCE OF THE CHARACTER "<".                                   *
   30                                                                                   *
   31     IF COLUMN 1 IS NON-BLANK, THE FIRST TOKEN ON THE CARD IS TAKEN TO BE THE      *
   32        LEFT PART OF THE PRODUCTION;  OTHERWISE, THE LEFT PART IS TAKEN TO BE      *
   33        THE LEFT PART OF THE PREVIOUS PRODUCTION.                                  *
   34     THE BALANCE OF THE CARD (UP TO FIVE TOKENS) IS TAKEN TO BE THE RIGHT PART.    *
   35     ANY SYMBOL WHICH DOES NOT OCCUR AS A LEFT PART IS A TERMINAL SYMBOL.          *
   36     ANY SYMBOL WHICH OCCURS ONLY AS A LEFT PART IS A GOAL SYMBOL.                 *
   37     ALL PRODUCTIONS WITH THE SAME LEFT PART MUST BE GROUPED.                      *
   38                                                                                   *
   39     PRODUCTIONS ARE REFORMATTED FOR READABILITY (INCLUDING THE INSERTION OF       *
   40        THE META-SYMBOLS  ::=  AND  ^  )  BEFORE LISTING.                          *
   41     BLANKS BETWEEN TOKENS ARE NOT SIGNIFICANT.                                    *
   42                                                                         */        *
   43     /* FIRST COME THE GLOBAL VARIABLE DECLARATIONS:        */                     *
   44                                                                                   *
   45     DECLARE V(255) CHARACTER, (LEFT_PART, RIGHT_HEAD) (255) BIT(8),               *
   46        PRODUCTION(255) BIT(32), (ON_LEFT, ON_RIGHT) (255) BIT(1);                 *
   47     DECLARE INDEX(255) BIT(8), (IND, IND1) (255) BIT(16);                         *
   48     DECLARE SORT#(255) FIXED, AMBIGUOUS BIT(1);                                   *
   49     DECLARE (NSY, NPR, SP, CP, NT, LEVEL, GOAL_SYMBOL) FIXED;                     *
   50                                                                                   *
   51     DECLARE CONTROL(255) BIT(1);                                                  *
   52     DECLARE TRUE LITERALLY '1', FALSE LITERALLY '0';                              *
   53     DECLARE CARRIAGE LITERALLY '1', PUNCH LITERALLY '2', DISK LITERALLY '3',      *
   54        PAGE CHARACTER INITIAL ('1'), DOUBLE CHARACTER INITIAL ('0'),              *
   55        EJECT_PAGE LITERALLY 'OUTPUT(1) = PAGE',                                   *
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 2
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
   56        DOUBLE_SPACE LITERALLY 'OUTPUT(1) = DOUBLE';                               *
   57     DECLARE DOLLAR LITERALLY 'BYTE(''$'')', BLANK LITERALLY 'BYTE('' '')';        *
   58     DECLARE CHANGE BIT(1), WORK("4000") BIT(8);                                   *
   59     DECLARE HEAD(255) FIXED, TAIL(255) BIT(8);                                    *
   60     DECLARE STACKLIMIT LITERALLY '200', TEXTLIMIT LITERALLY '255',                *
   61        DEPTH LITERALLY '255';   /*  MUST BE AT LEAST 255  */                      *
   62     DECLARE STACK(STACKLIMIT) BIT(8), TEXT(TEXTLIMIT) BIT(8),                     *
   63        TOKEN_SAVE(DEPTH) BIT(8), TOKEN FIXED, MP_SAVE(DEPTH) BIT(8), MP FIXED,    *
   64        TP_SAVE(DEPTH) BIT(8), TP FIXED, P_SAVE(DEPTH) BIT(8), P FIXED;            *
   65     DECLARE HEAD_TABLE("2000") BIT(8);                                            *
   66        DECLARE EMPTY CHARACTER INITIAL('                                          *
   67                                         ');  /* IMAGE OF BLANK CARD  */           *
   68     DECLARE HALF_LINE CHARACTER INITIAL ('                                        *
   69                             '), X12 CHARACTER INITIAL ('            ');           *
   70     DECLARE CARDIMAGE CHARACTER, OUTCARD CHARACTER, S CHARACTER, T CHARACTER;     *
   71     DECLARE (NETRY, FIRST_TIME, LAST_TIME, THIS_TIME) FIXED;                      *
   72     DECLARE COUNT(3) FIXED;                                                       *
   73     DECLARE PRINT(3) CHARACTER INITIAL (' ', 'Y', 'N', '#');                      *
   74     DECLARE DOTS CHARACTER INITIAL (' ... ');                                     *
   75     DECLARE VALUE(1) FIXED INITIAL (2, 1);                                        *
   76     DECLARE (I, J, K, L, M) FIXED;                                                *
   77     DECLARE ERROR_COUNT FIXED;                                                    *
   78     DECLARE TERMINATOR FIXED;                                                     *
   79     DECLARE MAXNF11 LITERALLY '5000', MAXNTRIP LITERALLY '1000';                  *
   80     DECLARE F11(MAXNF11) FIXED, NF11 FIXED;                                       *
   81     DECLARE TRIPLE(MAXNTRIP) FIXED, TV(MAXNTRIP) BIT(2), NTRIP FIXED;             *
   82     DECLARE STACKING BIT(1) INITIAL (TRUE);  /* CONTROLS BATCHING OF GRAMMARS  */ *
   83     DECLARE MAXTROUBLE LITERALLY '50', TROUBLE1(MAXTROUBLE) BIT(8),               *
   84        TROUBLE2(MAXTROUBLE) BIT(8), TROUBLE_COUNT FIXED;                          *
   85     DECLARE (BASIC_NSY, BASIC_NPR) FIXED;                                         *
   86     DECLARE ITERATION_COUNT FIXED;                                                *
   87                                                                                   *
   88     /* NOW SOME DATA PACKING/UNPACKING PROCEDURES USED BELOW   */                 *
   89                                                                                   *
   90  IS_HEAD:                                                                         *
   91     PROCEDURE (I, J) BIT(1);                                                      *
   92     /* THIS PROCEDURE DECODES THE PACKED HEAD TABLE.  TRUE IF V(J) IS A HEAD       IS_HEAD
   93        OF V(I)     */                                                              IS_HEAD
   94     /* WE MUST SIMULATE DOUBLE SUBSCRIPT FOR ARRAY                                 IS_HEAD
   95        HEAD_TABLE(0:255, 0:255) BIT(1)  */                                         IS_HEAD
   96                                                                                    IS_HEAD
   97     DECLARE (I, J) FIXED;                                                          IS_HEAD
   98     RETURN 1 & SHR(HEAD_TABLE(SHL(I,5)+SHR(J,3)), J & 7);                          IS_HEAD
   99  END IS_HEAD;                                                                      IS_HEAD

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15195     DATA     91       1
J               FIXED     15196     DATA     91       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 3
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  100                                                                                   *
  101  SET_HEAD:                                                                        *
  102     PROCEDURE (I, J);                                                             *
  103     /* THIS PROCEDURE ADDS V(J) AS A HEAD OF V(I) IN THE HEAD_TABLE  */            SET_HEAD
  104                                                                                    SET_HEAD
  105     DECLARE (I, J, K, L) FIXED;                                                    SET_HEAD
  106     CHANGE = TRUE;                                                                 SET_HEAD
  107     K = SHL(I, 5) + SHR(J, 3);                                                     SET_HEAD
  108     L = SHL(1, J & 7);                                                             SET_HEAD
  109     HEAD_TABLE(K) = HEAD_TABLE(K) ^ L;                                             SET_HEAD
  110  END SET_HEAD;                                                                     SET_HEAD

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15197     DATA    102       1
J               FIXED     15198     DATA    102       2
K               FIXED     15199     DATA    105       3
L               FIXED     15200     DATA    105       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 4
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  111                                                                                   *
  112  CLEAR_HEADS:                                                                     *
  113     PROCEDURE;                                                                    *
  114     DECLARE I FIXED;                                                               CLEAR_HEADS
  115     DO I = 0 TO "2000";                                                            CLEAR_HEADS
  116        HEAD_TABLE(I) = 0;                                                          CLEAR_HEADS C5 = 8192
  117     END;                                                                           CLEAR_HEADS
  118  END CLEAR_HEADS;                                                                  CLEAR_HEADS

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15201     DATA    114       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 5
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  119                                                                                   *
  120  GET:                                                                             *
  121     PROCEDURE (I, J) BIT(2);                                                      *
  122     DECLARE (I, J) FIXED;                                                          GET
  123     /* THIS PROCEDURE DECODES A 2-BIT ENTRY IN THE WORK MATRIX  */                 GET
  124     /* WE MUST SIMULATE DOUBLE SUBSCRIPT FOR ARRAY                                 GET
  125       WORK(0:255, 0:255) BIT(2)  */                                                GET
  126                                                                                    GET
  127     RETURN 3 & SHR(WORK(SHL(I,6)+SHR(J,2)), SHL(J & 3, 1));                        GET
  128  END GET;                                                                          GET

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15203     DATA    121       1
J               FIXED     15204     DATA    121       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 6
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  129                                                                                   *
  130  SET:                                                                             *
  131     PROCEDURE (I, J, VAL);                                                        *
  132     /* THIS PROCEDURE OR'S A 2-BIT VAL INTO THE WORK MATRIX    */                  SET
  133                                                                                    SET
  134     DECLARE (I, J, VAL) FIXED;                                                     SET
  135     DECLARE (K, L) FIXED;                                                          SET
  136     K = SHL(I, 6) + SHR(J, 2);                                                     SET
  137     L = SHL(VAL & 3, SHL(J & 3, 1));                                               SET
  138     WORK(K) = WORK(K) ^ L;                                                         SET
  139  END SET;                                                                          SET

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15205     DATA    131       1
J               FIXED     15206     DATA    131       2
K               FIXED     15208     DATA    135       3
L               FIXED     15209     DATA    135       2
VAL             FIXED     15207     DATA    131       1
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 7
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  140                                                                                   *
  141  CLEAR_WORK:                                                                      *
  142     PROCEDURE;                                                                    *
  143     DECLARE I FIXED;                                                               CLEAR_WORK
  144     DO I = 0 TO "4000";                                                            CLEAR_WORK
  145        WORK(I) = 0;                                                                CLEAR_WORK C6 = 16384
  146     END;                                                                           CLEAR_WORK
  147  END CLEAR_WORK;                                                                   CLEAR_WORK

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15210     DATA    143       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 8
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  148                                                                                   *
  149  PACK:                                                                            *
  150     PROCEDURE (B1, B2, B3, B4) FIXED;                                             *
  151     /* THIS PROCEDURE HAS THE VALUE OF THE 4 BYTES PACKED INTO A 32-BIT WORD  */   PACK
  152                                                                                    PACK
  153     DECLARE (B1, B2, B3, B4) BIT(8);                                               PACK
  154     RETURN (SHL(B1,24) + SHL(B2,16) + SHL(B3,8) + B4) & "FFFFFFFF";                PACK
  155  END PACK;                                                                         PACK C7 = 4294967295

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
B1              BIT (9)   15212     DATA    150       1
B2              BIT (9)   15213     DATA    150       1
B3              BIT (9)   15214     DATA    150       1
B4              BIT (9)   15215     DATA    150       1
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 9
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  156                                                                                   *
  157  ERROR:                                                                           *
  158     PROCEDURE (MESSAGE);                                                          *
  159        DECLARE MESSAGE CHARACTER;                                                  ERROR
  160        OUTPUT = '*** ERROR, ' ^^ MESSAGE;                                          ERROR
  161        ERROR_COUNT = ERROR_COUNT + 1;                                              ERROR
  162     END ERROR;                                                                     ERROR

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
MESSAGE         CHARACTER   275   STRING    158       1
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 10
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  163                                                                                   *
  164  ENTER:                                                                           *
  165     PROCEDURE (ENV, VAL);                                                         *
  166     /* THIS PROCEDURE RECORDS TOGETHER THE 2-BIT VAL 'S FOR EACH UNIQUE ENV        ENTER
  167           TO ASSIST TABLE LOOKUP, THE ENV 'S ARE STORED IN ASCENDING ORDER.        ENTER
  168           THEY ARE LOCATED BY A BINARY SEARCH    */                                ENTER
  169                                                                                    ENTER
  170     DECLARE (ENV, VAL, I, J, K) FIXED;                                             ENTER
  171     NETRY = NETRY + 1; /* COUNT ENTRIES VS. UNIQUE ENTRIES */                      ENTER
  172     I = 0;  K = NTRIP + 1;                                                         ENTER
  173     DO WHILE I + 1 < K; /* BINARY LOOK-UP */                                       ENTER
  174        J = SHR(I+K,1);                                                             ENTER
  175        IF TRIPLE(J) > ENV THEN K = J;                                              ENTER
  176        ELSE IF TRIPLE(J) < ENV THEN I = J;                                         ENTER
  177        ELSE                                                                        ENTER
  178           DO;                                                                      ENTER
  179              TV(J) = TV(J) ^ VAL;                                                  ENTER
  180              RETURN;                                                               ENTER
  181           END;                                                                     ENTER
  182     END;                                                                           ENTER
  183     IF NTRIP >= MAXNTRIP THEN                                                      ENTER
  184        DO;                                                                         ENTER
  185           CALL ERROR ('TOO MANY TRIPLES FOR TABLE');                               ENTER
  186           NTRIP = 0;                                                               ENTER
  187        END;                                                                        ENTER
  188     DO J = 0 TO NTRIP - K;  /* MAKE ROOM IN TABLE FOR NEW ENTRY */                 ENTER
  189        I = NTRIP - J;                                                              ENTER
  190        TRIPLE(I+1) = TRIPLE(I);                                                    ENTER
  191        TV(I+1) = TV(I);                                                            ENTER
  192     END;                                                                           ENTER
  193     NTRIP = NTRIP + 1;                                                             ENTER
  194     TRIPLE(K) = ENV;                                                               ENTER
  195     TV(K) = VAL;                                                                   ENTER
  196  END ENTER;                                                                        ENTER

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
ENV             FIXED     15220     DATA    165       3
I               FIXED     15222     DATA    170       9
J               FIXED     15223     DATA    170       9
K               FIXED     15224     DATA    170       7
VAL             FIXED     15221     DATA    165       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 11
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  197                                                                                   *
  198  ADD_TROUBLE:                                                                     *
  199     PROCEDURE (LEFT, RIGHT);                                                      *
  200        DECLARE (LEFT, RIGHT) FIXED;                                                ADD_TROUBLE
  201        DECLARE I FIXED;                                                            ADD_TROUBLE
  202        IF LEFT > BASIC_NSY THEN RETURN;                                            ADD_TROUBLE
  203        IF LEFT = TERMINATOR THEN RETURN;                                           ADD_TROUBLE
  204        IF TROUBLE_COUNT = MAXTROUBLE THEN RETURN;  /* TROUBLE ENOUGH  */           ADD_TROUBLE
  205        DO I = 1 TO TROUBLE_COUNT;                                                  ADD_TROUBLE
  206           IF TROUBLE1(I) = LEFT THEN IF TROUBLE2(I) = RIGHT THEN RETURN;           ADD_TROUBLE
  207        END;                                                                        ADD_TROUBLE
  208        TROUBLE_COUNT = TROUBLE_COUNT + 1;                                          ADD_TROUBLE
  209        TROUBLE1(TROUBLE_COUNT) = LEFT;                                             ADD_TROUBLE
  210        TROUBLE2(TROUBLE_COUNT) = RIGHT;                                            ADD_TROUBLE
  211     END ADD_TROUBLE;                                                               ADD_TROUBLE

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15235     DATA    201       3
LEFT            FIXED     15233     DATA    199       4
RIGHT           FIXED     15234     DATA    199       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 12
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  212                                                                                   *
  213  LINE_OUT:                                                                        *
  214     PROCEDURE (NUMBER, LINE);                                                     *
  215     /* NUMBER A LINE AND PRINT IT  */                                              LINE_OUT
  216                                                                                    LINE_OUT
  217     DECLARE NUMBER FIXED, LINE CHARACTER;                                          LINE_OUT
  218     DECLARE N CHARACTER;                                                           LINE_OUT
  219     N = NUMBER;  NUMBER = 6 - LENGTH(N);  /* 6 = MARGIN */                         LINE_OUT
  220     OUTPUT = SUBSTR(EMPTY, 0, NUMBER) ^^ N ^^ '   ' ^^ LINE;                       LINE_OUT
  221  END LINE_OUT;                                                                     LINE_OUT

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
LINE            CHARACTER   278   STRING    214       1
N               CHARACTER   279   STRING    218       3
NUMBER          FIXED     15237     DATA    214       3
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 13
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  222                                                                                   *
  223  BUILD_CARD:                                                                      *
  224     PROCEDURE (ITEM);                                                             *
  225     /* ADD ITEM TO OUTCARD AND PUNCH IF CARD BOUNDARY EXCEEDED */                  BUILD_CARD
  226                                                                                    BUILD_CARD
  227     DECLARE ITEM CHARACTER;                                                        BUILD_CARD
  228     IF LENGTH(ITEM) + LENGTH(OUTCARD) >= 80 THEN                                   BUILD_CARD
  229        DO;                                                                         BUILD_CARD
  230           IF CONTROL(BYTE('P')) THEN OUTPUT(PUNCH) = OUTCARD;                      BUILD_CARD
  231           IF CONTROL(BYTE('O')) THEN                                               BUILD_CARD
  232              OUTPUT = '--- CARD OUTPUT ---^' ^^ OUTCARD;                           BUILD_CARD
  233           OUTCARD = '      ' ^^ ITEM;                                              BUILD_CARD
  234        END;                                                                        BUILD_CARD
  235     ELSE OUTCARD = OUTCARD ^^ ' ' ^^ ITEM;                                         BUILD_CARD
  236  END BUILD_CARD;                                                                   BUILD_CARD

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
ITEM            CHARACTER   281   STRING    224       3
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 14
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  237                                                                                   *
  238  PUNCH_CARD:                                                                      *
  239     PROCEDURE (ITEM);                                                             *
  240     /*  PUNCH OUTCARD AND ITEM  */                                                 PUNCH_CARD
  241                                                                                    PUNCH_CARD
  242     DECLARE ITEM CHARACTER;                                                        PUNCH_CARD
  243     CALL BUILD_CARD (ITEM);                                                        PUNCH_CARD
  244     IF CONTROL(BYTE('P')) THEN OUTPUT(PUNCH) = OUTCARD;                            PUNCH_CARD
  245     IF CONTROL(BYTE('O')) THEN                                                     PUNCH_CARD
  246        OUTPUT = '--- CARD OUTPUT ---^' ^^ OUTCARD;                                 PUNCH_CARD
  247     OUTCARD = '  ';                                                                PUNCH_CARD
  248  END PUNCH_CARD;                                                                   PUNCH_CARD

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
ITEM            CHARACTER   285   STRING    239       1
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 15
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  249                                                                                   *
  250  PRINT_MATRIX:                                                                    *
  251     PROCEDURE (TITLE, SOURCE);                                                    *
  252     /* PRINT AND LABEL THE MATRIX SPECIFIED BY SOURCE (HEAD_TABLE OR WORK)  */     PRINT_MATRIX
  253                                                                                    PRINT_MATRIX
  254     DECLARE TITLE CHARACTER, SOURCE FIXED;                                         PRINT_MATRIX
  255     DECLARE (I, J, K, L, M, N, BOT, TOP, MARGIN_SIZE, NUMBER_ACROSS, WIDE) FIXED,  PRINT_MATRIX
  256        (MARGIN, LINE, WASTE, BAR, PAGES) CHARACTER,                                PRINT_MATRIX
  257        DIGIT(9) CHARACTER INITIAL ('0','1','2','3','4','5','6','7','8','9'),       PRINT_MATRIX
  258        NUMBER_HIGH LITERALLY '48',                                                 PRINT_MATRIX
  259        GS LITERALLY '16';                                                          PRINT_MATRIX
  260     IF SOURCE = 1 THEN WIDE = NT;  ELSE WIDE = NSY;                                PRINT_MATRIX
  261     MARGIN_SIZE = 5;                                                               PRINT_MATRIX
  262     DO I = 1 TO NSY;                                                               PRINT_MATRIX
  263        IF LENGTH(V(I)) >= MARGIN_SIZE THEN MARGIN_SIZE = LENGTH(V(I)) + 1;         PRINT_MATRIX
  264     END;                                                                           PRINT_MATRIX
  265     MARGIN = SUBSTR('                                                              PRINT_MATRIX
  266                   ', 0, MARGIN_SIZE);                                              PRINT_MATRIX
  267     WASTE = MARGIN ^^ '          ';                                                PRINT_MATRIX
  268     NUMBER_ACROSS = (122 - MARGIN_SIZE)/(GS + 1)*GS;                               PRINT_MATRIX
  269     DO I = 0 TO 3;                                                                 PRINT_MATRIX
  270        COUNT(I) = 0;                                                               PRINT_MATRIX C8 = 3
  271     END;                                                                           PRINT_MATRIX
  272     M = 0;                                                                         PRINT_MATRIX
  273     I = (WIDE-1)/NUMBER_ACROSS + 1;                                                PRINT_MATRIX
  274     PAGES = ((NSY-1)/NUMBER_HIGH + 1)*I;                                           PRINT_MATRIX
  275     DO I = 0 TO (WIDE-1)/NUMBER_ACROSS;                                            PRINT_MATRIX
  276        BOT = NUMBER_ACROSS*I + 1;                                                  PRINT_MATRIX
  277        TOP = NUMBER_ACROSS*(I+1);                                                  PRINT_MATRIX
  278        IF TOP > WIDE THEN TOP = WIDE;                                              PRINT_MATRIX
  279        BAR = SUBSTR(WASTE, 1) ^^ '+';                                              PRINT_MATRIX
  280        DO L = BOT TO TOP;                                                          PRINT_MATRIX C9 = 134217727
  281           BAR = BAR ^^ '-';                                                        PRINT_MATRIX
  282           IF L MOD GS = 0 THEN BAR = BAR ^^ '+';                                   PRINT_MATRIX
  283        END;                                                                        PRINT_MATRIX
  284        IF TOP MOD GS \= 0 THEN BAR = BAR ^^ '+';                                   PRINT_MATRIX
  285        DO J = 0 TO (NSY-1)/NUMBER_HIGH;                                            PRINT_MATRIX
  286           /*  ONCE PER PAGE OF PRINTOUT  */                                        PRINT_MATRIX
  287           EJECT_PAGE;                                                              PRINT_MATRIX
  288           M = M + 1;                                                               PRINT_MATRIX
  289           OUTPUT = TITLE ^^ ':  PAGE ' ^^ M ^^ ' OF ' ^^ PAGES;                    PRINT_MATRIX
  290           DOUBLE_SPACE;                                                            PRINT_MATRIX
  291           L = 100;                                                                 PRINT_MATRIX
  292           DO WHILE L > 0;                                                          PRINT_MATRIX
  293              LINE = WASTE;                                                         PRINT_MATRIX
  294              DO N = BOT TO TOP;                                                    PRINT_MATRIX
  295                 IF N < L THEN LINE = LINE ^^ ' ';                                  PRINT_MATRIX
  296                 ELSE LINE = LINE ^^ DIGIT(N/L MOD 10);                             PRINT_MATRIX
  297                 IF N MOD GS = 0 THEN LINE = LINE ^^ ' ';                           PRINT_MATRIX
  298              END;                                                                  PRINT_MATRIX
  299              OUTPUT = LINE;                                                        PRINT_MATRIX
  300              L = L / 10;                                                           PRINT_MATRIX
  301           END;                                                                     PRINT_MATRIX
  302           OUTPUT = BAR;                                                            PRINT_MATRIX
  303           N = NUMBER_HIGH*(J+1);                                                   PRINT_MATRIX
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 16
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  304           IF N > NSY THEN N = NSY;                                                 PRINT_MATRIX
  305           DO K = NUMBER_HIGH*J + 1 TO N;                                           PRINT_MATRIX
  306              L = LENGTH(V(K));                                                     PRINT_MATRIX
  307              LINE = V(K) ^^ SUBSTR(MARGIN, L) ^^ '^';                              PRINT_MATRIX
  308              DO L = BOT TO TOP;                                                    PRINT_MATRIX
  309                 IF SOURCE \= 0 THEN                                                PRINT_MATRIX
  310                    DO;                                                             PRINT_MATRIX
  311                       N = GET (K, L);                                              PRINT_MATRIX
  312                       LINE = LINE ^^ PRINT(N);                                     PRINT_MATRIX
  313                       COUNT(N) = COUNT(N) + 1;                                     PRINT_MATRIX
  314                    END;                                                            PRINT_MATRIX
  315                 ELSE LINE = LINE ^^ PRINT(IS_HEAD (K, L));                         PRINT_MATRIX
  316                 IF L MOD GS = 0 THEN LINE = LINE ^^ '^';                           PRINT_MATRIX
  317              END;                                                                  PRINT_MATRIX
  318              IF TOP MOD GS \= 0 THEN LINE = LINE ^^ '^';                           PRINT_MATRIX
  319              CALL LINE_OUT (K, LINE);                                              PRINT_MATRIX
  320              IF K MOD GS = 0 THEN                                                  PRINT_MATRIX
  321                 OUTPUT = BAR;                                                      PRINT_MATRIX
  322           END;                                                                     PRINT_MATRIX
  323           IF K MOD GS \= 1 THEN OUTPUT = BAR;                                      PRINT_MATRIX
  324        END;                                                                        PRINT_MATRIX
  325     END;                                                                           PRINT_MATRIX
  326     DOUBLE_SPACE;                                                                  PRINT_MATRIX
  327     IF SOURCE \= 0 THEN                                                            PRINT_MATRIX
  328        DO;                                                                         PRINT_MATRIX
  329           OUTPUT = 'TABLE ENTRIES SUMMARY:';                                       PRINT_MATRIX
  330           DO I = 0 TO 3;                                                           PRINT_MATRIX
  331              CALL LINE_OUT (COUNT(I), PRINT(I));                                   PRINT_MATRIX
  332           END;                                                                     PRINT_MATRIX
  333        END;                                                                        PRINT_MATRIX
  334  END PRINT_MATRIX;                                                                 PRINT_MATRIX

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
BAR             CHARACTER   292   STRING    256      10
BOT             FIXED     15258     DATA    255       4
DIGIT           CHARACTER   294   STRING    257       1
I               FIXED     15252     DATA    255      13
J               FIXED     15253     DATA    255       3
K               FIXED     15254     DATA    255       8
L               FIXED     15255     DATA    255      14
LINE            CHARACTER   290   STRING    256      18
M               FIXED     15256     DATA    255       4
MARGIN          CHARACTER   289   STRING    256       3
MARGIN_SIZE     FIXED     15260     DATA    255       5
N               FIXED     15257     DATA    255      12
NUMBER_ACROSS   FIXED     15261     DATA    255       5
PAGES           CHARACTER   293   STRING    256       2
SOURCE          FIXED     15251     DATA    251       3
TITLE           CHARACTER   288   STRING    251       1
TOP             FIXED     15259     DATA    255       8
WASTE           CHARACTER   291   STRING    256       3
WIDE            FIXED     15262     DATA    255       6
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 17
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  335                                                                                   *
  336  PRINT_TRIPLES:                                                                   *
  337     PROCEDURE (TITLE);                                                            *
  338     /* FORMAT AND PRINT THE (2,1) TRIPLES FOR C1  */                               PRINT_TRIPLES
  339                                                                                    PRINT_TRIPLES
  340     DECLARE TITLE CHARACTER, (I, J) FIXED;                                         PRINT_TRIPLES
  341     IF NTRIP = 0 THEN                                                              PRINT_TRIPLES
  342        DO;                                                                         PRINT_TRIPLES
  343           DOUBLE_SPACE;                                                            PRINT_TRIPLES
  344           OUTPUT = 'NO TRIPLES REQUIRED.';                                         PRINT_TRIPLES
  345           COUNT(1) = 0;   /* SO WE DON'T PUNCH ANY  */                             PRINT_TRIPLES
  346           RETURN;                                                                  PRINT_TRIPLES
  347        END;                                                                        PRINT_TRIPLES
  348     EJECT_PAGE;                                                                    PRINT_TRIPLES
  349     OUTPUT = TITLE ^^ ':';                                                         PRINT_TRIPLES
  350     DOUBLE_SPACE;                                                                  PRINT_TRIPLES
  351     DO I = 1 TO 3;                                                                 PRINT_TRIPLES
  352        COUNT(I) = 0;                                                               PRINT_TRIPLES
  353     END;                                                                           PRINT_TRIPLES
  354     DO I = 1 TO NTRIP;                                                             PRINT_TRIPLES
  355        J = TRIPLE(I);                                                              PRINT_TRIPLES
  356        K = TV(I);                                                                  PRINT_TRIPLES
  357        IF K = 3 THEN                                                               PRINT_TRIPLES
  358           DO;                                                                      PRINT_TRIPLES
  359              CALL ERROR ('STACKING DECISION CANNOT BE MADE WITH (2,1) CONTEXT:');  PRINT_TRIPLES
  360              CALL ADD_TROUBLE (SHR(J, 16), SHR(J, 8) & "FF");                      PRINT_TRIPLES
  361           END;                                                                     PRINT_TRIPLES
  362        CALL LINE_OUT (I, PRINT(K) ^^ ' FOR  ' ^^ V(SHR(J, 16)) ^^ ' ' ^^           PRINT_TRIPLES
  363           V(SHR(J, 8)&"FF") ^^ ' ' ^^ V(J&"FF"));                                  PRINT_TRIPLES
  364        COUNT(K) = COUNT(K) + 1;                                                    PRINT_TRIPLES
  365     END;                                                                           PRINT_TRIPLES
  366     DOUBLE_SPACE;                                                                  PRINT_TRIPLES
  367     OUTPUT = NETRY ^^ ' ENTRIES FOR ' ^^ NTRIP ^^ ' TRIPLES.';                     PRINT_TRIPLES
  368     DOUBLE_SPACE;                                                                  PRINT_TRIPLES
  369     OUTPUT = 'TABLE ENTRIES SUMMARY:';                                             PRINT_TRIPLES
  370     DO I = 1 TO 3;                                                                 PRINT_TRIPLES
  371        CALL LINE_OUT (COUNT(I), PRINT(I));                                         PRINT_TRIPLES
  372     END;                                                                           PRINT_TRIPLES
  373  END PRINT_TRIPLES;                                                                PRINT_TRIPLES

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15310     DATA    340       9
J               FIXED     15311     DATA    340       6
TITLE           CHARACTER   318   STRING    337       1
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 18
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  374                                                                                   *
  375  BUILD_RIGHT_PART:                                                                *
  376     PROCEDURE (P);                                                                *
  377        DECLARE (P, PR) FIXED;                                                      BUILD_RIGHT_PART
  378        PR = PRODUCTION(P);                                                         BUILD_RIGHT_PART
  379        T = '';                                                                     BUILD_RIGHT_PART
  380        DO WHILE PR \= 0;                                                           BUILD_RIGHT_PART
  381           T = ' ' ^^ V(PR&"FF") ^^ T;                                              BUILD_RIGHT_PART
  382           PR = SHR(PR, 8);                                                         BUILD_RIGHT_PART
  383        END;                                                                        BUILD_RIGHT_PART
  384        T = V(RIGHT_HEAD(P)) ^^ T;                                                  BUILD_RIGHT_PART
  385     END BUILD_RIGHT_PART;                                                          BUILD_RIGHT_PART

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
P               FIXED     15345     DATA    376       2
PR              FIXED     15346     DATA    377       5
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 19
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  386                                                                                   *
  387  OUTPUT_PRODUCTION:                                                               *
  388     PROCEDURE (P);                                                                *
  389        DECLARE P FIXED;                                                            OUTPUT_PRODUCTION
  390        CALL BUILD_RIGHT_PART(P);                                                   OUTPUT_PRODUCTION
  391        CALL LINE_OUT (P, V(LEFT_PART(P)) ^^ '  ::=  ' ^^ T);                       OUTPUT_PRODUCTION
  392     END OUTPUT_PRODUCTION;                                                         OUTPUT_PRODUCTION

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
P               FIXED     15348     DATA    388       3
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 20
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  393                                                                                   *
  394  PRINT_TIME:                                                                      *
  395     PROCEDURE;                                                                    *
  396     /* OUTPUT ELAPSED TIMES  */                                                    PRINT_TIME
  397                                                                                    PRINT_TIME
  398     DECLARE (I, J) FIXED, T CHARACTER;                                             PRINT_TIME
  399     DOUBLE_SPACE;                                                                  PRINT_TIME
  400     THIS_TIME = TIME;                                                              PRINT_TIME
  401     I = THIS_TIME - LAST_TIME;                                                     PRINT_TIME
  402     J = I MOD 100;                                                                 PRINT_TIME
  403     I = I / 100;                                                                   PRINT_TIME
  404     T = 'TIME USED WAS ' ^^ I ^^ '.';                                              PRINT_TIME
  405     IF J < 10 THEN T = T ^^ '0';                                                   PRINT_TIME
  406     OUTPUT = T ^^ J ^^ ' SECONDS.';                                                PRINT_TIME
  407     I = THIS_TIME - FIRST_TIME;                                                    PRINT_TIME
  408     J = I MOD 100;                                                                 PRINT_TIME
  409     I = I / 100;                                                                   PRINT_TIME
  410     T = 'TOTAL TIME IS ' ^^ I ^^ '.';                                              PRINT_TIME
  411     IF J < 10 THEN T = T ^^ '0';                                                   PRINT_TIME
  412     OUTPUT = T ^^ J ^^ ' SECONDS.';                                                PRINT_TIME
  413     LAST_TIME = THIS_TIME;                                                         PRINT_TIME
  414  END PRINT_TIME;                                                                   PRINT_TIME

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15351     DATA    398      10
J               FIXED     15352     DATA    398       6
T               CHARACTER   330   STRING    398       8
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 21
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  415                                                                                   *
  416  LOOK_UP:                                                                         *
  417     PROCEDURE (SYMBOL) BIT(8);  /* GET INDEX OF SYMBOL IN V  */                   *
  418     DECLARE SYMBOL CHARACTER;                                                      LOOK_UP
  419     DECLARE J FIXED;                                                               LOOK_UP
  420     DO J = 1 TO NSY;                                                               LOOK_UP
  421        IF V(J) = SYMBOL THEN RETURN J;                                             LOOK_UP
  422     END;                                                                           LOOK_UP
  423     IF J = 256 THEN                                                                LOOK_UP
  424        DO;                                                                         LOOK_UP
  425           CALL ERROR ('TOO MANY SYMBOLS');                                         LOOK_UP
  426           J = 1;                                                                   LOOK_UP
  427        END;                                                                        LOOK_UP
  428     /* ADD SYMBOL TO V  */                                                         LOOK_UP
  429     NSY = J;                                                                       LOOK_UP
  430     V(J) = SYMBOL;                                                                 LOOK_UP
  431     RETURN J;                                                                      LOOK_UP
  432  END LOOK_UP;                                                                      LOOK_UP

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
J               FIXED     15366     DATA    419       8
SYMBOL          CHARACTER   339   STRING    417       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 22
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  433                                                                                   *
  434  EXPAND:                                                                          *
  435     PROCEDURE (F11, P);  /* EXPAND PRODUCTION P IN THE CONTEXT OF F11  */         *
  436     DECLARE (F11, I, J, P, OLDP) FIXED;                                            EXPAND
  437     /* OLDP REMEMBERS ARGUMENT P FROM PREVIOUS CALL TO SAVE REPEATED EFFORT */     EXPAND
  438     IF P \= OLDP THEN                                                              EXPAND
  439        DO;                                                                         EXPAND
  440           OLDP = P;                                                                EXPAND
  441           SP = 2;                                                                  EXPAND
  442           STACK(SP) = RIGHT_HEAD(P);                                               EXPAND
  443           J = PRODUCTION(P);                                                       EXPAND
  444           DO WHILE J \= 0; /* UNPACK PRODUCTION INTO STACK */                      EXPAND
  445              I = SHR(J, 24);                                                       EXPAND
  446              IF I \= 0 THEN                                                        EXPAND
  447                 DO;                                                                EXPAND
  448                    SP = SP + 1;                                                    EXPAND
  449                    STACK(SP) = I;                                                  EXPAND
  450                 END;                                                               EXPAND
  451              J = SHL(J, 8) & "FFFFFFFF";                                           EXPAND
  452           END;                                                                     EXPAND
  453        END;                                                                        EXPAND
  454     STACK(1) = SHR(F11, 8) & "FF";  /* LEFT CONTEXT */                             EXPAND
  455     STACK(SP+1) = F11 & "FF";         /* RIGHT CONTEXT */                          EXPAND
  456  END EXPAND;                                                                       EXPAND

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
F11             FIXED     15372     DATA    435       2
I               FIXED     15373     DATA    436       3
J               FIXED     15374     DATA    436       5
OLDP            FIXED     15376     DATA    436       2
P               FIXED     15375     DATA    435       4
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 23
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  457                                                                                   *
  458                                                                                   *
  459     /*  NOW THE WORKING PROCEDURES  */                                            *
  460                                                                                   *
  461  READ_GRAMMAR:                                                                    *
  462     PROCEDURE;  /*  READ IN AND LIST A GRAMMAR  */                                *
  463     DECLARE (P, LONG) FIXED;                                                       READ_GRAMMAR
  464                                                                                    READ_GRAMMAR
  465     SCAN:                                                                          READ_GRAMMAR
  466       PROCEDURE BIT(8); /* GET A TOKEN FROM INPUT CARDIMAGE  */                    READ_GRAMMAR
  467        DECLARE LP FIXED, LEFT_BRACKET LITERALLY 'BYTE(''<'')',                     SCAN
  468           RIGHT_BRACKET LITERALLY 'BYTE(''>'')', STOP FIXED;                       SCAN
  469        DO CP = CP TO LONG;                                                         SCAN
  470           IF BYTE(CARDIMAGE,CP) \= BLANK & BYTE(CARDIMAGE,CP)                      SCAN
  471              \= 9 THEN      /* NOT A SPACE OR A TAB */                             SCAN
  472              DO;                                                                   SCAN
  473                 LP = CP; /* MARK LEFT BOUNDARY OF SYMBOL */                        SCAN
  474                 IF BYTE(CARDIMAGE,CP) = LEFT_BRACKET & BYTE(CARDIMAGE,CP+1)        SCAN
  475                    \= BLANK THEN                                                   SCAN
  476                    STOP = RIGHT_BRACKET;                                           SCAN
  477                    ELSE STOP = BLANK;                                              SCAN
  478                 DO CP = CP + 1 TO LONG;                                            SCAN
  479                    IF BYTE(CARDIMAGE, CP) = STOP THEN GO TO DELIMIT;               SCAN
  480                 END;                                                               SCAN
  481                 IF STOP \= BLANK THEN                                              SCAN
  482                    DO;                                                             SCAN
  483                       CALL ERROR ('UNMATCHED BRACKET: <');                         SCAN
  484                       CP = CP - 1;                                                 SCAN
  485                       DO WHILE BYTE(CARDIMAGE, CP) = BLANK;  /* ERROR RECOVERY */  SCAN
  486                          CP = CP - 1;                                              SCAN
  487                       END;                                                         SCAN
  488                    END;                                                            SCAN
  489              DELIMIT:                                                              SCAN
  490                 IF STOP \= BLANK THEN CP = CP + 1; /* PICK UP THE > */             SCAN
  491                 T = SUBSTR(CARDIMAGE, LP, CP-LP);  /* PICK UP THE SYMBOL */        SCAN
  492                 RETURN LOOK_UP(T);                                                 SCAN
  493              END;                                                                  SCAN
  494        END;  /* END OF CARD  */                                                    SCAN
  495        T = '';                                                                     SCAN
  496        RETURN 0;                                                                   SCAN
  497     END SCAN;                                                                      SCAN

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
DELIMIT         LABEL      1660  PROGRAM    479       1
LP              FIXED     15379     DATA    467       3
STOP            FIXED     15380     DATA    468       5
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 24
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  498                                                                                    READ_GRAMMAR
  499     GET_CARD:                                                                      READ_GRAMMAR
  500        PROCEDURE BIT(1);  /* READ THE NEXT CARD  */                                READ_GRAMMAR
  501        CP = 0;                                                                     GET_CARD
  502        DO WHILE TRUE;                                                              GET_CARD
  503           CARDIMAGE = INPUT;  /* GET THE CARD */                                   GET_CARD
  504           LONG = LENGTH(CARDIMAGE) - 1;                                            GET_CARD
  505           IF LONG < 0 THEN                                                         GET_CARD
  506              DO;    /*  END OF FILE DETECTED  */                                   GET_CARD
  507                 STACKING = FALSE;                                                  GET_CARD
  508                 RETURN FALSE;                                                      GET_CARD
  509              END;                                                                  GET_CARD
  510           IF BYTE(CARDIMAGE) = DOLLAR THEN                                         GET_CARD
  511              DO;  /* CONTROL CARD OR COMMENT */                                    GET_CARD
  512                 IF SUBSTR(CARDIMAGE, 1, 3) = 'EOG' THEN RETURN FALSE;              GET_CARD
  513                 IF CONTROL(BYTE('L')) THEN OUTPUT = CARDIMAGE;                     GET_CARD C10 = 402653184
  514                 CONTROL(BYTE(CARDIMAGE,1)) = \ CONTROL(BYTE(CARDIMAGE,1));         GET_CARD
  515              END;                                                                  GET_CARD
  516           ELSE IF LENGTH(CARDIMAGE) \= 0 & CARDIMAGE \= EMPTY THEN                 GET_CARD
  517                    RETURN TRUE;                                                    GET_CARD
  518        END;                                                                        GET_CARD
  519     END GET_CARD;                                                                  GET_CARD
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 25
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  520                                                                                    READ_GRAMMAR
  521     SORT_V:                                                                        READ_GRAMMAR
  522        PROCEDURE;  /* SORT THE SYMBOL TABLE  */                                    READ_GRAMMAR
  523        DO I = 1 TO NSY;                                                            SORT_V
  524            /* SORT ON 1.  TERMINAL VS. NON-TERMINAL                                SORT_V
  525                          2.  LENGTH OF SYMBOL                                      SORT_V
  526                             3.  ORIGINAL ORDER OF OCCURRENCE  */                   SORT_V
  527           SORT#(I) = SHL(ON_LEFT(I), 16) ^ SHL(LENGTH(V(I)), 8) ^ I;               SORT_V
  528           SORT#(I) = SORT#(I) & "FFFFFFFF";                                        SORT_V
  529        END;                                                                        SORT_V
  530        /* BUBBLE SORT  */                                                          SORT_V
  531        K, L = NSY;                                                                 SORT_V
  532        DO WHILE K <= L;                                                            SORT_V
  533           L = 0;                                                                   SORT_V
  534           DO I = 2 TO K;                                                           SORT_V
  535              L = I - 1;                                                            SORT_V
  536              IF SORT#(L) > SORT#(I) THEN                                           SORT_V
  537                 DO;                                                                SORT_V
  538                    J = SORT#(L);  SORT#(L) = SORT#(I);  SORT#(I) = J;              SORT_V
  539                    T = V(L);  V(L) = V(I);  V(I) = T;                              SORT_V
  540                    K = L;                                                          SORT_V
  541                 END;                                                               SORT_V
  542           END;                                                                     SORT_V
  543        END;                                                                        SORT_V
  544        DO I = 1 TO NSY; /* BUILD TABLE TO LOCATE SORTED SYMBOLS OF V */            SORT_V
  545           INDEX(SORT#(I)&"FF") = I;                                                SORT_V
  546        END;                                                                        SORT_V
  547        NT = NSY;  /* PREPARE TO COUNT NON-TERMINAL SYMBOLS */                      SORT_V
  548        DO WHILE SORT#(NT) > "10000";  NT = NT - 1;  END;                           SORT_V
  549        /* SUBSTITUTE NEW INDEX NUMBERS IN PRODUCTIONS  */                          SORT_V
  550        DO I = 1 TO NPR;                                                            SORT_V
  551           LEFT_PART(I) = INDEX(LEFT_PART(I));                                      SORT_V
  552           J = INDEX(RIGHT_HEAD(I));                                                SORT_V
  553           ON_RIGHT(J) = TRUE;                                                      SORT_V
  554           RIGHT_HEAD(I) = J;                                                       SORT_V
  555           L = PRODUCTION(I);                                                       SORT_V
  556           DO K = 0 TO 3;                                                           SORT_V
  557              J = INDEX(SHR(L,24)&"FF"); /* INSURANCE FOR 36 BITS */                SORT_V
  558              ON_RIGHT(J) = TRUE;                                                   SORT_V
  559              L = SHL(L,8) + J;                                                     SORT_V
  560           END;                                                                     SORT_V
  561           L = L & "FFFFFFFF";                                                      SORT_V
  562           PRODUCTION(I) = L;                                                       SORT_V
  563        END;                                                                        SORT_V
  564        TERMINATOR = INDEX(1);  /* ADD _^_ TO VOCABULARY */                         SORT_V
  565        ON_RIGHT(TERMINATOR) = TRUE;                                                SORT_V
  566     END SORT_V;                                                                    SORT_V
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 26
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  567                                                                                    READ_GRAMMAR
  568     PRINT_DATE:                                                                    READ_GRAMMAR
  569        PROCEDURE (MESSAGE, D);                                                     READ_GRAMMAR
  570           DECLARE MESSAGE CHARACTER, D FIXED;                                      PRINT_DATE
  571           DECLARE MONTH(11) CHARACTER INITIAL ('JANUARY', 'FEBRUARY', 'MARCH',     PRINT_DATE
  572              'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER',     PRINT_DATE
  573              'NOVEMBER', 'DECEMBER'), DAYS(11) FIXED INITIAL (0, 31, 60, 91,       PRINT_DATE
  574              121, 152, 182, 213, 244, 274, 305, 335);                              PRINT_DATE
  575           DECLARE (YEAR, DAY, M) FIXED;                                            PRINT_DATE
  576                                                                                    PRINT_DATE
  577           YEAR = D/1000 + 1900;                                                    PRINT_DATE
  578           DAY = D MOD 1000;                                                        PRINT_DATE
  579           IF (YEAR & 3) \= 0 THEN IF DAY > 59 THEN DAY = DAY + 1;                  PRINT_DATE
  580           M = 11;                                                                  PRINT_DATE
  581           DO WHILE DAY <= DAYS(M);  M = M - 1;  END;                               PRINT_DATE
  582           OUTPUT = MESSAGE ^^ MONTH(M) ^^ ' ' ^^ DAY-DAYS(M) ^^ ', ' ^^            PRINT_DATE
  583              YEAR ^^ '.';                                                          PRINT_DATE
  584        END PRINT_DATE;                                                             PRINT_DATE

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
D               FIXED     15394     DATA    569       2
DAY             FIXED     15427     DATA    575       6
DAYS            FIXED     15414     DATA    573       2
M               FIXED     15428     DATA    575       6
MESSAGE         CHARACTER   343   STRING    569       1
MONTH           CHARACTER   344   STRING    571       1
YEAR            FIXED     15426     DATA    575       3
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 27
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  585                                                                                    READ_GRAMMAR
  586     EJECT_PAGE;                                                                    READ_GRAMMAR
  587     OUTPUT = 'GRAMMAR ANALYSIS -- UNIVERSITY OF LOUISVILLE';                       READ_GRAMMAR
  588     DOUBLE_SPACE;                                                                  READ_GRAMMAR
  589     CALL PRINT_DATE ('TODAY IS ', DATE);                                           READ_GRAMMAR
  590     DOUBLE_SPACE;                                                                  READ_GRAMMAR
  591     OUTPUT = '             P R O D U C T I O N S';                                 READ_GRAMMAR
  592     DOUBLE_SPACE;                                                                  READ_GRAMMAR
  593     CONTROL(BYTE('L')) = TRUE;                                                     READ_GRAMMAR
  594     V(0) = '<ERROR: TOKEN = 0>';                                                   READ_GRAMMAR
  595     NSY = 1;  V(1) = '_^_';                                                        READ_GRAMMAR
  596     NPR, ERROR_COUNT = 0;                                                          READ_GRAMMAR
  597     DO I = 0 TO 255;  /* CLEAR ON_LEFT AND ON_RIGHT  */                            READ_GRAMMAR
  598        ON_LEFT(I), ON_RIGHT(I) = 0;                                                READ_GRAMMAR C11 = 255
  599     END;                                                                           READ_GRAMMAR
  600     DO WHILE GET_CARD;  /* WATCH SIDE EFFECT */                                    READ_GRAMMAR
  601        IF NPR = 255 THEN CALL ERROR ('TOO MANY PRODUCTIONS');                      READ_GRAMMAR
  602        ELSE NPR = NPR + 1;                                                         READ_GRAMMAR
  603        IF BYTE(CARDIMAGE) = BLANK THEN LEFT_PART(NPR) = LEFT_PART(NPR-1);          READ_GRAMMAR
  604        ELSE                                                                        READ_GRAMMAR
  605           DO;                                                                      READ_GRAMMAR
  606              I = SCAN;      /* LEFT PART SYMBOL  */                                READ_GRAMMAR
  607              LEFT_PART(NPR) = I;                                                   READ_GRAMMAR
  608              ON_LEFT(I) = TRUE;                                                    READ_GRAMMAR
  609           END;                                                                     READ_GRAMMAR
  610        I = SCAN; /* FIRST SYMBOL ON THE RIGHT */                                   READ_GRAMMAR
  611        IF I = 0 THEN CALL ERROR ('EMPTY RIGHT PART.');                             READ_GRAMMAR
  612        RIGHT_HEAD(NPR) = I;                                                        READ_GRAMMAR
  613        J, P = 0;                                                                   READ_GRAMMAR
  614        DO J = 1 TO 4;                                                              READ_GRAMMAR
  615           I = SCAN;                                                                READ_GRAMMAR C12 = 4
  616           IF I \= 0 THEN                                                           READ_GRAMMAR
  617              P = (SHL(P, 8) + I) & "FFFFFFFF";  /* PACK 4 TO A WORD  */            READ_GRAMMAR
  618        END;                                                                        READ_GRAMMAR
  619        IF LENGTH(SUBSTR(CARDIMAGE,CP)) \=0 THEN                                    READ_GRAMMAR
  620           CALL ERROR ('TOO MANY SYMBOLS IN RIGHT PART.  FORCED TO DISCARD  ' ^^    READ_GRAMMAR
  621              SUBSTR(CARDIMAGE, CP));                                               READ_GRAMMAR
  622        PRODUCTION(NPR) = P;                                                        READ_GRAMMAR
  623        IF CONTROL(BYTE('L')) THEN                                                  READ_GRAMMAR
  624           DO;  /* UNPACK TABLE AND PRINT PRODUCTION */                             READ_GRAMMAR
  625              IF LEFT_PART(NPR) = LEFT_PART(NPR-1) THEN                             READ_GRAMMAR
  626                 DO;                                                                READ_GRAMMAR
  627                    I = LENGTH(V(LEFT_PART(NPR)));                                  READ_GRAMMAR
  628                    CARDIMAGE = SUBSTR(EMPTY, 0, I) ^^ '    ^  ';                   READ_GRAMMAR
  629                 END;                                                               READ_GRAMMAR
  630              ELSE                                                                  READ_GRAMMAR
  631                 DO;                                                                READ_GRAMMAR
  632                    OUTPUT = '';                                                    READ_GRAMMAR
  633                    CARDIMAGE = V(LEFT_PART(NPR)) ^^ '  ::=  ';                     READ_GRAMMAR
  634                 END;                                                               READ_GRAMMAR
  635              CALL BUILD_RIGHT_PART(NPR);                                           READ_GRAMMAR
  636              CALL LINE_OUT (NPR, CARDIMAGE ^^ T);                                  READ_GRAMMAR
  637           END;                                                                     READ_GRAMMAR
  638        IF CONTROL(BYTE('P')) THEN                                                  READ_GRAMMAR
  639           DO;  /* UNPACK TABLE AND PRINT PL COMMENT */                             READ_GRAMMAR
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 28
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  640              P = PRODUCTION(NPR);                                                  READ_GRAMMAR
  641              OUTCARD = ' /*  ' ^^ V(LEFT_PART(NPR)) ^^ ' ::= ' ^^                  READ_GRAMMAR
  642                 V(RIGHT_HEAD(NPR));                                                READ_GRAMMAR
  643              DO K = 1 TO 4;                                                        READ_GRAMMAR
  644                 I = SHR(P, SHL(4-K, 3)) & "FF";                                    READ_GRAMMAR
  645                 IF I \= 0 THEN CALL BUILD_CARD (V(I));                             READ_GRAMMAR
  646              END;                                                                  READ_GRAMMAR
  647              CALL PUNCH_CARD ('   */');                                            READ_GRAMMAR
  648           END;                                                                     READ_GRAMMAR
  649     END;                                                                           READ_GRAMMAR
  650     CALL PRINT_TIME;                                                               READ_GRAMMAR
  651     CALL SORT_V;                                                                   READ_GRAMMAR
  652                                                                                    READ_GRAMMAR
  653     EJECT_PAGE;                                                                    READ_GRAMMAR
  654     OUTPUT  = '   T E R M I N A L   S Y M B O L S                                  READ_GRAMMAR
  655     N O N T E R M I N A L S';                                                      READ_GRAMMAR
  656     DOUBLE_SPACE;                                                                  READ_GRAMMAR
  657     IF NSY - NT > NT THEN L = NSY - NT;  ELSE L = NT; /* L = NUMBER OF LINES */    READ_GRAMMAR
  658     DO I = 1 TO L;  /* PRINT V */                                                  READ_GRAMMAR
  659        IF I > NT THEN CARDIMAGE = HALF_LINE;                                       READ_GRAMMAR
  660        ELSE                                                                        READ_GRAMMAR
  661           DO;  /* TERMINAL SYMBOLS */                                              READ_GRAMMAR
  662              T = I;                                                                READ_GRAMMAR
  663              J = 5 - LENGTH(T);                                                    READ_GRAMMAR
  664              CARDIMAGE = SUBSTR(SUBSTR(EMPTY, 0, J) ^^ T ^^ '   ' ^^ V(I)          READ_GRAMMAR
  665                 ^^ HALF_LINE, 0, 66);                                              READ_GRAMMAR
  666           END;                                                                     READ_GRAMMAR C13 = 8858370048
  667        K = I + NT;                                                                 READ_GRAMMAR
  668        IF K <= NSY THEN                                                            READ_GRAMMAR
  669           DO;  /* NON-TERMINAL SYMBOLS */                                          READ_GRAMMAR
  670              T = K;                                                                READ_GRAMMAR
  671              J = 5 - LENGTH(T);                                                    READ_GRAMMAR
  672              CARDIMAGE = CARDIMAGE ^^ SUBSTR(EMPTY, 0, J) ^^ T ^^ '   '            READ_GRAMMAR
  673                 ^^ V(K);                                                           READ_GRAMMAR
  674           END;                                                                     READ_GRAMMAR
  675        OUTPUT = CARDIMAGE;                                                         READ_GRAMMAR
  676     END;                                                                           READ_GRAMMAR
  677     DOUBLE_SPACE;                                                                  READ_GRAMMAR
  678     GOAL_SYMBOL = 0;                                                               READ_GRAMMAR
  679     DO I = 1 TO NSY;   /* LOCATE GOAL SYMBOL */                                    READ_GRAMMAR
  680        IF \ ON_RIGHT(I) THEN                                                       READ_GRAMMAR
  681           IF GOAL_SYMBOL = 0 THEN                                                  READ_GRAMMAR
  682                 DO;                                                                READ_GRAMMAR
  683                    GOAL_SYMBOL = I;                                                READ_GRAMMAR
  684                    OUTPUT = V(I) ^^ ' IS THE GOAL SYMBOL.';                        READ_GRAMMAR
  685                 END;                                                               READ_GRAMMAR
  686              ELSE OUTPUT = 'ANOTHER GOAL: ' ^^ V(I) ^^ ' (WILL NOT BE USED)';      READ_GRAMMAR
  687     END;                                                                           READ_GRAMMAR
  688     IF GOAL_SYMBOL = 0 THEN                                                        READ_GRAMMAR
  689        DO;                                                                         READ_GRAMMAR
  690           GOAL_SYMBOL = LEFT_PART(1);                                              READ_GRAMMAR
  691           OUTPUT = 'NO GOAL SYMBOL FOUND.  ' ^^ V(GOAL_SYMBOL) ^^                  READ_GRAMMAR
  692              ' USED FOR GOAL SYMBOL.';                                             READ_GRAMMAR
  693        END;                                                                        READ_GRAMMAR
  694                                                                                    READ_GRAMMAR
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 29
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  695     BASIC_NSY = NSY;                                                               READ_GRAMMAR
  696     BASIC_NPR = NPR;                                                               READ_GRAMMAR
  697     TROUBLE_COUNT = 0;                                                             READ_GRAMMAR
  698  END READ_GRAMMAR;                                                                 READ_GRAMMAR

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
GET_CARD        PROCEDURE  1685  PROGRAM    499       1
LONG            FIXED     15378     DATA    463       4
P               FIXED     15377     DATA    463       6
PRINT_DATE      PROCEDURE  1996  PROGRAM    568       1
  PARAMETER  1  CHARACTER   343   STRING    569       2
  PARAMETER  2  FIXED     15394     DATA    569       3
SCAN            PROCEDURE  1561  PROGRAM    465       3
SORT_V          PROCEDURE  1788  PROGRAM    521       1
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 30
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  699                                                                                   *
  700  IMPROVE_GRAMMAR:                                                                 *
  701     PROCEDURE;                                                                    *
  702        DECLARE (T1, T2, S1, S2) FIXED, CHANGE BIT(1),                              IMPROVE_GRAMMAR
  703           INTERNAL BIT(1), ADD_ON CHARACTER INITIAL ('0123456789ABCDEFGHIJKL');    IMPROVE_GRAMMAR
  704        EJECT_PAGE;                                                                 IMPROVE_GRAMMAR
  705        OUTPUT = 'GRAMMAR MODIFICATION TO ATTEMPT TO RESOLVE CONFLICTS:';           IMPROVE_GRAMMAR
  706        DO I = 1 TO BASIC_NSY;                                                      IMPROVE_GRAMMAR
  707           INDEX(I) = 0;                                                            IMPROVE_GRAMMAR
  708        END;                                                                        IMPROVE_GRAMMAR
  709        DO I = 1 TO TROUBLE_COUNT;  /* STEP THROUGH PROBLEMS  */                    IMPROVE_GRAMMAR
  710           DOUBLE_SPACE;                                                            IMPROVE_GRAMMAR
  711           T1 = TROUBLE1(I);                                                        IMPROVE_GRAMMAR
  712           T2 = TROUBLE2(I);                                                        IMPROVE_GRAMMAR
  713           DO P = 1 TO BASIC_NPR;                                                   IMPROVE_GRAMMAR
  714                                                                                    IMPROVE_GRAMMAR
  715                                                                                    IMPROVE_GRAMMAR
  716            INTERNAL, CHANGE = FALSE;                                               IMPROVE_GRAMMAR
  717              S1 = RIGHT_HEAD(P);                                                   IMPROVE_GRAMMAR
  718              M = PRODUCTION(P);                                                    IMPROVE_GRAMMAR
  719              DO L = 1 TO 4;  /* STEP THROUGH RIGHT PART  */                        IMPROVE_GRAMMAR
  720                 S2 = SHR(M, 24);                                                   IMPROVE_GRAMMAR
  721                 M = (SHL(M, 8) + S2) & "FFFFFFFF";                                 IMPROVE_GRAMMAR
  722                 IF S2 \= 0 THEN                                                    IMPROVE_GRAMMAR
  723                    DO;                                                             IMPROVE_GRAMMAR
  724                       IF S1 = T1 & IS_HEAD (S2, T2) THEN                           IMPROVE_GRAMMAR
  725                          DO;                                                       IMPROVE_GRAMMAR
  726                             J, INDEX(T1) = INDEX(T1) + 1;                          IMPROVE_GRAMMAR
  727                             IF NSY < 255 THEN NSY = NSY + 1;                       IMPROVE_GRAMMAR
  728                             ELSE CALL ERROR ('TOO MANY SYMBOLS');                  IMPROVE_GRAMMAR
  729                             S = SUBSTR(ADD_ON, J, 1);                              IMPROVE_GRAMMAR
  730                             V(NSY) = '<' ^^ V(T1) ^^ S ^^ '>';                     IMPROVE_GRAMMAR C14 = 134217728
  731                             IF NPR < 255 THEN NPR = NPR + 1;                       IMPROVE_GRAMMAR
  732                             ELSE CALL ERROR ('TOO MANY PRODUCTIONS.');             IMPROVE_GRAMMAR
  733                             LEFT_PART(NPR) = NSY;                                  IMPROVE_GRAMMAR
  734                             RIGHT_HEAD(NPR) = T1;                                  IMPROVE_GRAMMAR
  735                             PRODUCTION(NPR) = 0;                                   IMPROVE_GRAMMAR
  736                             CALL OUTPUT_PRODUCTION (NPR);                          IMPROVE_GRAMMAR
  737                             CHANGE = TRUE;                                         IMPROVE_GRAMMAR
  738                             IF INTERNAL THEN M = M & "FFFF00FF"                    IMPROVE_GRAMMAR
  739                                            ^ (SHL(NSY, 8) & "FFFFFFFF");           IMPROVE_GRAMMAR
  740                             ELSE RIGHT_HEAD(P) = NSY;                              IMPROVE_GRAMMAR C15 = 4294902015
  741                          END;                                                      IMPROVE_GRAMMAR
  742                       INTERNAL = TRUE;                                             IMPROVE_GRAMMAR
  743                       S1 = S2;                                                     IMPROVE_GRAMMAR
  744                    END;                                                            IMPROVE_GRAMMAR
  745              END;  /* OF DO L  */                                                  IMPROVE_GRAMMAR
  746              PRODUCTION(P) = M;                                                    IMPROVE_GRAMMAR
  747              IF CHANGE THEN CALL OUTPUT_PRODUCTION (P);                            IMPROVE_GRAMMAR
  748           END;  /* OF DO P  */                                                     IMPROVE_GRAMMAR
  749        END;  /* OF DO I  */                                                        IMPROVE_GRAMMAR
  750        TROUBLE_COUNT, ERROR_COUNT = 0;                                             IMPROVE_GRAMMAR
  751     END IMPROVE_GRAMMAR;                                                           IMPROVE_GRAMMAR

SYMBOL TABLE DUMP
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 31
SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
 

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
ADD_ON          CHARACTER   380   STRING    703       1
CHANGE          BIT (9)   15547     DATA    702       3
INTERNAL        BIT (9)   15548     DATA    703       3
S1              FIXED     15545     DATA    702       3
S2              FIXED     15546     DATA    702       5
T1              FIXED     15543     DATA    702       6
T2              FIXED     15544     DATA    702       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 32
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  752                                                                                   *
  753  COMPUTE_HEADS:                                                                   *
  754     PROCEDURE;  /* SET UP HEAD SYMBOL MATRIX  */                                  *
  755     CALL CLEAR_HEADS;                                                              COMPUTE_HEADS
  756     CALL CLEAR_WORK;                                                               COMPUTE_HEADS
  757     DO I = 1 TO NPR;   /* FIRST GET IMMEDIATE HEADS */                             COMPUTE_HEADS
  758        CALL SET_HEAD (LEFT_PART(I), RIGHT_HEAD(I));                                COMPUTE_HEADS
  759     END;                                                                           COMPUTE_HEADS
  760     DO WHILE CHANGE;   /* THEN COMPUTE TRANSITIVE COMPLETION */                    COMPUTE_HEADS
  761        CHANGE = FALSE;                                                             COMPUTE_HEADS
  762        DO I = NT + 1 TO NSY;                                                       COMPUTE_HEADS
  763           DO J = NT + 1 TO NSY;                                                    COMPUTE_HEADS
  764              IF IS_HEAD (I, J) THEN                                                COMPUTE_HEADS
  765                 DO K = 1 TO NSY;                                                   COMPUTE_HEADS
  766                    IF IS_HEAD (J, K) THEN                                          COMPUTE_HEADS
  767                       IF \ IS_HEAD (I, K) THEN                                     COMPUTE_HEADS
  768                          CALL SET_HEAD (I, K);  /* SIDE EFFECT ON CHANGE */        COMPUTE_HEADS
  769                 END;                                                               COMPUTE_HEADS
  770           END;                                                                     COMPUTE_HEADS
  771        END;                                                                        COMPUTE_HEADS
  772     END;                                                                           COMPUTE_HEADS
  773     CHANGE = TRUE;                                                                 COMPUTE_HEADS
  774     IF ITERATION_COUNT = 1 THEN                                                    COMPUTE_HEADS
  775        DO;                                                                         COMPUTE_HEADS
  776           AMBIGUOUS = FALSE;                                                       COMPUTE_HEADS
  777           DO I = 1 TO NPR;                                                         COMPUTE_HEADS
  778              J = RIGHT_HEAD(I);  K = PRODUCTION(I);                                COMPUTE_HEADS
  779              DO WHILE K \= 0;  J = SHR(K, 24);  K = SHL(K, 8)                      COMPUTE_HEADS
  780                               & "FFFFFFFF";  END;                                  COMPUTE_HEADS
  781              CALL SET (LEFT_PART(I), J, TRUE);                                     COMPUTE_HEADS
  782           END;                                                                     COMPUTE_HEADS
  783           DO WHILE CHANGE;                                                         COMPUTE_HEADS
  784              CHANGE = FALSE;                                                       COMPUTE_HEADS
  785              DO I = NT + 1 TO NSY;                                                 COMPUTE_HEADS
  786                 DO J = NT + 1 TO NSY;                                              COMPUTE_HEADS
  787                    IF GET (I, J) THEN                                              COMPUTE_HEADS
  788                       DO K = 1 TO NSY;                                             COMPUTE_HEADS
  789                          IF GET (J, K) THEN IF \ GET (I, K) THEN                   COMPUTE_HEADS
  790                             DO;                                                    COMPUTE_HEADS
  791                                CALL SET (I, K, TRUE);                              COMPUTE_HEADS
  792                                CHANGE = TRUE;                                      COMPUTE_HEADS
  793                             END;                                                   COMPUTE_HEADS
  794                       END;                                                         COMPUTE_HEADS
  795                 END;                                                               COMPUTE_HEADS
  796              END;                                                                  COMPUTE_HEADS
  797           END;                                                                     COMPUTE_HEADS
  798           DO I = NT + 1 TO NSY;                                                    COMPUTE_HEADS
  799              IF IS_HEAD (I, I) THEN IF GET (I, I) THEN                             COMPUTE_HEADS
  800                 DO;                                                                COMPUTE_HEADS
  801                    AMBIGUOUS = TRUE;                                               COMPUTE_HEADS
  802                    CALL ERROR ('GRAMMAR IS AMBIGUOUS.  IT IS LEFT AND RIGHT RECUR  COMPUTE_HEADS
  803  SIVE IN THE SYMBOL  ' ^^ V(I));                                                   COMPUTE_HEADS
  804                 END;                                                               COMPUTE_HEADS
  805           END;                                                                     COMPUTE_HEADS
  806        END;                                                                        COMPUTE_HEADS
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 33
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  807     DO I = 0 TO NSY;   /* THEN THE REFLEXIVE TRANSITIVE COMPLETION */              COMPUTE_HEADS
  808        CALL SET_HEAD (I, I);                                                       COMPUTE_HEADS
  809     END;                                                                           COMPUTE_HEADS
  810     CALL PRINT_MATRIX ('PRODUCED HEAD SYMBOLS', 0);                                COMPUTE_HEADS
  811  END COMPUTE_HEADS;                                                                COMPUTE_HEADS
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 34
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  812                                                                                   *
  813  PRODUCE:                                                                         *
  814     PROCEDURE;  /* RUN THROUGH THE GENERATION ALGORITHM TO COMPUTE F11  */        *
  815     DECLARE MAXLEVEL FIXED, NEW BIT(1);                                            PRODUCE
  816                                                                                    PRODUCE
  817     NEVER_BEEN_HERE:                                                               PRODUCE
  818        PROCEDURE; /* RECORD THE F11.  RETURN FALSE IF IT IS ALREADY IN TABLE  */   PRODUCE
  819        DECLARE (NEW_F11, I, J, K, NF11P1) FIXED;                                   NEVER_BEEN_HERE
  820        NETRY = NETRY + 1;                                                          NEVER_BEEN_HERE
  821        NEW_F11 = PACK(0, STACK(SP), STACK(SP-1), TOKEN);                           NEVER_BEEN_HERE
  822        I = 0;  K, NF11P1 = NF11 + 1;                                               NEVER_BEEN_HERE
  823        DO WHILE I + 1 < K; /* BINARY LOOK-UP */                                    NEVER_BEEN_HERE
  824           J = SHR(I+K,1);                                                          NEVER_BEEN_HERE
  825           IF F11(J) > NEW_F11 THEN K = J;                                          NEVER_BEEN_HERE
  826           ELSE IF F11(J) < NEW_F11 THEN I = J;                                     NEVER_BEEN_HERE
  827           ELSE RETURN FALSE;  /* FOUND IT */                                       NEVER_BEEN_HERE
  828        END;                                                                        NEVER_BEEN_HERE
  829        /* IF WE GOT HERE, WE DIDN'T FIND IT */                                     NEVER_BEEN_HERE
  830        IF NF11 >= MAXNF11 THEN DO;  CALL ERROR ('F11 OVERFLOW');  NF11 = 1;  END;  NEVER_BEEN_HERE
  831        DO J = 0 TO NF11 - K;   /* MAKE ROOM TO INSERT NEW ENTRY */                 NEVER_BEEN_HERE
  832           F11(NF11P1-J) = F11(NF11-J);                                             NEVER_BEEN_HERE
  833        END;                                                                        NEVER_BEEN_HERE
  834        NF11 = NF11P1;                                                              NEVER_BEEN_HERE
  835        F11(K) = NEW_F11;                                                           NEVER_BEEN_HERE
  836        RETURN TRUE;                                                                NEVER_BEEN_HERE
  837     END NEVER_BEEN_HERE;                                                           NEVER_BEEN_HERE

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
I               FIXED     15619     DATA    819       4
J               FIXED     15620     DATA    819       8
K               FIXED     15621     DATA    819       6
NEW_F11         FIXED     15618     DATA    819       4
NF11P1          FIXED     15622     DATA    819       3
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 35
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  838                                                                                    PRODUCE
  839     ADD_ITEM:                                                                      PRODUCE
  840        PROCEDURE (ITEM);                                                           PRODUCE
  841        DECLARE ITEM CHARACTER;                                                     ADD_ITEM
  842        IF LENGTH(CARDIMAGE) + LENGTH(ITEM) > 130 THEN                              ADD_ITEM
  843           DO;                                                                      ADD_ITEM
  844              OUTPUT = CARDIMAGE;                                                   ADD_ITEM
  845              CARDIMAGE = '      ';                                                 ADD_ITEM
  846           END;                                                                     ADD_ITEM
  847        CARDIMAGE = CARDIMAGE ^^ ' ' ^^ ITEM;                                       ADD_ITEM
  848     END ADD_ITEM;                                                                  ADD_ITEM

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
ITEM            CHARACTER   389   STRING    840       2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 36
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  849                                                                                    PRODUCE
  850     PRINT_FORM:                                                                    PRODUCE
  851        PROCEDURE; /* PRINT THE CURRENT SENTENTIAL FORM WHILE TRACING               PRODUCE
  852                      THE GENERATING ALGORITHM */                                   PRINT_FORM
  853        CARDIMAGE = 'LEVEL ' ^^ LEVEL ^^ ': ';                                      PRINT_FORM
  854        DO I = 1 TO SP;                                                             PRINT_FORM
  855           CALL ADD_ITEM (V(STACK(I)));                                             PRINT_FORM
  856        END;                                                                        PRINT_FORM
  857        CALL ADD_ITEM ('  ^  ');                                                    PRINT_FORM
  858        DO I = 0 TO TP - 1;                                                         PRINT_FORM
  859           CALL ADD_ITEM (V(TEXT(TP-I)));                                           PRINT_FORM
  860        END;                                                                        PRINT_FORM
  861        OUTPUT = CARDIMAGE;                                                         PRINT_FORM
  862     END PRINT_FORM;                                                                PRINT_FORM
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 37
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  863                                                                                    PRODUCE
  864     APPLY_PRODUCTION:                                                              PRODUCE
  865        PROCEDURE;  /* PERFORM ONE PARSE STEP (ON STACK AND TEXT) AND RECUR  */     PRODUCE
  866           LEVEL = LEVEL + 1;  /* SIMULATE THE EFFECT OF RECURSION  */              APPLY_PRODUCTION
  867           IF LEVEL > MAXLEVEL THEN IF LEVEL > DEPTH THEN                           APPLY_PRODUCTION
  868              DO;  CALL ERROR ('LEVEL OVERFLOW');  LEVEL = 1;  END;                 APPLY_PRODUCTION
  869              ELSE MAXLEVEL = LEVEL;                                                APPLY_PRODUCTION
  870           MP_SAVE(LEVEL) = MP;      /* SAVE POINTER TO LEFT PART OF PRODUCTION */  APPLY_PRODUCTION
  871           MP = SP;                                                                 APPLY_PRODUCTION
  872           TP_SAVE(LEVEL) = TP;      /* SAVE POINTER INTO TEXT */                   APPLY_PRODUCTION
  873           P_SAVE(LEVEL) = P;        /* SAVE NUMBER OF PRODUCTION TO BE APPLIED */  APPLY_PRODUCTION
  874           TOKEN_SAVE(LEVEL) = TOKEN;/* SAVE POINTER INTO IS_HEAD ARRAY */          APPLY_PRODUCTION
  875           STACK(SP) = RIGHT_HEAD(P);/* EXPAND PRODUCTION INTO STACK */             APPLY_PRODUCTION
  876           J = PRODUCTION(P);                                                       APPLY_PRODUCTION
  877           DO WHILE J \= 0;                                                         APPLY_PRODUCTION
  878              K = SHR(J,24);  J = SHL(J,8) & "FFFFFFFF";                            APPLY_PRODUCTION
  879              IF K \= 0 THEN                                                        APPLY_PRODUCTION
  880                 IF SP = STACKLIMIT THEN CALL ERROR ('STACK OVERFLOW');             APPLY_PRODUCTION
  881                 ELSE DO;  SP = SP + 1;  STACK(SP) = K;  END;                       APPLY_PRODUCTION
  882              END;                                                                  APPLY_PRODUCTION
  883           IF CONTROL(BYTE('T')) THEN CALL PRINT_FORM; /* TRACE */                  APPLY_PRODUCTION
  884     END APPLY_PRODUCTION;                                                          APPLY_PRODUCTION
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 38
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  885                                                                                    PRODUCE
  886     DIS_APPLY:                                                                     PRODUCE
  887        PROCEDURE;                                                                  PRODUCE
  888        /* UNDO THE PSEUDO-RECURSION, REVERSING THE EFFECT OF APPLY */              DIS_APPLY
  889        TOKEN = TOKEN_SAVE(LEVEL);                                                  DIS_APPLY
  890        P = P_SAVE(LEVEL);                                                          DIS_APPLY
  891        TP = TP_SAVE(LEVEL);                                                        DIS_APPLY
  892        SP = MP;                                                                    DIS_APPLY
  893        MP = MP_SAVE(LEVEL);                                                        DIS_APPLY
  894        STACK(SP) = LEFT_PART(P);                                                   DIS_APPLY
  895        LEVEL = LEVEL - 1;                                                          DIS_APPLY
  896     END DIS_APPLY;                                                                 DIS_APPLY
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 39
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  897                                                                                    PRODUCE
  898     DO I = 1 TO NSY;  INDEX(I) = 0;  END;                                          PRODUCE
  899     DO I = 1 TO NPR;    /* MAKE SURE PRODUCTIONS ARE PROPERLY GROUPED */           PRODUCE
  900        J = LEFT_PART(I);                                                           PRODUCE
  901        IF J \= LEFT_PART(I-1) THEN                                                 PRODUCE
  902           IF INDEX(J) = 0 THEN                                                     PRODUCE
  903              INDEX(J) = I;                                                         PRODUCE
  904           ELSE CALL ERROR ('PRODUCTIONS SEPARATED FOR ' ^^ V(J) ^^                 PRODUCE
  905              '.  PRODUCTION ' ^^ I ^^ ' WILL BE IGNORED.');                        PRODUCE
  906     END;                                                                           PRODUCE
  907     LEFT_PART(NPR+1) = 0;  /* FLAG END OF TABLE  */                                PRODUCE
  908     /* SET INITIAL SENTENTIAL FORM TO  _^_  <GOAL>  _^_  */                        PRODUCE
  909     TP = 0;                                                                        PRODUCE
  910     MP, SP = 1;                                                                    PRODUCE
  911     STACK(0), TEXT(0) = TERMINATOR;                                                PRODUCE
  912     STACK(1) = GOAL_SYMBOL;                                                        PRODUCE
  913     NETRY, NF11, LEVEL, MAXLEVEL = 0;                                              PRODUCE
  914     EJECT_PAGE;                                                                    PRODUCE
  915     OUTPUT = 'SENTENTIAL FORM PRODUCTION:';                                        PRODUCE
  916     DOUBLE_SPACE;                                                                  PRODUCE
  917     IF CONTROL(BYTE('T')) THEN CALL PRINT_FORM;                                    PRODUCE
  918                                                                                    PRODUCE
  919                                                                                    PRODUCE
  920                                                                                    PRODUCE
  921     /* NOW COMES THE BASIC ALGORITHM FOR GENERATING THE TABLES  */                 PRODUCE
  922                                                                                    PRODUCE
  923                                                                                    PRODUCE
  924  PRODUCTION_LOOP:                                                                  PRODUCE
  925     DO WHILE SP >= MP;  /* CYCLE THRU RIGHT PART OF PRODUCTION */                  PRODUCE
  926        IF STACK(SP) > NT THEN   /* ONLY NON-TERMINALS CAN EXPAND */                PRODUCE
  927           DO;                                                                      PRODUCE
  928              NEW = FALSE;                                                          PRODUCE
  929              I = TEXT(TP);                                                         PRODUCE
  930              DO TOKEN = 1 TO NT;   /* CYCLE THRU TERMINAL HEADS */                 PRODUCE
  931                 IF IS_HEAD (I, TOKEN) THEN IF NEVER_BEEN_HERE THEN NEW = TRUE;     PRODUCE
  932             END;                                                                   PRODUCE
  933              IF NEW THEN                                                           PRODUCE
  934                 DO;  /* EXPAND STACK(SP) WITH ALL APPLICABLE RULES */              PRODUCE
  935                    P = INDEX(STACK(SP));                                           PRODUCE
  936                    DO WHILE LEFT_PART(P) = STACK(SP);                              PRODUCE
  937                       CALL APPLY_PRODUCTION;                                       PRODUCE
  938                       GO TO PRODUCTION_LOOP;  /* NOW DOWN A LEVEL  */              PRODUCE
  939                                                                                    PRODUCE
  940                                                                                    PRODUCE
  941              CONTINUE:      /* AND NOW BACK UP A LEVEL  */                         PRODUCE
  942                       P = P + 1;  /* MOVE ON TO NEXT PRODUCTION */                 PRODUCE
  943                    END;                                                            PRODUCE
  944                 END;                                                               PRODUCE
  945           END;                                                                     PRODUCE
  946        IF TP = TEXTLIMIT THEN CALL ERROR ('TEXT OVERFLOW');                        PRODUCE
  947        ELSE TP = TP + 1;                                                           PRODUCE
  948        TEXT(TP) = STACK(SP);  /* RUN THE COMPILER BACKWARDS  */                    PRODUCE
  949        SP = SP - 1;           /* UNSTACKING AS YOU GO */                           PRODUCE
  950     END;                                                                           PRODUCE
  951                                                                                    PRODUCE
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 40
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  952     /* FULLY EXPANDED AT THIS LEVEL */                                             PRODUCE
  953     CALL DIS_APPLY;   /* TO COME UP A LEVEL  */                                    PRODUCE
  954                                                                                    PRODUCE
  955     IF LEVEL >= 0 THEN GO TO CONTINUE;                                             PRODUCE
  956                                                                                    PRODUCE
  957     IF CONTROL(BYTE('T')) THEN DOUBLE_SPACE;                                       PRODUCE
  958     OUTPUT = 'F11 HAS ' ^^ NF11 ^^ ' ELEMENTS.';                                   PRODUCE
  959     OUTPUT = 'THE MAXIMUM DEPTH OF RECURSION WAS ' ^^ MAXLEVEL ^^ ' LEVELS.';      PRODUCE
  960     OUTPUT = NETRY ^^ ' SENTENTIAL FORMS WERE EXAMINED.';                          PRODUCE
  961  END PRODUCE;                                                                      PRODUCE

SYMBOL TABLE DUMP

SYMBOL           TYPE       LOC   SEGMENT DEFINED REF COUNT
ADD_ITEM         PROCEDURE  3133  PROGRAM    839       3
  PARAMETER  1   CHARACTER   389   STRING    840       5
APPLY_PRODUCTION PROCEDURE  3213  PROGRAM    864       1
CONTINUE         LABEL      3572  PROGRAM    941       1
DIS_APPLY        PROCEDURE  3317  PROGRAM    886       1
MAXLEVEL         FIXED     15616     DATA    815       4
NEVER_BEEN_HERE  PROCEDURE  3042  PROGRAM    817       1
NEW              BIT (9)   15617     DATA    815       3
PRINT_FORM       PROCEDURE  3156  PROGRAM    850       2
PRODUCTION_LOOP  LABEL      3495  PROGRAM    924       1
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 41
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  962                                                                                   *
  963  INDEX_F11:                                                                       *
  964     PROCEDURE;                                                                    *
  965     /* BUILD AN INDEX INTO F11 FOR EACH PRODUCTION  */                             INDEX_F11
  966     DECLARE (Y, YP, P) FIXED;                                                      INDEX_F11
  967                                                                                    INDEX_F11
  968     DO I = 1 TO NPR;                                                               INDEX_F11
  969        IND(I) = 0;                                                                 INDEX_F11
  970        IND1(I) = -1;                                                               INDEX_F11
  971     END;                                                                           INDEX_F11
  972                                                                                    INDEX_F11
  973     Y, YP = 0;                                                                     INDEX_F11
  974     F11(NF11+1) = SHL(NSY+1, 16) & "FFFFFFFF"; /* BOUNDARY CONDITION  */           INDEX_F11
  975     DO I = 1 TO NF11+1;  /* CHECK EACH F11  */                                     INDEX_F11
  976        IF F11(I) >= YP THEN                                                        INDEX_F11
  977           DO;      /* F11 FOR A NEW LEFT PART */                                   INDEX_F11
  978              P = INDEX(Y);                                                         INDEX_F11
  979              DO WHILE LEFT_PART(P) = Y;    /* RECORD END FOR OLD LEFT PART */      INDEX_F11
  980                 IND1(P) = I - 1;                                                   INDEX_F11
  981                 P = P + 1;                                                         INDEX_F11
  982              END;                                                                  INDEX_F11
  983              Y = SHR(F11(I), 16);    /* NEW LEFT PART */                           INDEX_F11
  984              P = INDEX(Y);                                                         INDEX_F11
  985              DO WHILE LEFT_PART(P) = Y;    /* RECORD START FOR NEW LEFT PART */    INDEX_F11
  986                 IND(P) = I;                                                        INDEX_F11
  987                 P = P + 1;                                                         INDEX_F11
  988              END;                                                                  INDEX_F11
  989              YP = SHL(Y+1, 16) & "FFFFFFFF"; /*TO COMPARE WITH TRIPLE */           INDEX_F11
  990           END;                                                                     INDEX_F11
  991     END;                                                                           INDEX_F11
  992  END INDEX_F11;                                                                    INDEX_F11

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
P               FIXED     15695     DATA    966      10
Y               FIXED     15693     DATA    966       7
YP              FIXED     15694     DATA    966       3
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 42
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
  993                                                                                   *
  994  SORT_PRODUCTIONS:                                                                *
  995     PROCEDURE;    /* RE-NUMBER THE PRODUCTIONS IN AN OPTIMAL ORDER FOR C2  */     *
  996     DO I = 1 TO NPR;  P_SAVE(I) = 0;  END;                                         SORT_PRODUCTIONS
  997     P = 0;                                                                         SORT_PRODUCTIONS
  998     DO I = 1 TO NPR;                                                               SORT_PRODUCTIONS
  999        J = RIGHT_HEAD(I);  /* CONVERT 1 - 4 PACKING TO 4 - 1 PACKING  */           SORT_PRODUCTIONS
 1000        M = PRODUCTION(I);                                                          SORT_PRODUCTIONS
 1001        IF M = 0 THEN                                                               SORT_PRODUCTIONS
 1002           DO;                                                                      SORT_PRODUCTIONS
 1003              M = J;                                                                SORT_PRODUCTIONS
 1004              J = 0;                                                                SORT_PRODUCTIONS
 1005              L = 7;                                                                SORT_PRODUCTIONS
 1006           END;                                                                     SORT_PRODUCTIONS
 1007        ELSE L = 6;                                                                 SORT_PRODUCTIONS
 1008        TAIL(I) = M & "FF";                                                         SORT_PRODUCTIONS
 1009        M = M & "FFFFFF00";                                                         SORT_PRODUCTIONS
 1010        DO WHILE M \= 0;                                                            SORT_PRODUCTIONS C16 = 4294967040
 1011           K = SHR(M, 24);  M = SHL(M, 8) & "FFFFFFFF";                             SORT_PRODUCTIONS
 1012           IF K \= 0 THEN                                                           SORT_PRODUCTIONS
 1013              DO;                                                                   SORT_PRODUCTIONS
 1014                 J = (SHL(J, 8) + K) & "FFFFFFFF";                                  SORT_PRODUCTIONS
 1015                 L = L - 1;                                                         SORT_PRODUCTIONS
 1016              END;                                                                  SORT_PRODUCTIONS
 1017        END;                                                                        SORT_PRODUCTIONS
 1018        HEAD(I) = J;                                                                SORT_PRODUCTIONS
 1019        /*  SORT ON:  1.  TAIL SYMBOL OF RIGHT PART                                 SORT_PRODUCTIONS
 1020                         2. LENGTH OF RIGHT PART                                    SORT_PRODUCTIONS
 1021                            3. NUMBER OF F11'S                 */                   SORT_PRODUCTIONS
 1022        SORT#(I) = SHL(TAIL(I), 23) + SHL(L, 20) + IND1(I) - IND(I);                SORT_PRODUCTIONS
 1023        SORT#(I) = SORT#(I) & "FFFFFFFF";                                           SORT_PRODUCTIONS
 1024        INDEX(I) = I;                                                               SORT_PRODUCTIONS
 1025     END;  /* OF DO I  */                                                           SORT_PRODUCTIONS
 1026     /* BUBBLE SORT OF PRODUCTIONS  */                                              SORT_PRODUCTIONS
 1027     K, L = NPR;                                                                    SORT_PRODUCTIONS
 1028     DO WHILE K <= L;                                                               SORT_PRODUCTIONS
 1029        L = -1;                                                                     SORT_PRODUCTIONS
 1030        DO I = 2 TO K;                                                              SORT_PRODUCTIONS
 1031           L = I - 1;                                                               SORT_PRODUCTIONS
 1032           IF SORT#(L) > SORT#(I) THEN                                              SORT_PRODUCTIONS
 1033              DO;                                                                   SORT_PRODUCTIONS
 1034                 J = SORT#(L);  SORT#(L) = SORT#(I);  SORT#(I) = J;                 SORT_PRODUCTIONS
 1035                 J = INDEX(L);  INDEX(L) = INDEX(I);  INDEX(I) = J;                 SORT_PRODUCTIONS
 1036                 K = L;                                                             SORT_PRODUCTIONS
 1037              END;                                                                  SORT_PRODUCTIONS
 1038        END;                                                                        SORT_PRODUCTIONS
 1039     END;                                                                           SORT_PRODUCTIONS
 1040     INDEX(NPR+1) = 0;                                                              SORT_PRODUCTIONS
 1041  END SORT_PRODUCTIONS;                                                             SORT_PRODUCTIONS
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 43
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1042                                                                                   *
 1043  COMPUTE_C1:                                                                      *
 1044     PROCEDURE;                                                                    *
 1045        DECLARE (CX, CTRIP, S1, S2, S3, TR, PR) FIXED;                              COMPUTE_C1
 1046                                                                                    COMPUTE_C1
 1047        CALL CLEAR_WORK;                                                            COMPUTE_C1
 1048        NETRY, NTRIP, CTRIP = 0;                                                    COMPUTE_C1
 1049        DO CX = 0 TO 2;      /* REPEAT BASIC LOOP 3 TIMES:                          COMPUTE_C1
 1050                                1. COMPUTE PAIRS                                    COMPUTE_C1 C17 = 2
 1051                                   2. COMPUTE TRIPLES FOR PAIR CONFLICTS            COMPUTE_C1
 1052                                      3. EMIT DIAGNOSTICS FOR TRIPLE CONFLICTS  */  COMPUTE_C1
 1053          DO P = 1 TO NPR;      /* STEP THROUGH THE PRODUCTIONS  */                 COMPUTE_C1
 1054            DO I = IND(P) TO IND1(P);    /* STEP THROUGH THE EXPANSION TRIPLES  */  COMPUTE_C1
 1055              CALL EXPAND (F11(I), P);                                              COMPUTE_C1
 1056              DO J = 2 TO SP;      /* STEP THROUGH RIGHT PART OF PRODUCTION  */     COMPUTE_C1
 1057                 K = VALUE(J\=SP);                                                  COMPUTE_C1
 1058                 S1 = STACK(J-1);                                                   COMPUTE_C1
 1059                 S2 = STACK(J);                                                     COMPUTE_C1
 1060                 L = STACK(J+1);                                                    COMPUTE_C1
 1061                 DO S3 = 1 TO NT;     /* STEP THROUGH THE HEADS OF STACK(J+1)  */   COMPUTE_C1
 1062                    IF IS_HEAD(L, S3) THEN                                          COMPUTE_C1
 1063                       DO CASE CX;                                                  COMPUTE_C1
 1064                                                                                    COMPUTE_C1 CASE 0.
 1065                          /* CASE 0 -- ENTER PAIR  */                               COMPUTE_C1
 1066                          CALL SET (S2, S3, K);                                     COMPUTE_C1
 1067                                                                                    COMPUTE_C1 CASE 1.
 1068                          /* CASE 1 -- IF PAIR CONFLICT THEN ENTER TRIPLE  */       COMPUTE_C1
 1069                          IF GET (S2, S3) = 3 THEN                                  COMPUTE_C1
 1070                             CALL ENTER (PACK (0, S1, S2, S3), K);                  COMPUTE_C1
 1071                                                                                    COMPUTE_C1
 1072                          /* CASE 2 -- IF TRIPLE CONFLICT EMIT DIAGNOSTIC  */       COMPUTE_C1
 1073                          DO;                                                       COMPUTE_C1
 1074                             TR = PACK (0, S1, S2, S3);                             COMPUTE_C1 CASE 2.
 1075                             DO M = 0 TO CTRIP;                                     COMPUTE_C1
 1076                                IF SORT#(M) = TR THEN                               COMPUTE_C1
 1077                                   CALL ENTER (PACK(M, P, STACK(1), STACK(SP+1)),   COMPUTE_C1
 1078                                      K);                                           COMPUTE_C1
 1079                             END;                                                   COMPUTE_C1
 1080                          END;     /* OF CASE 2  */                                 COMPUTE_C1
 1081                       END;     /* OF DO CASE  */                                   COMPUTE_C1 CASE 3.
 1082                 END;     /* OF DO S3  */                                           COMPUTE_C1
 1083              END;     /* OF DO J  */                                               COMPUTE_C1
 1084            END;    /* OF DO I  */                                                  COMPUTE_C1
 1085          END;      /* OF DO P  */                                                  COMPUTE_C1
 1086           DO CASE CX;  /* CLEAN UP  */                                             COMPUTE_C1
 1087                                                                                    COMPUTE_C1 CASE 0.
 1088              /* CASE 0  */                                                         COMPUTE_C1
 1089              DO;                                                                   COMPUTE_C1
 1090                 DO I = 1 TO NT;      /* SPECIAL RELATIONS FOR TERMINATOR  */       COMPUTE_C1
 1091                    IF IS_HEAD (GOAL_SYMBOL, I) THEN                                COMPUTE_C1
 1092                       CALL SET (TERMINATOR, I, VALUE(TRUE));                       COMPUTE_C1
 1093                 END;                                                               COMPUTE_C1
 1094                 CALL SET (GOAL_SYMBOL, TERMINATOR, VALUE(FALSE));                  COMPUTE_C1
 1095                 CALL PRINT_MATRIX ('C1 MATRIX FOR STACKING DECISION', 1);          COMPUTE_C1
 1096                 CALL PRINT_TIME;                                                   COMPUTE_C1
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 44
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1097              END;                                                                  COMPUTE_C1
 1098                                                                                    COMPUTE_C1 CASE 1.
 1099              /* CASE 1  */                                                         COMPUTE_C1
 1100              DO;                                                                   COMPUTE_C1
 1101                 CALL PRINT_TRIPLES ('C1 TRIPLES FOR STACKING DECISION');           COMPUTE_C1
 1102                 IF COUNT(3) = 0 ^ ITERATION_COUNT > 1 THEN RETURN;                 COMPUTE_C1
 1103                 IF \ CONTROL(BYTE('I')) THEN                                       COMPUTE_C1
 1104                    IF CONTROL(BYTE('P')) ^ CONTROL(BYTE('O')) THEN RETURN;         COMPUTE_C1
 1105                 CALL PRINT_TIME;                                                   COMPUTE_C1
 1106                 DO I = 1 TO NTRIP;                                                 COMPUTE_C1
 1107                    IF TV(I) = 3 THEN                                               COMPUTE_C1
 1108                       DO;                                                          COMPUTE_C1
 1109                          SORT#(CTRIP) = TRIPLE(I);                                 COMPUTE_C1
 1110                          CTRIP = CTRIP + 1;                                        COMPUTE_C1
 1111                       END;                                                         COMPUTE_C1
 1112                 END;                                                               COMPUTE_C1
 1113                 CTRIP = CTRIP - 1;                                                 COMPUTE_C1
 1114                 NETRY, NTRIP = 0;                                                  COMPUTE_C1
 1115                 DOUBLE_SPACE;                                                      COMPUTE_C1
 1116                 OUTPUT = 'ANALYSIS OF (2,1) CONFLICTS:';                           COMPUTE_C1
 1117              END;                                                                  COMPUTE_C1
 1118                                                                                    COMPUTE_C1 CASE 2.
 1119              /* CASE 2  */                                                         COMPUTE_C1
 1120              DO;                                                                   COMPUTE_C1
 1121                 J = 1;                                                             COMPUTE_C1
 1122                 DO M = 0 TO CTRIP;  /* STEP THROUGH CONFLICTS  */                  COMPUTE_C1
 1123                    DO K = 0 TO 1;  /* STEP THROUGH TRUTH VALUES  */                COMPUTE_C1
 1124                       I = SORT#(M);                                                COMPUTE_C1
 1125                       OUTPUT = '';                                                 COMPUTE_C1
 1126                       OUTPUT = '   THE TRIPLE  ' ^^ V(SHR(I,16)) ^^ ' ' ^^         COMPUTE_C1
 1127                          V(SHR(I,8)&"FF") ^^ ' ' ^^ V(I&"FF") ^^                   COMPUTE_C1
 1128                          '  MUST HAVE THE VALUE ' ^^ PRINT(VALUE(K)) ^^            COMPUTE_C1
 1129                          ' FOR';                                                   COMPUTE_C1
 1130                       OUTPUT = '';                                                 COMPUTE_C1
 1131                       L = SHL(M+1, 24) & "FFFFFFFF";                               COMPUTE_C1
 1132                       I = J;                                                       COMPUTE_C1
 1133                       S1 = 0;                                                      COMPUTE_C1
 1134                       DO WHILE TRIPLE(I) < L & I <= NTRIP;                         COMPUTE_C1
 1135                          IF (TV(I)&VALUE(K)) \= 0 THEN                             COMPUTE_C1
 1136                             DO;                                                    COMPUTE_C1
 1137                                TR = TRIPLE(I);                                     COMPUTE_C1
 1138                                P = SHR(TR, 16) & "FF";                             COMPUTE_C1
 1139                                IF P \= S1 THEN CALL OUTPUT_PRODUCTION (P);         COMPUTE_C1
 1140                                S1 = P;                                             COMPUTE_C1
 1141                                OUTPUT = '         IN THE CONTEXT  ' ^^             COMPUTE_C1
 1142                                   V(SHR(TR, 8)&"FF") ^^ DOTS ^^ V(TR&"FF");        COMPUTE_C1
 1143                             END;                                                   COMPUTE_C1
 1144                          I = I + 1;                                                COMPUTE_C1
 1145                       END;     /* OF DO WHILE  */                                  COMPUTE_C1
 1146                    END;  /* OF DO K  */                                            COMPUTE_C1
 1147                    J = I;                                                          COMPUTE_C1
 1148                    OUTPUT = '';                                                    COMPUTE_C1
 1149                 END;     /* OF DO M  */                                            COMPUTE_C1
 1150              END;                                                                  COMPUTE_C1
 1151           END;     /* OF DO CASE  */                                               COMPUTE_C1 CASE 3.
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 45
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1152        END;     /* OF DO CX  */                                                    COMPUTE_C1
 1153  END COMPUTE_C1;                                                                   COMPUTE_C1

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
CTRIP           FIXED     15703     DATA   1045       8
CX              FIXED     15702     DATA   1045       3
PR              FIXED     15708     DATA   1045       0 *
S1              FIXED     15704     DATA   1045       6
S2              FIXED     15705     DATA   1045       5
S3              FIXED     15706     DATA   1045       6
TR              FIXED     15707     DATA   1045       6
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 46
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1154                                                                                   *
 1155  COMPUTE_C2:                                                                      *
 1156     PROCEDURE;                                                                    *
 1157     /* DETERMINE WHAT (IF ANY) CONTEXT MUST BE CHECKED FOR EACH PRODUCTION         COMPUTE_C2
 1158        TO AUGMENT THE "LONGEST MATCH" RULE FOR THE PRODUCTION SELECTION            COMPUTE_C2
 1159        FUNCTION  C2      */                                                        COMPUTE_C2
 1160                                                                                    COMPUTE_C2
 1161        DECLARE (IJ, IK, TJ, TK, PJ, PK, JCT, KCT, JCL, JCR) FIXED,                 COMPUTE_C2
 1162           PROPER BIT(1);                                                           COMPUTE_C2
 1163        DECLARE CONTEXT_CLASS(3) CHARACTER INITIAL ('EITHER (0,1) OR (1,0)',        COMPUTE_C2
 1164           '(0,1)', '(1,0)', '(1,1)');                                              COMPUTE_C2
 1165                                                                                    COMPUTE_C2
 1166        EJECT_PAGE;                                                                 COMPUTE_C2
 1167        OUTPUT = 'CONTEXT CHECK FOR EQUAL AND EMBEDDED RIGHT PARTS:';               COMPUTE_C2
 1168        DO I = 1 TO NPR;  MP_SAVE(I), P_SAVE(I) = 0;  END;                          COMPUTE_C2
 1169        DO J = 1 TO NPR - 1;                                                        COMPUTE_C2
 1170           IJ = INDEX(J);                                                           COMPUTE_C2
 1171           K = J + 1;                                                               COMPUTE_C2
 1172           IK = INDEX(K);                                                           COMPUTE_C2
 1173           DO WHILE TAIL(IJ) = TAIL(IK);  /* CHECK ALL PRODUCTIONS WITH SAME TAI*/  COMPUTE_C2
 1174              TJ = HEAD(IJ);                                                        COMPUTE_C2
 1175              TK = HEAD(IK);                                                        COMPUTE_C2
 1176              DO WHILE (TJ & "FF") = (TK & "FF") & TJ \= 0;                         COMPUTE_C2
 1177                 TJ = SHR(TJ, 8);  TK = SHR(TK, 8);                                 COMPUTE_C2
 1178              END;                                                                  COMPUTE_C2
 1179              IF TK = 0 THEN                                                        COMPUTE_C2
 1180                 DO;      /* PRODUCTION IK IS INCLUDED IN IJ  */                    COMPUTE_C2
 1181                    OUTPUT = '';                                                    COMPUTE_C2
 1182                    OUTPUT = '   THERE ARE ' ^^ IND1(IJ)-IND(IJ)+1 ^^               COMPUTE_C2
 1183                       ' AND ' ^^ IND1(IK)-IND(IK)+1 ^^                             COMPUTE_C2
 1184                       ' VALID CONTEXTS, RESPECTIVELY, FOR';                        COMPUTE_C2
 1185                    CALL OUTPUT_PRODUCTION (IJ);                                    COMPUTE_C2
 1186                    CALL OUTPUT_PRODUCTION (IK);                                    COMPUTE_C2
 1187                    PROPER = TJ \= 0;  /* IK IS A PROPER SUBSTRING  */              COMPUTE_C2
 1188                    IF PROPER THEN                                                  COMPUTE_C2
 1189                       DO;                                                          COMPUTE_C2
 1190                          JCL = SHL(TJ & "FF", 8);                                  COMPUTE_C2
 1191                          DO I = 1 TO NSY;                                          COMPUTE_C2
 1192                             ON_RIGHT(I) = FALSE;                                   COMPUTE_C2
 1193                          END;                                                      COMPUTE_C2
 1194                       END;                                                         COMPUTE_C2
 1195                    ELSE P_SAVE(IJ) = 1;  /* REMEMBER THAT EQUAL RIGHT PARTS        COMPUTE_C2
 1196                                          MUST BE DISTINGUISHED SOMEHOW  */         COMPUTE_C2
 1197                    MP = 0;                                                         COMPUTE_C2
 1198                    DO PJ = IND(IJ) TO IND1(IJ);                                    COMPUTE_C2
 1199                       JCT = F11(PJ) & "FFFF";                                      COMPUTE_C2
 1200                       JCR = JCT & "00FF";                                          COMPUTE_C2
 1201                       IF PROPER THEN JCT = JCL ^ JCR;                              COMPUTE_C2
 1202                       ELSE JCL = JCT & "FF00";                                     COMPUTE_C2
 1203                       DO PK = IND(IK) TO IND1(IK);                                 COMPUTE_C2
 1204                          KCT = F11(PK) & "FFFF";                                   COMPUTE_C2
 1205                          IF KCT = JCT THEN                                         COMPUTE_C2
 1206                             DO;                                                    COMPUTE_C2
 1207                                IF MP < 4 THEN CALL ERROR (                         COMPUTE_C2
 1208  'THESE PRODUCTIONS CANNOT BE DISTINGUISHED WITH (1,1) CONTEXT.');                 COMPUTE_C2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 47
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1209                                MP = MP ^ 4;                                        COMPUTE_C2
 1210                                IF PROPER THEN                                      COMPUTE_C2
 1211                                   DO;                                              COMPUTE_C2
 1212                                      IF \ ON_RIGHT(JCR) THEN                       COMPUTE_C2
 1213                                         OUTPUT = '   ' ^^ V(LEFT_PART(IK)) ^^      COMPUTE_C2
 1214                                            '  HAS  ' ^^ V(SHR(JCL, 8)) ^^          COMPUTE_C2
 1215                                            DOTS ^^ V(JCR) ^^ '  AS CONTEXT AND  '  COMPUTE_C2
 1216                ^^ V(JCR) ^^ '  IS VALID RIGHT CONTEXT FOR  ' ^^ V(LEFT_PART(IJ));  COMPUTE_C2
 1217                                      ON_RIGHT(JCR) = TRUE;                         COMPUTE_C2
 1218                                   END;                                             COMPUTE_C2
 1219                                ELSE OUTPUT =                                       COMPUTE_C2
 1220  '   THEY HAVE EQUAL RIGHT PARTS AND THE COMMON CONTEXT  '                         COMPUTE_C2
 1221                                   ^^ V(SHR(JCL, 8)) ^^ DOTS ^^ V(JCR);             COMPUTE_C2
 1222                                CALL ADD_TROUBLE (SHR(KCT, 8), LEFT_PART(IK));      COMPUTE_C2
 1223                             END;                                                   COMPUTE_C2
 1224                          ELSE IF (KCT & "FF00") = JCL THEN                         COMPUTE_C2
 1225                             MP = MP ^ 1;  /* CAN'T TELL BY LEFT CONTEXT */         COMPUTE_C2
 1226                          ELSE IF (KCT & "00FF") = JCR THEN                         COMPUTE_C2
 1227                             MP = MP ^ 2;  /* CAN'T TELL BY RIGHT CONTEXT */        COMPUTE_C2
 1228                       END;     /* PK  */                                           COMPUTE_C2
 1229                    END;        /* PJ  */                                           COMPUTE_C2
 1230                    IF MP < 4 THEN                                                  COMPUTE_C2
 1231                       DO;      /* RESOLVABLE BY CONTEXT  */                        COMPUTE_C2
 1232                          IF PROPER & (\MP) THEN /* CONTEXT IMPLICIT IN LENGTH  */  COMPUTE_C2
 1233                             OUTPUT = '   THEY CAN BE RESOLVED BY LENGTH.';         COMPUTE_C2
 1234                          ELSE                                                      COMPUTE_C2
 1235                             DO;                                                    COMPUTE_C2
 1236                                MP_SAVE(IJ) = MP_SAVE(IJ) ^ MP;                     COMPUTE_C2
 1237                                OUTPUT = '   THEY CAN BE RESOLVED BY ' ^^           COMPUTE_C2
 1238                                   CONTEXT_CLASS(MP) ^^ ' CONTEXT.';                COMPUTE_C2
 1239                             END;                                                   COMPUTE_C2
 1240                       END;                                                         COMPUTE_C2
 1241                 END;     /* OF TK = 0  */                                          COMPUTE_C2
 1242              K = K + 1;                                                            COMPUTE_C2
 1243              IK = INDEX(K);                                                        COMPUTE_C2
 1244           END;     /* DO WHILE  */                                                 COMPUTE_C2
 1245        END;     /* DO J  */                                                        COMPUTE_C2
 1246        EJECT_PAGE;                                                                 COMPUTE_C2
 1247        OUTPUT = 'C2 PRODUCTION CHOICE FUNCTION:';                                  COMPUTE_C2
 1248        TK = 0;                                                                     COMPUTE_C2
 1249        DO J = 1 TO NPR;                                                            COMPUTE_C2
 1250           IJ = INDEX(J);                                                           COMPUTE_C2
 1251           TJ = TAIL(IJ);                                                           COMPUTE_C2
 1252           IF TJ \= TK THEN                                                         COMPUTE_C2
 1253              DO;                                                                   COMPUTE_C2
 1254                 TK = TJ;                                                           COMPUTE_C2
 1255                 DOUBLE_SPACE;                                                      COMPUTE_C2
 1256                 OUTPUT = '   ' ^^ V(TJ) ^^                                         COMPUTE_C2
 1257  '  AS STACK TOP WILL CAUSE PRODUCTIONS TO BE CHECKED IN THIS ORDER:';             COMPUTE_C2
 1258              END;                                                                  COMPUTE_C2
 1259           OUTPUT = '';                                                             COMPUTE_C2
 1260           CALL OUTPUT_PRODUCTION (IJ);                                             COMPUTE_C2
 1261           DO CASE MP_SAVE(IJ) & 3;                                                 COMPUTE_C2
 1262              /* CASE 0  */                                                         COMPUTE_C2 CASE 0.
 1263              IF P_SAVE(IJ) THEN GO TO CASE_1;  /* EQUAL RIGHT PART MUST CHECK */   COMPUTE_C2
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 48
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1264              ELSE OUTPUT = '         THERE WILL BE NO CONTEXT CHECK.';             COMPUTE_C2
 1265                                                                                    COMPUTE_C2 CASE 1.
 1266              /* CASE 1  */                                                         COMPUTE_C2
 1267           CASE_1:                                                                  COMPUTE_C2
 1268              DO;                                                                   COMPUTE_C2
 1269                 OUTPUT =                                                           COMPUTE_C2
 1270  '         (0,1) CONTEXT WILL BE CHECKED.  LEGAL RIGHT CONTEXT:';                  COMPUTE_C2
 1271                 DO I = 1 TO NSY;  ON_RIGHT(I) = FALSE;  END;                       COMPUTE_C2
 1272                 DO PJ = IND(IJ) TO IND1(IJ);                                       COMPUTE_C2
 1273                    JCR = F11(PJ) & "FF";                                           COMPUTE_C2
 1274                    IF \ ON_RIGHT(JCR) THEN                                         COMPUTE_C2
 1275                       DO;                                                          COMPUTE_C2
 1276                          ON_RIGHT(JCR) = TRUE;                                     COMPUTE_C2
 1277                          OUTPUT = X12 ^^ DOTS ^^ V(JCR);                           COMPUTE_C2
 1278                       END;                                                         COMPUTE_C2
 1279                 END;                                                               COMPUTE_C2
 1280              END;                                                                  COMPUTE_C2
 1281                                                                                    COMPUTE_C2 CASE 2.
 1282              /* CASE 2  */                                                         COMPUTE_C2
 1283              DO;                                                                   COMPUTE_C2
 1284                 OUTPUT =                                                           COMPUTE_C2
 1285  '         (1,0) CONTEXT WILL BE CHECKED.  LEGAL LEFT CONTEXT:';                   COMPUTE_C2
 1286                 DO I = 1 TO NSY;  ON_LEFT(I) = FALSE;  END;                        COMPUTE_C2
 1287                 DO PJ = IND(IJ) TO IND1(IJ);                                       COMPUTE_C2
 1288                    JCL = SHR(F11(PJ) & "FF00", 8);                                 COMPUTE_C2
 1289                    IF \ ON_LEFT(JCL) THEN                                          COMPUTE_C2
 1290                       DO;                                                          COMPUTE_C2
 1291                          ON_LEFT(JCL) = TRUE;                                      COMPUTE_C2
 1292                          OUTPUT = X12 ^^ V(JCL) ^^ DOTS;                           COMPUTE_C2
 1293                       END;                                                         COMPUTE_C2
 1294                 END;                                                               COMPUTE_C2
 1295              END;                                                                  COMPUTE_C2
 1296                                                                                    COMPUTE_C2 CASE 3.
 1297              /* CASE 3  */                                                         COMPUTE_C2
 1298              DO;                                                                   COMPUTE_C2
 1299                 OUTPUT =                                                           COMPUTE_C2
 1300                    '         (1,1) CONTEXT WILL BE CHECKED.  LEGAL CONTEXT:';      COMPUTE_C2
 1301                 DO PJ = IND(IJ) TO IND1(IJ);                                       COMPUTE_C2
 1302                    OUTPUT = X12 ^^ V(SHR(F11(PJ) & "FF00", 8)) ^^                  COMPUTE_C2
 1303                       DOTS ^^ V(F11(PJ) & "FF");                                   COMPUTE_C2
 1304                 END;                                                               COMPUTE_C2
 1305              END;                                                                  COMPUTE_C2
 1306           END;   /* OF CASE STATEMENT  */                                          COMPUTE_C2 CASE 4.
 1307        END;  /* OF DO J  */                                                        COMPUTE_C2
 1308    END COMPUTE_C2;                                                                 COMPUTE_C2

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
CASE_1          LABEL      4863  PROGRAM   1263       1
CONTEXT_CLASS   CHARACTER   416   STRING   1163       1
IJ              FIXED     15758     DATA   1161      23
IK              FIXED     15759     DATA   1161      11
JCL             FIXED     15766     DATA   1161      10
JCR             FIXED     15767     DATA   1161      12
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 49
SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
 
JCT             FIXED     15764     DATA   1161       5
KCT             FIXED     15765     DATA   1161       5
PJ              FIXED     15762     DATA   1161       9
PK              FIXED     15763     DATA   1161       2
PROPER          BIT (9)   15768     DATA   1162       5
TJ              FIXED     15760     DATA   1161      11
TK              FIXED     15761     DATA   1161       8
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 50
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1309                                                                                   *
 1310  PUNCH_PRODUCTIONS:                                                               *
 1311     PROCEDURE;                                                                    *
 1312     DECLARE WIDE FIXED;                                                            PUNCH_PRODUCTIONS
 1313     IF \(CONTROL(BYTE('P')) ^ CONTROL(BYTE('O'))) THEN RETURN;                     PUNCH_PRODUCTIONS
 1314     IF CONTROL(BYTE('O')) THEN EJECT_PAGE;                                         PUNCH_PRODUCTIONS
 1315     OUTCARD = '  ';                                                                PUNCH_PRODUCTIONS
 1316     CALL PUNCH_CARD ('DECLARE NSY LITERALLY ''' ^^ NSY ^^ ''', NT LITERALLY '''    PUNCH_PRODUCTIONS
 1317        ^^ NT ^^ ''';');                                                            PUNCH_PRODUCTIONS
 1318     CALL BUILD_CARD ('DECLARE V(NSY) CHARACTER INITIAL (');                        PUNCH_PRODUCTIONS
 1319     DO I = 0 TO NSY;                                                               PUNCH_PRODUCTIONS
 1320        S = V(I);                                                                   PUNCH_PRODUCTIONS
 1321        T = '';                                                                     PUNCH_PRODUCTIONS
 1322        L = LENGTH(S) - 1;                                                          PUNCH_PRODUCTIONS
 1323        DO WHILE BYTE(S, L) = BLANK;  L = L - 1;  END;                              PUNCH_PRODUCTIONS
 1324        IF I > BASIC_NSY THEN                                                       PUNCH_PRODUCTIONS
 1325           DO;      /* CREATED SYMBOL:  ADJUST PRINT NAME  */                       PUNCH_PRODUCTIONS
 1326              L = L - 3;                                                            PUNCH_PRODUCTIONS
 1327              S = SUBSTR(S, 1);                                                     PUNCH_PRODUCTIONS
 1328           END;                                                                     PUNCH_PRODUCTIONS
 1329        DO J = 0 TO L;                                                              PUNCH_PRODUCTIONS
 1330           IF SUBSTR(S, J, 1) = '''' THEN T = T ^^ '''''';                          PUNCH_PRODUCTIONS
 1331           ELSE T = T ^^ SUBSTR(S, J, 1);                                           PUNCH_PRODUCTIONS
 1332        END;                                                                        PUNCH_PRODUCTIONS
 1333        IF I < NSY THEN CALL BUILD_CARD ('''' ^^ T ^^ ''',');                       PUNCH_PRODUCTIONS
 1334        ELSE CALL PUNCH_CARD ('''' ^^ T ^^ ''');');                                 PUNCH_PRODUCTIONS
 1335     END;                                                                           PUNCH_PRODUCTIONS
 1336     L = LENGTH(V(NT));                                                             PUNCH_PRODUCTIONS
 1337     CALL BUILD_CARD ('DECLARE V_INDEX(' ^^ L ^^ ') BIT(8) INITIAL (');             PUNCH_PRODUCTIONS
 1338     J = 1;                                                                         PUNCH_PRODUCTIONS
 1339     DO I = 1 TO L;                                                                 PUNCH_PRODUCTIONS
 1340        CALL BUILD_CARD (J ^^ ',');                                                 PUNCH_PRODUCTIONS
 1341        DO WHILE LENGTH(V(J)) = I;  J = J + 1;  END;                                PUNCH_PRODUCTIONS
 1342     END;                                                                           PUNCH_PRODUCTIONS
 1343     CALL PUNCH_CARD (NT+1 ^^ ');');                                                PUNCH_PRODUCTIONS
 1344     IF NT <= 15 THEN WIDE = 16;  /* FORCE LONG BIT STRINGS */                      PUNCH_PRODUCTIONS
 1345     ELSE WIDE = NT;                                                                PUNCH_PRODUCTIONS
 1346     I = 2*WIDE + 2;                                                                PUNCH_PRODUCTIONS
 1347     CALL PUNCH_CARD ('DECLARE C1(NSY) BIT(' ^^ I ^^ ') INITIAL (');                PUNCH_PRODUCTIONS
 1348     DO I = 0 TO NSY;                                                               PUNCH_PRODUCTIONS
 1349        T = '   "(2)';                                                              PUNCH_PRODUCTIONS
 1350        DO J = 0 TO WIDE;                                                           PUNCH_PRODUCTIONS
 1351           IF J MOD 5 = 0 THEN                                                      PUNCH_PRODUCTIONS
 1352              DO;                                                                   PUNCH_PRODUCTIONS
 1353                 CALL BUILD_CARD (T);                                               PUNCH_PRODUCTIONS
 1354                 T = '';                                                            PUNCH_PRODUCTIONS
 1355              END;                                                                  PUNCH_PRODUCTIONS
 1356           T = T ^^ GET (I, J);                                                     PUNCH_PRODUCTIONS
 1357        END;                                                                        PUNCH_PRODUCTIONS
 1358        IF I < NSY THEN CALL PUNCH_CARD (T ^^ '",');                                PUNCH_PRODUCTIONS
 1359        ELSE CALL PUNCH_CARD (T ^^ '");');                                          PUNCH_PRODUCTIONS
 1360     END;                                                                           PUNCH_PRODUCTIONS
 1361     K = COUNT(1) - 1;                                                              PUNCH_PRODUCTIONS
 1362     IF K < 0 THEN                                                                  PUNCH_PRODUCTIONS
 1363        DO;                                                                         PUNCH_PRODUCTIONS
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 51
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1364           CALL PUNCH_CARD ('DECLARE NC1TRIPLES LITERALLY ''0'';');                 PUNCH_PRODUCTIONS
 1365           CALL PUNCH_CARD ('DECLARE C1TRIPLES(0) FIXED;');                         PUNCH_PRODUCTIONS
 1366        END;                                                                        PUNCH_PRODUCTIONS
 1367     ELSE                                                                           PUNCH_PRODUCTIONS
 1368        DO;                                                                         PUNCH_PRODUCTIONS
 1369           CALL PUNCH_CARD ('DECLARE NC1TRIPLES LITERALLY ''' ^^ K ^^ ''';');       PUNCH_PRODUCTIONS
 1370           CALL BUILD_CARD ('DECLARE C1TRIPLES(NC1TRIPLES) FIXED INITIAL (');       PUNCH_PRODUCTIONS
 1371           J = 0;                                                                   PUNCH_PRODUCTIONS
 1372           DO I = 1 TO NTRIP;                                                       PUNCH_PRODUCTIONS
 1373              IF TV(I) = 1 THEN                                                     PUNCH_PRODUCTIONS
 1374                 DO;                                                                PUNCH_PRODUCTIONS
 1375                    IF J = K THEN CALL PUNCH_CARD (TRIPLE(I) ^^ ');');              PUNCH_PRODUCTIONS
 1376                    ELSE CALL BUILD_CARD (TRIPLE(I) ^^ ',');                        PUNCH_PRODUCTIONS
 1377                    J = J + 1;                                                      PUNCH_PRODUCTIONS
 1378                 END;                                                               PUNCH_PRODUCTIONS
 1379           END;                                                                     PUNCH_PRODUCTIONS
 1380        END;                                                                        PUNCH_PRODUCTIONS
 1381     CALL BUILD_CARD ('DECLARE PRTB(' ^^ NPR ^^ ') FIXED INITIAL (0,');             PUNCH_PRODUCTIONS
 1382     DO I = 1 TO NPR - 1;                                                           PUNCH_PRODUCTIONS
 1383        CALL BUILD_CARD (HEAD(INDEX(I)) ^^ ',');                                    PUNCH_PRODUCTIONS
 1384     END;                                                                           PUNCH_PRODUCTIONS
 1385     CALL PUNCH_CARD (HEAD(INDEX(NPR)) ^^ ');');                                    PUNCH_PRODUCTIONS
 1386     CALL BUILD_CARD ('DECLARE PRDTB(' ^^ NPR ^^ ') BIT(8) INITIAL (0,');           PUNCH_PRODUCTIONS
 1387     DO I = 1 TO NPR;                                                               PUNCH_PRODUCTIONS
 1388        L = INDEX(I);                                                               PUNCH_PRODUCTIONS
 1389        IF L > BASIC_NPR THEN L = 0;                                                PUNCH_PRODUCTIONS
 1390        IF I < NPR THEN CALL BUILD_CARD (L ^^ ',');                                 PUNCH_PRODUCTIONS
 1391        ELSE CALL PUNCH_CARD (L ^^ ');');                                           PUNCH_PRODUCTIONS
 1392     END;                                                                           PUNCH_PRODUCTIONS
 1393     CALL BUILD_CARD ('DECLARE HDTB(' ^^ NPR ^^ ') BIT(8) INITIAL (0,');            PUNCH_PRODUCTIONS
 1394     DO I = 1 TO NPR - 1;                                                           PUNCH_PRODUCTIONS
 1395        CALL BUILD_CARD (LEFT_PART(INDEX(I)) ^^ ',');                               PUNCH_PRODUCTIONS
 1396     END;                                                                           PUNCH_PRODUCTIONS
 1397     CALL PUNCH_CARD (LEFT_PART(INDEX(NPR)) ^^ ');');                               PUNCH_PRODUCTIONS
 1398     CALL BUILD_CARD ('DECLARE PRLENGTH(' ^^ NPR ^^ ') BIT(8) INITIAL (0,');        PUNCH_PRODUCTIONS
 1399     DO I = 1 TO NPR;                                                               PUNCH_PRODUCTIONS
 1400        J = 1;                                                                      PUNCH_PRODUCTIONS
 1401        K = HEAD(INDEX(I));                                                         PUNCH_PRODUCTIONS
 1402        DO WHILE K \= 0;                                                            PUNCH_PRODUCTIONS
 1403           J = J + 1;                                                               PUNCH_PRODUCTIONS
 1404           K = SHR(K, 8);                                                           PUNCH_PRODUCTIONS
 1405        END;                                                                        PUNCH_PRODUCTIONS
 1406        IF I = NPR THEN CALL PUNCH_CARD ( J ^^ ');');                               PUNCH_PRODUCTIONS
 1407        ELSE CALL BUILD_CARD (J ^^ ',');                                            PUNCH_PRODUCTIONS
 1408     END;                                                                           PUNCH_PRODUCTIONS
 1409     CALL BUILD_CARD ('DECLARE CONTEXT_CASE(' ^^ NPR ^^ ') BIT(8) INITIAL (0,');    PUNCH_PRODUCTIONS
 1410     DO I = 1 TO NSY;  TP_SAVE(I) = 0;  END;                                        PUNCH_PRODUCTIONS
 1411     DO I = 1 TO NPR;   /* COMPUTE CONTEXT CASE */                                  PUNCH_PRODUCTIONS
 1412        J = MP_SAVE(INDEX(I));  /* SET UP IN COMPUTE_C2, USED HERE  */              PUNCH_PRODUCTIONS
 1413        K = LEFT_PART(INDEX(I));                                                    PUNCH_PRODUCTIONS
 1414        DO CASE J;                                                                  PUNCH_PRODUCTIONS
 1415           /* CASE 0, CAN TELL BY EITHER LEFT OR RIGHT CONTEXT,                     PUNCH_PRODUCTIONS CASE 0.
 1416           USE LENGTH TO DECIDE UNLESS EQUAL */                                     PUNCH_PRODUCTIONS
 1417           J = P_SAVE(INDEX(I));  /* USE THE CHEAP TEST, IF REQUIRED  */            PUNCH_PRODUCTIONS
 1418           /* CASE 1, USE C1 MATRIX FOR THIS CASE */                                PUNCH_PRODUCTIONS CASE 1.
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 52
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1419           ;                                                                        PUNCH_PRODUCTIONS
 1420           /* CASE 2:  NEED LEFT CONTEXT TABLE */                                   PUNCH_PRODUCTIONS CASE 2.
 1421           TP_SAVE(K) = TP_SAVE(K) ^ 1;                                             PUNCH_PRODUCTIONS
 1422           /* CASE 3:  NEED BOTH LEFT AND RIGHT CONTEXT */                          PUNCH_PRODUCTIONS CASE 3.
 1423           TP_SAVE(K) = TP_SAVE(K) ^ 2;                                             PUNCH_PRODUCTIONS
 1424        END;                                                                        PUNCH_PRODUCTIONS CASE 4.
 1425        TOKEN_SAVE(K) = INDEX(I);                                                   PUNCH_PRODUCTIONS
 1426        IF I = NPR THEN CALL PUNCH_CARD (J ^^ ');');                                PUNCH_PRODUCTIONS
 1427        ELSE CALL BUILD_CARD (J ^^ ',');                                            PUNCH_PRODUCTIONS
 1428     END;                                                                           PUNCH_PRODUCTIONS
 1429     J = 0;   /* CONSTRUCT CONTEXT TABLES FOR C2 */                                 PUNCH_PRODUCTIONS
 1430     DO I = NT + 1 TO NSY;  /* CYCLE THRU NON-TERMINALS */                          PUNCH_PRODUCTIONS
 1431        SORT#(I) = J;                                                               PUNCH_PRODUCTIONS
 1432        IF TP_SAVE(I) THEN                                                          PUNCH_PRODUCTIONS
 1433           DO;                                                                      PUNCH_PRODUCTIONS
 1434              K = TOKEN_SAVE(I);                                                    PUNCH_PRODUCTIONS
 1435              M = 0;                                                                PUNCH_PRODUCTIONS
 1436              DO L = IND(K) TO IND1(K);                                             PUNCH_PRODUCTIONS
 1437                 P = SHR(F11(L), 8) & "FF";                                         PUNCH_PRODUCTIONS
 1438                 IF P \= M THEN                                                     PUNCH_PRODUCTIONS
 1439                    DO;                                                             PUNCH_PRODUCTIONS
 1440                       WORK(J), M = P;                                              PUNCH_PRODUCTIONS
 1441                       J = J + 1;  /* COUNT THE NUMBER OF ENTRIES */                PUNCH_PRODUCTIONS
 1442                    END;                                                            PUNCH_PRODUCTIONS
 1443              END;                                                                  PUNCH_PRODUCTIONS
 1444           END;                                                                     PUNCH_PRODUCTIONS
 1445     END;                                                                           PUNCH_PRODUCTIONS
 1446     IF J = 0 THEN J = 1;  /* ASSURE NON-NEGATIVE UPPER BOUND FOR ARRAY */          PUNCH_PRODUCTIONS
 1447     CALL BUILD_CARD ('DECLARE LEFT_CONTEXT(' ^^ J - 1 ^^                           PUNCH_PRODUCTIONS
 1448        ') BIT(8) INITIAL (');                                                      PUNCH_PRODUCTIONS
 1449     DO I = 0 TO J - 2;                                                             PUNCH_PRODUCTIONS
 1450        CALL BUILD_CARD (WORK(I) ^^ ',');                                           PUNCH_PRODUCTIONS
 1451     END;                                                                           PUNCH_PRODUCTIONS
 1452     CALL PUNCH_CARD (WORK(J-1) ^^ ');');                                           PUNCH_PRODUCTIONS
 1453     IF J > 255 THEN K = 16;  ELSE K = 8;  /* J < 256 ALLOWS 8 BIT PACKING */       PUNCH_PRODUCTIONS
 1454     CALL BUILD_CARD ('DECLARE LEFT_INDEX(' ^^ NSY-NT ^^ ') BIT(' ^^ K              PUNCH_PRODUCTIONS
 1455        ^^ ') INITIAL (');                                                          PUNCH_PRODUCTIONS
 1456     DO I = NT + 1 TO NSY;                                                          PUNCH_PRODUCTIONS
 1457        CALL BUILD_CARD (SORT#(I) ^^ ',');                                          PUNCH_PRODUCTIONS
 1458     END;                                                                           PUNCH_PRODUCTIONS
 1459     CALL PUNCH_CARD (J ^^ ');');                                                   PUNCH_PRODUCTIONS
 1460     J = 0;                                                                         PUNCH_PRODUCTIONS
 1461     DO I = NT + 1 TO NSY;                                                          PUNCH_PRODUCTIONS
 1462        SORT#(I) = J;  /* RECORD WHERE EACH NON-TERMINAL STARTS */                  PUNCH_PRODUCTIONS
 1463        IF SHR(TP_SAVE(I), 1) THEN  /* NEED BOTH CONTEXTS */                        PUNCH_PRODUCTIONS
 1464           DO;                                                                      PUNCH_PRODUCTIONS
 1465              K = TOKEN_SAVE(I);                                                    PUNCH_PRODUCTIONS
 1466              DO L = IND(K) TO IND1(K);                                             PUNCH_PRODUCTIONS
 1467                 TRIPLE(J) = F11(L) & "FFFF";                                       PUNCH_PRODUCTIONS
 1468                 J = J + 1;                                                         PUNCH_PRODUCTIONS
 1469              END;                                                                  PUNCH_PRODUCTIONS
 1470           END;                                                                     PUNCH_PRODUCTIONS
 1471     END;                                                                           PUNCH_PRODUCTIONS
 1472     IF J = 0 THEN J = 1;  /* ASSURE NON-NEGATIVE UPPER BOUND FOR ARRAY */          PUNCH_PRODUCTIONS
 1473     CALL BUILD_CARD ('DECLARE CONTEXT_TRIPLE(' ^^ J-1 ^^ ') FIXED INITIAL (');     PUNCH_PRODUCTIONS
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 53
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1474     DO I = 0 TO J - 2;                                                             PUNCH_PRODUCTIONS
 1475        CALL BUILD_CARD (TRIPLE(I) ^^ ',');                                         PUNCH_PRODUCTIONS
 1476     END;                                                                           PUNCH_PRODUCTIONS
 1477     CALL PUNCH_CARD (TRIPLE(J-1) ^^ ');');                                         PUNCH_PRODUCTIONS
 1478     IF J > 255 THEN K = 16;  ELSE K = 8;  /* J < 256 ALLOWS 8 BIT PACKING */       PUNCH_PRODUCTIONS
 1479     CALL BUILD_CARD ('DECLARE TRIPLE_INDEX(' ^^ NSY-NT ^^ ') BIT(' ^^ K            PUNCH_PRODUCTIONS
 1480        ^^ ') INITIAL (');                                                          PUNCH_PRODUCTIONS
 1481     DO I = NT + 1 TO NSY;   /* PUNCH MARGINAL INDEX TABLE */                       PUNCH_PRODUCTIONS
 1482        CALL BUILD_CARD (SORT#(I) ^^ ',');                                          PUNCH_PRODUCTIONS
 1483     END;                                                                           PUNCH_PRODUCTIONS
 1484     CALL PUNCH_CARD (J ^^ ');');                                                   PUNCH_PRODUCTIONS
 1485     DO I = 0 TO NSY;  P_SAVE(I) = 0;  END;                                         PUNCH_PRODUCTIONS
 1486     DO I = 1 TO NPR;       /* CYCLE THRU THE PRODUCTIONS */                        PUNCH_PRODUCTIONS
 1487        P = TAIL(INDEX(I));  /* MARGINAL INDEX INTO PRODUCTION TABLE */             PUNCH_PRODUCTIONS
 1488        IF P_SAVE(P) = 0 THEN P_SAVE(P) = I;                                        PUNCH_PRODUCTIONS
 1489     END;                                                                           PUNCH_PRODUCTIONS
 1490     P_SAVE(NSY+1) = NPR + 1;  /* MARK THE END OF THE PRODUCTION TABLE */           PUNCH_PRODUCTIONS
 1491     DO J = 0 TO NSY - 1;  /* TAKE CARE OF SYMBOLS THAT NEVER END A PRODUCTION */   PUNCH_PRODUCTIONS
 1492        I = NSY - J;                                                                PUNCH_PRODUCTIONS
 1493        IF P_SAVE(I) = 0 THEN P_SAVE(I) = P_SAVE(I+1);                              PUNCH_PRODUCTIONS
 1494     END;                                                                           PUNCH_PRODUCTIONS
 1495     CALL BUILD_CARD ('DECLARE PR_INDEX(' ^^ NSY ^^ ') BIT(8) INITIAL (');          PUNCH_PRODUCTIONS
 1496     DO I = 1 TO NSY;                                                               PUNCH_PRODUCTIONS
 1497        CALL BUILD_CARD (P_SAVE(I) ^^ ',');                                         PUNCH_PRODUCTIONS
 1498     END;                                                                           PUNCH_PRODUCTIONS
 1499     CALL PUNCH_CARD (NPR+1 ^^ ');');                                               PUNCH_PRODUCTIONS
 1500     CALL PRINT_TIME;                                                               PUNCH_PRODUCTIONS
 1501  END PUNCH_PRODUCTIONS;                                                            PUNCH_PRODUCTIONS

SYMBOL TABLE DUMP

SYMBOL          TYPE       LOC   SEGMENT DEFINED REF COUNT
WIDE            FIXED     15955     DATA   1312       4
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 54
 LINE    SOURCE STATEMENT                                                               PROCEDURE AND COMPILER INFORMATION
 
 1502                                                                                   *
 1503     /* THE ACTUAL EXECUTION IS CONTROLLED FROM THIS LOOP  */                      *
 1504                                                                                   *
 1505     OUTPUT(-2) = 'GRAMMAR FILE: ';                                                *
 1506     FILENAME(0) = INPUT(-1);                                                      *
 1507     OUTPUT(-2) = ' OUTPUT FILE: ';                                                *
 1508     FILENAME(1) = INPUT(-1);                                                      *
 1509                                                                                   *
 1510                                                                                   *
 1511     DO WHILE STACKING;                                                            *
 1512        FIRST_TIME, LAST_TIME = TIME;                                              *
 1513        ITERATION_COUNT, TROUBLE_COUNT = 1;                                        *
 1514        DO WHILE TROUBLE_COUNT > 0;                                                *
 1515           IF ITERATION_COUNT = 1 THEN CALL READ_GRAMMAR;                          *
 1516           ELSE CALL IMPROVE_GRAMMAR;                                              *
 1517           CALL PRINT_TIME;                                                        *
 1518           CALL COMPUTE_HEADS;                                                     *
 1519           CALL PRINT_TIME;                                                        *
 1520           IF \ AMBIGUOUS THEN                                                     *
 1521              DO;                                                                  *
 1522                 CALL PRODUCE;                                                     *
 1523                 CALL PRINT_TIME;                                                  *
 1524                 CALL INDEX_F11;                                                   *
 1525                 CALL SORT_PRODUCTIONS;                                            *
 1526                 CALL COMPUTE_C1;                                                  *
 1527                 CALL PRINT_TIME;                                                  *
 1528                 CALL COMPUTE_C2;                                                  *
 1529                 CALL PRINT_TIME;                                                  *
 1530                 DOUBLE_SPACE;                                                     *
 1531              END;                                                                 *
 1532           OUTPUT = 'ANALYSIS COMPLETE FOR ITERATION ' ^^ ITERATION_COUNT;         *
 1533           IF ERROR_COUNT = 0 THEN OUTPUT = 'NO ERRORS WERE DETECTED.';            *
 1534           ELSE IF ERROR_COUNT = 1 THEN OUTPUT = '* ONE ERROR WAS DETECTED.';      *
 1535           ELSE IF ERROR_COUNT <= 20 THEN                                          *
 1536              OUTPUT = SUBSTR('********************', 0, ERROR_COUNT) ^^ ' ' ^^    *
 1537                 ERROR_COUNT ^^ ' ERRORS WERE DETECTED.';                          *
 1538           ELSE OUTPUT = '******************** ... ' ^^ ERROR_COUNT ^^             *
 1539              ' ERRORS WERE DETECTED.';                                            *
 1540           ITERATION_COUNT = ITERATION_COUNT + 1;                                  *
 1541           IF AMBIGUOUS ^ \ CONTROL(BYTE('I')) THEN TROUBLE_COUNT = 0;             *
 1542        END;                                                                       *
 1543        IF \ AMBIGUOUS THEN CALL PUNCH_PRODUCTIONS;                                *
 1544        IF CONTROL(BYTE('P')) THEN OUTPUT = 'PUNCHING COMPLETE.';                  *
 1545     END;                                                                          *
 1546  EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF EOF  *

SYMBOL TABLE DUMP

SYMBOL            TYPE       LOC   SEGMENT DEFINED REF COUNT
ADD_TROUBLE       PROCEDURE   606  PROGRAM    198       2
  PARAMETER  1    FIXED     15233     DATA    199       6
  PARAMETER  2    FIXED     15234     DATA    199       4
AMBIGUOUS         BIT (9)    1935     DATA     48       5
BASIC_NPR         FIXED     15193     DATA     85       3
BASIC_NSY         FIXED     15192     DATA     85       4
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 55
SYMBOL            TYPE       LOC   SEGMENT DEFINED REF COUNT
 
BUILD_CARD        PROCEDURE   692  PROGRAM    223      29
  PARAMETER  1    CHARACTER   281   STRING    224      32
BUILD_RIGHT_PART  PROCEDURE  1301  PROGRAM    375       2
  PARAMETER  1    FIXED     15345     DATA    376       4
CARDIMAGE         CHARACTER   266   STRING     70      34
CHANGE            BIT (9)    2008     DATA     58       7
CLEAR_HEADS       PROCEDURE   399  PROGRAM    112       1
CLEAR_WORK        PROCEDURE   463  PROGRAM    141       2
COMPACTIFY        PROCEDURE   128  PROGRAM      0       1
COMPUTE_C1        PROCEDURE  3930  PROGRAM   1043       1
COMPUTE_C2        PROCEDURE  4386  PROGRAM   1155       1
COMPUTE_HEADS     PROCEDURE  2768  PROGRAM    753       1
CONTROL           BIT (9)    1943     DATA     51      21
COUNT             FIXED      8893     DATA     72      11
COUNT_COMPACT     FIXED        33     DATA      0       2
CP                FIXED      1939     DATA     49      21
DOTS              CHARACTER   274   STRING     74       6
DOUBLE            CHARACTER   262   STRING     54      18
EMPTY             CHARACTER   263   STRING     66       5
ENTER             PROCEDURE   509  PROGRAM    164       2
  PARAMETER  1    FIXED     15220     DATA    165       5
  PARAMETER  2    FIXED     15221     DATA    165       4
ERROR             PROCEDURE   498  PROGRAM    157      16
  PARAMETER  1    CHARACTER   275   STRING    158      17
ERROR_COUNT       FIXED      8907     DATA     77      10
EXPAND            PROCEDURE  1494  PROGRAM    434       1
  PARAMETER  1    FIXED     15372     DATA    435       3
  PARAMETER  2    FIXED     15375     DATA    435       5
F11               FIXED      8909     DATA     80      17
FIRST_TIME        FIXED      8890     DATA     71       2
FREEBASE          FIXED        32     DATA      0       1
FREELIMIT         FIXED        11     DATA      0       1
GET               PROCEDURE   415  PROGRAM    120       7
  PARAMETER  1    FIXED     15203     DATA    121       8
  PARAMETER  2    FIXED     15204     DATA    121       9
GOAL_SYMBOL       FIXED      1942     DATA     49       9
HALF_LINE         CHARACTER   264   STRING     68       2
HEAD              FIXED      6106     DATA     59       6
HEAD_TABLE        BIT (9)    6801     DATA     65       4
I                 FIXED      8902     DATA     76     212
IMPROVE_GRAMMAR   PROCEDURE  2543  PROGRAM    700       1
IND               FIXED      1167     DATA     47      13
IND1              FIXED      1423     DATA     47      13
INDEX             BIT (9)    1103     DATA     47      35
INDEX_F11         PROCEDURE  3652  PROGRAM    963       1
IS_HEAD           PROCEDURE   351  PROGRAM     90       9
  PARAMETER  1    FIXED     15195     DATA     91      10
  PARAMETER  2    FIXED     15196     DATA     91      11
ITERATION_COUNT   FIXED     15194     DATA     86       7
J                 FIXED      8903     DATA     76     109
K                 FIXED      8904     DATA     76      77
L                 FIXED      8905     DATA     76      59
LAST_TIME         FIXED      8891     DATA     71       3
LEFT_PART         BIT (9)     591     DATA     45      28
LEVEL             FIXED      1941     DATA     49      19
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 56
SYMBOL            TYPE       LOC   SEGMENT DEFINED REF COUNT
 
LINE_OUT          PROCEDURE   663  PROGRAM    213       6
  PARAMETER  1    FIXED     15237     DATA    214       9
  PARAMETER  2    CHARACTER   278   STRING    214       7
LOOK_UP           PROCEDURE  1456  PROGRAM    416       1
  PARAMETER  1    CHARACTER   339   STRING    417       3
M                 FIXED      8906     DATA     76      26
MP                FIXED      6670     DATA     63      18
MP_SAVE           BIT (9)    6606     DATA     63       7
NETRY             FIXED      8889     DATA     71       9
NF11              FIXED     13910     DATA     80      10
NPR               FIXED      1937     DATA     49      58
NSY               FIXED      1936     DATA     49      56
NT                FIXED      1940     DATA     49      31
NTRIP             FIXED     15163     DATA     81      15
ON_LEFT           BIT (9)     975     DATA     46       6
ON_RIGHT          BIT (9)    1039     DATA     46      11
OUTCARD           CHARACTER   267   STRING     70      11
OUTPUT_PRODUCTION PROCEDURE  1339  PROGRAM    387       6
  PARAMETER  1    FIXED     15348     DATA    388       9
P                 FIXED      6800     DATA     64      31
PACK              PROCEDURE   479  PROGRAM    149       4
  PARAMETER  1    BIT (9)   15212     DATA    150       5
  PARAMETER  2    BIT (9)   15213     DATA    150       5
  PARAMETER  3    BIT (9)   15214     DATA    150       5
  PARAMETER  4    BIT (9)   15215     DATA    150       5
PAGE              CHARACTER   261   STRING     54       9
PRINT             CHARACTER   270   STRING     73       6
PRINT_MATRIX      PROCEDURE   775  PROGRAM    250       2
  PARAMETER  1    CHARACTER   288   STRING    251       3
  PARAMETER  2    FIXED     15251     DATA    251       5
PRINT_TIME        PROCEDURE  1363  PROGRAM    394       9
PRINT_TRIPLES     PROCEDURE  1149  PROGRAM    336       1
  PARAMETER  1    CHARACTER   318   STRING    337       2
PRODUCE           PROCEDURE  3041  PROGRAM    813       1
PRODUCTION        FIXED       719     DATA     46      12
PUNCH_CARD        PROCEDURE   743  PROGRAM    238      21
  PARAMETER  1    CHARACTER   285   STRING    239      22
PUNCH_PRODUCTIONS PROCEDURE  5030  PROGRAM   1310       1
P_SAVE            BIT (9)    6736     DATA     64      15
READ_GRAMMAR      PROCEDURE  1560  PROGRAM    461       1
RIGHT_HEAD        BIT (9)     655     DATA     45      13
S                 CHARACTER   268   STRING     70       9
SET               PROCEDURE   435  PROGRAM    130       5
  PARAMETER  1    FIXED     15205     DATA    131       6
  PARAMETER  2    FIXED     15206     DATA    131       7
  PARAMETER  3    FIXED     15207     DATA    131       6
SET_HEAD          PROCEDURE   370  PROGRAM    101       3
  PARAMETER  1    FIXED     15197     DATA    102       4
  PARAMETER  2    FIXED     15198     DATA    102       5
SORT#             FIXED      1679     DATA     48      27
SORT_PRODUCTIONS  PROCEDURE  3745  PROGRAM    994       1
SP                FIXED      1938     DATA     49      28
STACK             BIT (9)    6426     DATA     62      21
STACKING          BIT (9)   15164     DATA     82       2
T                 CHARACTER   269   STRING     70      32
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 57
SYMBOL            TYPE       LOC   SEGMENT DEFINED REF COUNT
 
TAIL              BIT (9)    6362     DATA     59       6
TERMINATOR        FIXED      8908     DATA     78       6
TEXT              BIT (9)    6477     DATA     62       4
THIS_TIME         FIXED      8892     DATA     71       4
TOKEN             FIXED      6605     DATA     63       5
TOKEN_SAVE        BIT (9)    6541     DATA     63       5
TP                FIXED      6735     DATA     64      10
TP_SAVE           BIT (9)    6671     DATA     64       9
TRIPLE            FIXED     13911     DATA     81      14
TROUBLE1          BIT (9)   15165     DATA     83       3
TROUBLE2          BIT (9)   15178     DATA     84       3
TROUBLE_COUNT     FIXED     15191     DATA     84      12
TV                BIT (9)   14912     DATA     81       9
V                 CHARACTER     5   STRING     45      55
VALUE             FIXED      8900     DATA     75       5
WORK              BIT (9)    2009     DATA     58       7
X12               CHARACTER   265   STRING     69       3
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 58

 
                                        C O M P I L E R   S T A T I S T I C S

1546 LINES CONTAINING 936 STATEMENTS WERE COMPILED.
NO ERRORS WERE DETECTED.
6413 WORDS OF PROGRAM, 16216 WORDS OF DATA, AND 520 WORDS OF DESCRIPTORS.  TOTAL CORE REQUIREMENT 23149 WORDS.
TOTAL TIME IN COMPILER    = 0:17.461
INITIALIZATION TIME       = 0:0.216
ACTUAL COMPILATION TIME   = 0:16.185
POST-COMPILATION CLEAN-UP = 0:1.60

MACRO DEFINITIONS:
 
NAME           AT LINE REF COUNT LITERAL VALUE
GS                259        9    16
TRUE               52       22    1
DISK               53        0    3
FALSE              52       13    0
PUNCH              53        2    2
BLANK              57        8    BYTE(' ')
DEPTH              61        5    255
DOLLAR             57        1    BYTE('$')
DX_SIZE             0        2    500
MAXNF11            79        2    5000
CARRIAGE           53        0    1
MAXNTRIP           79        3    1000
TEXTLIMIT          60        2    255
EJECT_PAGE         55        9    OUTPUT(1) = PAGE
STACKLIMIT         60        2    200
MAXTROUBLE         83        3    50
NUMBER_HIGH       258        4    48
DOUBLE_SPACE       56       18    OUTPUT(1) = DOUBLE
LEFT_BRACKET      467        1    BYTE('<')
RIGHT_BRACKET     468        1    BYTE('>')
 
ID COMPARES       = 3092
SYMBOL TABLE SIZE = 169
MACRO DEFINITIONS = 20
SCAN              = 10044
EMITINST          = 6956
FORCE ACCUMULATOR = 2907
ARITHEMIT         = 453
GENERATE STORE    = 690
FREE STRING AREA  = 12420
COMPACTIFICATIONS = 66
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 59
INSTRUCTION FREQUENCIES
 
.INIT.    1
.INPT.    3
.OUTP.    101
.EXIT.    3
.NAME.    2
CALLI     3
ILDB      3
LDB       166
IDPB      3
DPB       104
MOVE      1664
MOVEI     99
MOVEM     1200
MOVN      3
MOVM      1
IMUL      3
IMULI     4
IDIV      4
IDIVI     19
ROT       4
LSH       323
LSHC      7
BLT       2
JRST      468
PUSHJ     437
PUSH      9
POP       9
POPJ      71
ADD       39
ADDI      291
ADDM      2
SUB       37
SUBI      45
CAIL      9
CAIE      38
CAILE     2
CAIGE     5
CAIN      28
CAIG      11
CAML      11
CAME      19
CAMLE     110
CAMGE     5
CAMN      8
CAMG      15
JUMP      1
JUMPE     60
JUMPA     142
JUMPGE    1
JUMPN     2
SKIPE     4
SKIPN     1
AOSA      104
SOJG      3
SETZM     47
ANALZR.XPL  COMPILED 1-FEB-1981  AT 12:42:24 BY VERSION 4.0                              PAGE 60
INSTRUCTION FREQUENCIES
 
AND       51
ANDI      319
IOR       25
IORI      5
SETCA     13
HLL       5
HRLI      2
HRLM      1
HLRZ      1
HRREI     235