      HED STATEMENT SYNTAX PROCESSORS 
      ORG 14000B
* 
* ******************************* 
****                           ***
***  CHECK SYNTAX OF STATEMENT  *** 
****                           ***
* ******************************* 
* 
*  PBPTR POINTS TO THE LAST WORD +1 OF THE PREVIOUS PROGRAM AND 
*  THUS ALSO POINTS TO THE FIRST WORD OF AVAILABLE USER SPACE,
*  WHERE THE NEW STATEMENT WILL BE TRANSLATED.  WHEN AN ERROR 
*  OCCURS UNDER 'TAPE' MODE, THE USER'S TERR BIT IN THE FIRST WORD
*  OF HIS TTY TABLE IS SET AND HIS COPY OF ERRCT IS BUMPED. IF AN 
*  OUT-OF-STORAGE ERROR OCCURS IN 'TAPE' MODE, SYMTB IS SET TO 1
*  AND ALL SUBSEQUENT PROGRAM MATERIAL IS REJECTED.  IF UPON ENTRY
*  THE PRIOR PROGRAM IS NULL, ALL FLAGS ARE SET TO NULL; IF THE 
*  PRIOR PROGRAM IS NOT NULL, IT IS PLACED IN 'SOURCE' MODE. SYNTAX 
*  WILL REJECT ADDITIONAL STATEMENTS IF FEWER THAN 200 WORDS OF 
*  USER SPACE ARE AVAILABLE BUT WILL ACCEPT STATEMENT DELETIONS IF
*  IN 'KEY' MODE. 
* 
SYNTX LDB PBPTR     NULL
      CPB PBUFF       PROGRAM?
      JMP DCLNU,I   YES 
      LDA TERR      ANY TAPE ERRORS 
      IOR CMSK        FOR THIS USER?
      INA,SZA A/
      JMP SYNT1     NO
      CPA ERRCT       IMBEDDED IN CODE? 
      JMP TAPEA,I   NO,FINISH ABORTED ERROR CLEANUP 
SYNT1 JSB SINIT     YES, PREPARE PROGRAM
      JSB DCMPL       FOR SYNTAX
      CLB           SET LINE NUMBER 
      STB PBPTR,I     TO ZERO 
      LDA PBPTR     SET SYNTAX POINTER TO FIRST 
      STA SBPTR       AVAILABLE WORD OF USER SPACE
      STA SBUFA     SAVE POINTER TO SYNTAX BUFFER 
      ADA .105        AND TO
      STA SSTAK         SYNTAX STACK
      STA SYNTQ 
      INB           DOES 'OUT OF STORAGE' 
      CPB SYMTB       ERROR EXIST?
      JMP SER7A,I   YES 
      JSB GETCR     NO, EMPTY RECORD? 
      JMP ACC5A,I   YES 
      JSB BCKSP     NO
*                               * 
**  DETERMINE SEQUENCE NUMBER  ** 
*                               * 
* *q
*  A RECORD CONSISTING ONLY OF A SEQUENCE NUMBER WILL CAUSE THE 
*  DELETION OF A PREVIOUSLY ACCEPTED STATEMENT REFERENCED BY THAT 
*  SEQUENCE NUMBER. 
* *q
      JSB BLDIN     RECORD
      STB SBPTR,I     SEQUENCE
      ISZ SBPTR         NUMBER
      CPA .+15B     NULL STATEMENT? 
      JMP DELSA,I   YES 
      ISZ SBPTR     NO, SKIP STATEMENT LENGTH WORD
      STA SBPTR,I   SAVE FIRST CHARACTER
      LDA PBPTR     ACCEPTABLE AMOUNT 
      ADA LW200       OF USER SPACE 
      SSA,RSS           REMAINING?
      JSB SERRS,I   NO
*                              *
**  DETERMINE STATEMENT TYPE  **
*                              *
      LDA .+7       SET MAXIMUM 
      STA MAXCR       SYMBOL LENGTH 
      LDA STTYP     STATEMENT-TYPE NAMES
      LDB .-21      -(NUMBER OF STATEMENT TYPES)
      JSB TBSRH     FIND STATEMENT TYPE 
      LDA LETOP     NO, ASSUME 'IMPLIED' LET
      LDB .-9       DISALLOW
      STB MSFLG       MULTIPLE STORE
      LDB .+3       SET MAXCR TO MOST 
      STB MAXCR       COMMON VALUE
      CLB           TURN OFF
      STB PFLAG       'PARAMETER' MODE
      LSR 9         RIGHT JUSTIFY OPERATOR CODE 
      STA SFLAG     TURN OFF STRING AND STORE MODES 
      STA DFLAG     TURN ON 'SUBSCRIPT' MODE
      ADA STBAS     BRANCH TO 
      JMP 0,I         SYNTAX ROUTINE
* 
***                        ** 
**  <LET STATEMENT> SYNTAX  **
***                        ** 
* 
LET0  LDA LETOP     FAKE
      STA SBPTR,I     A 
      JSB BCKSP         'LET' 
LETS  LDB SBPTR     ENABLE A
      STB SFLAG       STRING VARIABLE 
      ISZ MSFLG     TURN ON 'MULTIPLE STORE' MODE 
      JSB FSC       ANALYZE FORMULA 
      ISZ SFLAG     STRING VARIABLE FOUND?
      JMP LET1      NO
      JSB SYMCK     YES, (B) IS LEFT AT -1
      DEF ASSOP-1   DEMAND ASSIGNMENT OPERATOR
      JSB SERRS+3,I NOT FOUND 
      JSB RSTOP     RECORD A STRING OPERAND 
      JMP EOST      DEMAND END OF STATEMENT 
LET1  ISZ SFLAG     DID A STORE OCCUR?
      JSB SERRS+3,I NO
**                                **
***  CHECK FOR END OF STATEMENT  ***
**                                **
EOST  CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      JSB SERRS+4,I NO
* *q
***                        ** 
**  <DIM STATEMENT> SYNTAX  **
***                        ** 
* 
DIMS  CLA           FLAG AS DIM STATEMENT 
* 
***                        ** 
**  <COM STATEMENT> SYNTAX  **
***                        ** 
* 
COMS  STA CDFLG     FLAG AS COM STATEMENT 
      STB DFLAG     TURN ON 'DIM' MODE ( (B)=0 )
      LDA SBPTR     ENABLE STRING 
      STA SFLAG       VARIABLE
      JSB VAROP     SEEK VARIABLE OPERAND 
      JSB SERRS+5,I IMPROPER SUBSCRIPT
COMS0 JMP COMS1     ARRAY OR STRING FOUND 
      CLB           SIMPLE VARIABLE 
      CPB CDFLG     'DIM'?
      JSB SERRS+5,I  YES--ERROR 
COMS1 CPA .+15B     NO, CARRIAGE RETURN FOLLOWS?
      JMP ACCSA,I   YES 
      CCB           NO
      JSB SYMCK     COMMA?
      DEF COMMA-1 
      JSB SERRS+6,I NO
      JMP COMS+2    YES 
* 
***                        ** 
**  <DEF STATEMENT> SYNTAX  **
***                        ** 
* 
DEFS  JSB LTR       FIRST TWO 
      JSB SERRS+7,I 
      ALF,ALF         CHARACTERS
      IOR TEMP+1
      CPA FN            'FN' ?
      RSS           YES 
      JSB SERRS+7,I NO
      JSB LTR       FOLLOWED BY A LETTER? 
      JSB SERRS+7,I NO
      LDA TEMP+1    YES,
      LDB .58         RECORD
      JSB STROP         FUNCTION
      LDA TEMP+2    RETRIEVE FOLLOWING CHARACTER
      JSB LPCK      DEMAND LEFT PARENTHESIS 
      IOR FLGBT     SET FLAG FOR
      STA SBPTR,I     FORMAL PARAMETER
      JSB VAROP     DEMAND A SIMPLE VARIABLE
      NOP           NONE
      JSB SERRS+8,I   FOUND 
      JSB RPCK      DEMAND A RIGHT PARENTHESIS
      CCB           ASSIGNMENT
      JSB SYMCK       OPERATOR
      DEF ASSOP-1       NEXT? 
      JSB SERRS+3,I NO
      LDA .-2       YES,
      ADA SBPTR       ISOLATE 
      LDA 0,I           AND SAVE
      AND B777            FORMAL
      STA PFLAG             PARAMETER 
      JSB FSC       FETCH DEFINING FORMULA
      JSB SBPUD     RECORD END-OF-FORMULA OPERATOR
      JMP EOST      DEMAND END OF STATEMENT 
* 
* 
***                          ** 
**  <FILES STATEMENT> SYNTAX  **
***                          ** 
* 
FILES CLA,RSS       SUPPRESS BLANKS 
* 
**                               ** 
***  <CHAIN STATEMENT> SYNTAX  ***
**                               ** 
* 
CHANS EQU FILES 
* 
***                        ** 
**  <REM STATEMENT> SYNTAX  **
***                        ** 
* 
REMS  LDA .+15B     DUMMY STATEMENT TERMINATOR
      CLB,INB       SET CHARACTER FLAG TO 'LOW HALF'
      JSB CHRST     RECORD REMAINDER OF STATEMENT 
      JMP ACCSA,I     AS A STRING 
* 
***                                             **
**  <GOTO STATEMENT> & <GOSUB STATEMENT> SYNTAX  ** 
***                                             **
* 
GOTOS LDA BADDR     SAVE BUFFER 
      STA TEMP+1      POINTER 
      CCA           SET INTCK MODE TO 
      STA GFLAG       'EXIT ON ERROR' 
      JSB PRGIN     SEEK SEQUENCE NUMBER
      JMP GOTO3     FOUND 
      CCB           NOT FOUND 
GOTO1 ADB SBPTR     BACK UP 
      STB SBPTR       SYNTAX POINTER
      LDA SBPTR,I   ERASE 
      AND OPMSK       'INTEGER FOLLOWS' 
      STA SBPTR,I       FLAG
      LDA TEMP+1    RESTORE BUFFER
      STA BADDR       POINTER 
      JSB FSC       SEEK FORMULA
      CPA .+15B     END-OF-RECORD?
      JSB SERRS+9,I YES 
      ALF,ALF       NO, DO
      STA TEMP+1      NEXT
      JSB GETCR         TWO 
      JSB SERRS+9,I       CHARACTERS
      IOR TEMP+1            FORM
      CPA OF                  'OF' ?
      RSS           YES 
      JSB SERRS+9,I NO
      LDA OFOP      RECORD
      STA SBPTR,I     'OF' AND
      JSB SBPUD         ADVANCE POINTER 
GOTO2 JSB BLDIN     DEMAND A SEQUENCE NUMBER
      STB SBPTR,I   RECORD IT 
      JSB SBPUD 
      CPA .+44      COMMA NEXT? 
      JMP GOTO2     YES 
      JMP EOST      NO, DEMAND END OF STATEMENT 
GOTO3 CPA .+15B     IF END-OF-STATEMENT,
      JMP ACCSA,I     ACCEPT IT 
      STA GFLAG    NO, RE-ENABL BAD INTEGER ERROR 
      LDB .-2 jj
      JMP GOTO1 !!
* 
***                       **
**  <IF STATEMENT> SYNTAX  ** 
***                       **
* qq
IFS   ISZ SBPTR     FETCH NEXT
      JSB GETCR       CHARACTER 
      JSB SERRS+10,I    NONE FOUND               (D)
      STA SBPTR,I   FOUND, SAVE IT
      LDA AEND      LOOK
      CCB             FOR 
      JSB TBSRH         'END' 
      JMP IF0       NOT FOUND 
      JSB FILRF     FOUND, GET FILE REFERENCE 
      JSB SERRS+32,I  NONE FOUND
      JMP IF1+1     FOUND 
IF0   JSB BCKSP     RESTORE 
      CCB             TO
      ADB SBPTR         ENTRY 
      STB SBPTR           STATUS
      STB SFLAG     ENABLE STRING VARIABLE
      JSB FSC       SEEK DECISION FORMULA 
      ISZ SFLAG     STRING VARIABLE FOUND?
      JMP IF1+1     NO
      STA TEMP+1    YES, SAVE NEXT CHARACTER
      LDB .-3       MAXCR = 3 FROM FSC
      STA SBPTR,I   MULTICHARACTER
      LDA MCREL       RELATIONAL
      JSB TBSRH         OPERATOR? 
      RSS           NO
      JMP IF1       YES 
      LDA TEMP+1    RETRIEVE CHARACTER
      LDB .-4       SINGLE CHARACTER
      JSB SYMCK       RELATIONAL
      DEF RELOS-1       OPERATOR? 
      JSB SERRS+16,I  NO
IF1   JSB RSTOP     YES, RECORD A STRING OPERAND
      STA SBPTR,I   SAVE NEXT CHARACTER 
      ISZ MAXCR     BUMP LIMIT TO FOUR CHARACTERS 
      LDA ATHEN     LOOK
      CCB             FOR 
      JSB TBSRH         'THEN'
      JSB SERRS+10,I  NOT FOUND 
      JSB PRGIN     DEMAND A SEQUENCE NUMBER
      JMP EOST      DEMAND END OF STATEMENT 
* 
***                        ** 
**  <FOR STATEMENT> SYNTAX  **
***                        ** 
* 
FORS  JSB VAROP     SEEK A SIMPLE VARIABLE
      NOP           NONE
      JSB SERRS+8,I   FOUND 
      CCB           DEMAND AN 
      JSB SYMCK       ASSIGNMENT
      DEF ASSOP-1       OPERATOR
      JSB SERRS+3,I NOT FOUND 
      JSB FSC       RECORD INITIALIZATION FORMULA 
      CPA .+15B    ARE WE AT STATEMENT END?          [X]
      JSB SERRS+11,I   YES ERROR                     [X]
      ALF,ALF       DO
      STA TEMP+1      NEXT
      JSB GETCR         TWO 
      JSB SERRS+11,I      CHARACTERS
      IOR TEMP+1            FORM
      CPA TO                  'TO' ?
      RSS           YES 
      JSB SERRS+11,I  NO
      LDA TOOP      RECORD
      STA SBPTR,I     'TO'
      JSB FSC       RECORD LIMIT FORMULA
      CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      STA SBPTR,I   NO, IS NEXT 
      ISZ MAXCR 
      LDA ASTEP       SYMBOL
      CCB 
      JSB TBSRH         'STEP' ?
      JSB SERRS+12,I  NO
      JSB FSC       YES, RECORD STEP SIZE 
      JMP EOST      DEMAND END OF STATEMENT 
* 
***                         **
**  <NEXT STATEMENT> SYNTAX  ** 
***                         **
* 
NEXTS JSB VAROP     SEEK SIMPLE VARIABLE
      NOP           NOT 
      JSB SERRS+8,I   FOUND 
      JMP EOST      DEMAND END OF STATEMENT 
* 
***                                      ** 
**  <RETURN STATEMENT>, <END STATEMENT>,  **
**    AND <STOP STATEMENT> SYNTAX         **
***                                      ** 
* qq
ENDS  ISZ SBPTR     RECORD NULL OPERAND 
      JSB GETCR     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      JSB SERRS+4,I NO
* 
      SKP 
***                         **
**  <DATA STATEMENT> SYNTAX  ** 
***                         **
* 
DATAS JSB SBPUD 
      CLA           INITIALIZE
      STA SIGN        SIGN
      JSB GETCR     REQUEST A CHARACTER 
      JSB SERRS+13,I  END-OF-INPUT CONDITION
      CLB,INB 
      CPA .+43      '+' ? 
      JMP DATA4     YES 
      CCB           NO
      CPA .+45      '-' ? 
      JMP DATA4     YES 
DATA1 JSB NUMCK     NO, NUMBER? 
      JMP DATA3     NO
      JSB SERRS+14,I  BAD EXPONENT
      LDB .-3       NUMBER, 
      ADB SBPTR       MARK
      LDA 1,I           PREVIOUS
      IOR FLGBT           OPERATOR AS 
      STA 1,I               'NUMBER FOLLOWS'
      LDA TEMP+1    RETRIEVE FOLLOWING CHARACTER
DATA2 CCB           COMMA 
      JSB SYMCK 
      DEF COMMA-1     NEXT? 
      JMP EOST      NO, DEMAND END OF STATEMENT 
      JMP DATAS     YES 
DATA3 CPB SIGN      SIGN FOUND? ( (B) = 0 ) 
      RSS           NO
      JSB SERRS+15,I  YES 
      JSB GETST     DEMAND A STRING CONSTANT
      JMP DATA2 2
DATA4 STB SIGN      RECORD SIGN 
      JSB GETCR 
      JSB SERRS+15,I  END-OF-INPUT CONDITION
      JMP DATA1 
* 
***                         **
**  <READ STATEMENT> SYNTAX  ** 
***                         **
* 
READS JSB RECRF     READ FROM FILE? 
      JMP READ1     NO
      CPA .+15B     YES, PSUEDO-RESTORE?
      JMP ACCSA,I   YES 
      CPA B73       NO, ';' ? 
      JMP INPTS     YES 
      JSB SERRS+6,I NO
READ1 JSB BCKSP 
* 
***                          ** 
**  <INPUT STATEMENT> SYNTAX  **
***                          ** 
* 
INPTS LDB SBPTR     ENABLE STRING 
      STB SFLAG       VARIABLE
      JSB VAROP     SEEK VARIABLE OPERAND 
      JSB SERRS+17,I  NONE FOUND
      NOP PH
      CCB 
      JSB SYMCK     COMMA?
      DEF COMMA-1 
      JMP EOST      NO, DEMAND END OF STATEMENT 
      JMP INPTS     YES 
* qq
***                          ** 
**  <PRINT STATEMENT> SYNTAX  **
***                          ** 
* 
PRINS JSB RECRF     WRITE ONTO FILE?
      JMP PRIN0-1   NO
      CCB           YES, SET
      STB FILRF       'FILE' FLAG 
      CPA .+15B     NULL WRITE? 
      JMP ACCSA,I   YES 
      CPA B73       NO, ';' ? 
      JMP PRIN0     YES 
      JSB SERRS+6,I NO
      JSB BCKSP 
PRIN0 JSB SBPUD     ADVANCE SYNTAX BUFFER POINTER 
      JSB GETCR     MORE STATEMENT? 
      JMP PRIN7     NO
      CCB           YES, ENABLE 
      STB PFLAG       FORMULA AND TAB 
      CPA .+42B     " ? 
      RSS           YES 
      JMP PRIN3     NO
PRIN1 JSB GETST     RECORD A STRING CONSTANT
      CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      CCB           NO
      STB PFLAG 
PRIN2 CPA .+42B     " ? 
      JMP PRIN1     YES 
      LDB .-2       NO
      JSB SYMCK     COMMA OR
      DEF COMMA-1     SEMICOLON?
      CLB,RSS       NO
      JMP PRIN0     YES 
      STB SBPTR,I   ZERO NEXT WORD
      JSB SBPUD 
PRIN3 ISZ PFLAG     FORMULA OR TAB PERMITTED? 
      JSB SERRS+6,I NO
      STA SBPTR,I   YES 
      CCB           'FILE'
      ISZ FILRF       MODE? 
      JMP PRIN4     NO
      STB FILRF     YES, SET FLAG AGAIN 
      LDA AEND
      JSB TBSRH     'END' ? 
      JMP PRIN5     NO
      JSB SBPUD     YES 
      JSB GETCR     FETCH NEXT
      NOP             CHARACTER 
      JMP PRIN6 
PRIN4 LDA ATAB
      JSB TBSRH     'TAB' ? 
      JMP PRIN5     NO
      CCB           YES 
      ADB SBPTR     RECORD
      STB SBPTR       'TAB' 
      LDA TABCN         WITH
      IOR 1,I             PREVIOUS
      STA 1,I               OPERATOR
      JSB GETPF     RECORD PARENTHESIZED FORMULA
      JMP PRIN6 
PRIN5 JSB BCKSP     BACKUP
      CCB             TO POINT
      ADB SBPTR         FOLLOWING 
      STB SBPTR           LAST OPERATOR 
      STB SFLAG     ENABLE STRING VARIABLE
      JSB FSC       RECORD FORMULA
PRIN6 CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      JMP PRIN2     NO
PRIN7 ISZ FILRF     'FILE' MODE?
      JMP ACCSA,I   NO
      JSB SERRS+2,I   YES 
* qq
***                        ** 
**  <MAT STATEMENT> SYNTAX  **
***                        ** 
* 
MATS  JSB LTR       FIRST TWO 
      JSB SERRS+18,I  CHARACTERS
      JSB LETCK         LETTERS?
      JMP MATS3     NO
      ISZ SBPTR     YES,
      ALF,ALF         RETRIEVE
      IOR TEMP+1        FIRST CHARACTER 
      STA SBPTR,I   LOOK
      LDA .+5         FOR 
      STA MAXCR         'INPUT',
      LDA MATIO           'READ', 
      LDB .-3               OR
      JSB TBSRH               'PRINT' 
      JSB SERRS+18,I  NONE FOUND
      CPA PRTOP     IS IT 'PRINT'?
      JMP MATS2     YES 
      CPA INPOP     NO, 'INPUT' ? 
      JMP MATS1-2   YES 
      JSB RECRF     NO, READ FROM FILE? 
      JMP MATS1-3   NO
      CPA B73       YES, ';' ?
      JMP MATS1-2   YES 
      JSB SERRS+6,I NO
      JSB BCKSP 
      CLA,INA       TURN ON 
      STA DFLAG       'MATRIX SUBSCRIPT' MODE 
MATS1 JSB ARRID     RECORD AN ARRAY 
      JSB SBSCK     RECORD SUBSCRIPT
      NOP             IF PRESENT
      CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      CCB           NO, DEMAND
      JSB SYMCK       COMMA 
      DEF COMMA-1 
      JSB SERRS+6,I NOT FOUND 
      JMP MATS1 
MATS2 JSB RECRF     WRITE ON FILE?
      JMP MAT11     NO
      CPA B73       YES, ';' ?
      CCB,RSS       YES 
      JSB SERRS+6,I NO
      STB FILRF     NOTE 'FILE' MODE
MAT10 JSB ARRID     RECORD AN ARRAY 
      CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      LDB .-2       NO, DEMAND
      JSB SYMCK       COMMA OR
      DEF COMMA-1       SEMICOLON 
      JSB SERRS+6,I NOT FOUND 
      JSB GETCR     END OF STATEMENT? 
      JMP *+3       YES 
MAT11 JSB BCKSP     NO
      JMP MAT10 
      JSB SBPUD     UPDATE POINTER
      ISZ FILRF     'FILE' MODE?
      JMP ACCSA,I   NON[
      JSB SERRS+2,I   YES 
MATS3 LDB SBPTR     SAVE ADDRESS
      STB ARYAD       OF ARRAY OPERAND
      LDA TEMP+1    RECORD
      STA SSTAK,I     AND SAVE
      LDB .+46          THE ARRAY 
      JSB STROP           IDENTIFIER
      LDA TEMP+2    RETRIEVE
      CCB             NEXT CHARACTER
      JSB SYMCK         AND TEST FOR
      DEF ASSOP-1         ASSIGNMENT OPERATOR 
      JSB SERRS+3,I NOT FOUND 
      JSB LTR       LETTER NEXT?
      JMP MATS5     NO
      JSB LETCK     YES, ANOTHER LETTER?
      JMP MATS6     NO
      ISZ SBPTR     YES,
      ALF,ALF         CONCATENATE 
      IOR TEMP+1        LETTERS 
      STA SBPTR,I         AND 
      LDA MATFN             SEARCH FOR
      LDB .-5                 AN ARRAY
      JSB TBSRH                 FUNCTION
      JSB SERRS+7,I NONE FOUND
      ALF,ALF       FOUND,
      ALF,RAR         CONVERT 
      IOR PDFFL         TO OPERAND
      CCB           COMBINE 
      ADB SBPTR       WITH
      IOR 1,I           OPERATOR
      STA 1,I             AND RECORD
      AND B777      'INV' 
      ADA D577        ORO
      SSA,RSS           'TRN' ? 
      JMP MATS4     YES 
      JSB GETCR     NO, END OF STATEMENT? 
      JMP ACCSA,I   YES 
      CLB,INB       NO, TURN ON 
      STB DFLAG       'MATRIX SUBSCRIPT' MODE 
      JSB SBSCK     DEMAND SUBSCRIPT
      JSB SERRS+5,I NONE FOUND
      JMP EOST      DEMAND END OF STATEMENT 
MATS4 SZA,RSS       ALLOW INVERSION 
      STA SSTAK,I     INTO SELF 
      JSB GETCR     DEMAND
      JSB SERRS+22,I  LEFT
      JSB LPCK          PARENTHESIS 
      JSB ARRID     DEMAND ARRAY
      JSB RPCK      DEMAND RIGHT PARENTHESIS
      LDB TEMP+1    SAME SOURCE AND 
      CPB SSTAK,I     DESTINATION ARRAYS? 
      JSB SERRS+19,I  YES 
      JMP EOST      NO, DEMAND END OF STATMENT
MATS5 JSB BCKSP     BACK UP AND 
      JSB GETPF       DEMAND PARENTHESIZED FORMULA
      CCB           SEEK
      JSB SYMCK K
      DEF TIMES-1     '*' 
      JSB SERRS+20,I  NOT FOUND 
      JSB ARRID     DEMAND ARRAY
      JMP EOST      DEMAND END OF STATEMENT 
MATS6 LDA TEMP+1    RECORD
      LDB .+46        ARRAY 
      JSB STROP         OPERAND 
      LDA TEMP+2    END OF
      CPA .+15B       STATEMENT?
      JMP ACCSA,I   YES 
      LDB .-3       NO, SEEK
      JSB SYMCK       '+', '-', 
      DEF PLUS-1        OR '*'
      JSB SERRS+21,I  NOT FOUND 
      CLB           SET '*' FLAG TO FALSE 
      CPA MULOP     '*' ? 
      JMP MATS9     YES 
MATS7 STB PFLAG     NO
      JSB ARRID     DEMAND ARRAY
      STA TEMP+2    SAVE CHARACTER
      ISZ PFLAG     '*' ? 
      JMP MATS8     NO
      LDA TEMP+1    YES, DOES ARRAY 
      CPA SSTAK,I     MATCH LEFT-HAND SIDE? 
      JSB SERRS+19,I  YES 
MATS8 LDA TEMP+2    NO, RETRIEVE CHARACTER
      JMP EOST      DEMAND END OF STATEMENT 
MATS9 CCB           SET '*' FLAG TO TRUE
      LDA TEMP+1    DOES ARRAY
      CPA SSTAK,I     MATCH LEFT-HAND SIDE? 
      JSB SERRS+19,I
      JMP MATS7     NO
