home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
SIMTEL
/
CPMUG
/
CPMUG051.ARK
/
STG2.FLB
< prev
next >
Wrap
Text File
|
1984-04-29
|
48KB
|
991 lines
BEGIN STAGE2.
FLG I = 0. SET UP MACRO CHANNEL.
VAL I = 1 + 0.
PTR I = 0 + 0.
READ NEXT I. GRAB THE FLAG LINE.
TO 98 IF FLG I NE 0. QUIT UNLESS ALL IS OK.
VAL A = CHAR. SOURCE EOL.
PTR A = 8 + 0. SET UP A VOID TEMPLATE TREE.
STO A = I. SAVE THE MACRO CHANNEL SPEC.
FLG B = 2. PHASE FLAG.
VAL B = CHAR. SOURCE PARAMETER FLAG.
VAL C = CHAR. MCT EOL.
PTR C = 9 + 0. INITIAL TEXT POINTER.
VAL D = CHAR. MCT PARAMETER FLAG.
VAL E = CHAR. ZERO CHARACTER.
PTR E = VAL E. PREPARE FOR NORMALIZATIONS.
VAL F = CHAR. SPACE CHARACTER.
PTR F = A + 7. SET UP A VOID SYMBOL TREE.
STO F = 0.
VAL G = 0 + 0. RESET THE DIGIT COUNT FOR NUMBER CONVERSION
PTR H = 5 * 7. 10*DESCRIPTOR LENGTH.
FLG J = 1. FLAG TO TERMINATE CREATED SYMBOL.
PTR J = 0 + 0.
FLG L = 1. END-OF-LINE INDICATOR.
VAL L = 0 - 1. CARRIAGE RETURN IS -1.
PTR L = 0 + 0. LOCATION COUNTER.
VAL M = CHAR. LEFT PARENTHESIS.
PTR M = 0 + 0. RESET THE SKIP COUNT.
FLG N = 0. SET EXPRESSION SIGN POSITIVE.
VAL N = CHAR. ADDITION OPERATOR.
FLG O = 0.
VAL O = CHAR. SUBTRACTION OPERATOR.
VAL P = CHAR. MULTIPLICATION OPERATOR.
VAL Q = CHAR. DIVISION OPERATOR.
VAL R = CHAR. RIGHT PARENTHESIS.
PTR R = 0 + 0. SET NO REPETITION IN PROGRESS.
PTR 4 = 7 + 7. LENGTH OF TWO DESCRIPTORS.
PTR 8 = F + 7. POINT TO THE FIRST AVAILABLE SPACE.
TO 01 BY D. START WORKING IN EARNEST.
LOC 01. ROUTINE TO READ FROM THE INPUT.
GET I = A. RECALL THE CHANNEL SPEC.
READ NEXT I. GRAB A LINE.
TO 98 IF FLG I NE 0. GET OUT UNLESS ALL IS OK.
PTR I = C + 0.
VAL Y = 0 + 0.
PTR Y = C + 0.
TO 02 IF PTR M = 0. SHOULD THIS LINE BE SKIPPED, NO.
PTR M = M - 1. YES, DROP THE SKIP COUNT
TO 01. TRY AGAIN.
LOC 02. READING LOOP.
PTR 9 = I + 0. ADVANCE THE SPACE POINTER.
VAL I = CHAR. READ THE NEXT CHARACTER.
PTR I = 9 - 7. POINT TO THE NEXT CHARACTER SPACE.
TO 97 IF PTR 8 GE I. HAVE WE OVERRUN THE AREA, YES.
STO 9 = I. PUT AWAY THE CHARACTER.
TO 04 IF VAL I = L. WAS THIS A CARRIAGE RETURN, YES.
TO 03 IF VAL I = A. HAVE WE COMPLETED THE READ, YES.
VAL Y = Y + 1. BUMP THE INPUT STRING LENGTH.
TO 02 IF VAL I NE B. NO, IS THIS A PARAMETER FLAG, NO.
PTR B = I + 0. YES, SET THE PARAMETER POINTER AND
STO 9 = B. STORE IT WITH THE PHASE FLAG.
TO 02.
LOC 03. READ THE REMAINDER OF THE LINE.
PTR 9 = I + 0. POINT TO THE FIRST FREE SPACE.
VAL I = CHAR. GRAB ANOTHER CHARACTER.
PTR I = 9 - 7. SET A POINTER TO THE NEXT CHARACTER.
STO 9 = I.
TO 97 IF PTR 8 GE I. HAVE WE RUN OUT OF SPACE, YES.
TO 03 IF VAL I NE L. WAS THIS A CARRIAGE RETURN, NO.
LOC 04. SCANNER.
PTR U = 9 - 7. SET ALL PARAMETERS UNDEFINED.
STO U = 3.
PTR U = U - 7.
STO U = 3.
PTR U = U - 7.
STO U = 3.
PTR U = U - 7.
STO U = 3.
PTR U = U - 7.
STO U = 3.
PTR U = U - 7.
STO U = 3.
PTR U = U - 7.
STO U = 3.
PTR U = U - 7.
STO U = 3.
PTR V = U - 7.
STO V = 3.
PTR U = V - 7.
PTR 9 = U + 0. FREE SPACE POINTER.
TO 97 IF PTR 8 GE 9.
GET W = A. SET UP THE TEMPLATE TREE POINTER.
GET X = Y. GRAB THE FIRST INPUT CHARACTER.
FLG Y = 0. SET THE STRING UNDEFINED.
PTR Z = A + 0. SET THE TREE POINTER TO THE TEMPLATE ROOT.
TO 58 BY B. CALL THE SCANNER.
TO 50 IF FLG B = 2. IS THIS THE DEFINITION PHASE, YES.
TO 56 IF FLG Y = 0. WAS THERE A DEFINITION, NO.
STO 9 = 1. INITIALLY NO CREATED SYMBOLS FOR THIS MACRO
PTR 9 = 9 - H. SPACE FOR THE CREATED SYMBOLS.
STO 9 = J. PREVIOUS PARAMTER POINTER.
PTR J = 9 + H. SET THE CURRENT PARAMETER POINTER.
PTR 9 = 9 - 7.
STO 9 = C. PREVIOUS TEXT POINTER.
PTR 9 = 9 - 7.
STO 9 = D. SAVE THE OLD RETURN ADDRESS.
PTR 9 = 9 - 7.
STO 9 = K. SAVE THE CURRENT TEXT POINTER.
PTR K = U + 0. SET UP THE NEW TEXT POINTER.
PTR 9 = 9 - 7.
STO 9 = R. SAVE THE OLD REPETITION POINTER.
PTR R = 0 + 0. SET NO REPETITION IN PROGRESS.
PTR C = 9 - 7. NEW TEXT POINTER.
TO 97 IF PTR 8 GE C. IS THE SPACE FULL ALREADY, YES.
TO 05 BY D. GO PROCESS THE MCT
LOC 05. SUBSTITUTE PARAMETERS IN ONE LINE.
PTR 9 = C + 0. DISCARD ANY JUNK.
PTR Y = 0 + 0. RESET THE LOOP COUNTER.
LOC 06.
TO 07 IF PTR M = 0. SHOULD WE SKIP LINES, NO.
PTR Z = K + 7. RETAIN THE CODE BODY POSITION.
GET K = K. SKIP A LINE.
GET I = K. GRAB THE TERMINATOR.
TO 08 IF VAL I = 1. CHECK FOR THE END OF THE MACRO.
PTR M = M - 1. DECREMENT THE SKIP COUNT.
GET Z = Z. GRAB THE FIRST SKIPPED ELEMENT.
TO 06 IF FLG Z NE 3. IGNORE NON FUNCTION CALLS.
PTR Y = Y + 1. BUMP THE COUNT OF LOOPS ENTERED.
TO 06 IF VAL Z = 7. LEAVE THE INCREM VALUE IF LOOP ENTERED.
PTR Y = Y - 1. ELSE DROP IT BACK.
TO 06 IF VAL Z NE 8. NO CHANGE IF NOT LOOP END.
PTR Y = Y - 1. ELSE DECREMANT THE COUNT
TO 06 IF PTR Y GE 0. AND GO ON IF SKIPPING AN ENTIRE LOOP.
TO 06 IF PTR R = 0. OR IF THERE IS NO CURRENT LOOP.
PTR U = R - 7. ELSE TERMINATE THE LOOP.
GET Y = U.
TO 49 IF FLG Y NE 1. IS IT COUNT CONTROLLED, NO.
PTR C = R + 0. YES, RESET THE LINE SPACE POINTER.
GET R = R. RESTORE ITERATION POINTER.
TO 05. IF NOT, CONTINUE.
LOC 07. CHARACTER PROCESSING LOOP.
PTR K = K + 7. ADVANCE THE POINTER AND
GET I = K. FETCH THE NEXT CHARACTER
TO 09 IF FLG I = 2. IS THIS A PARAMETER CALL, YES.
TO 22 IF FLG I = 3. NO, IS IT A COMPILER SWITCH, YES.
PTR I = 9 - 7. NO, SET THE POINTER TO THE NEXT SPACE.
STO 9 = I. PUT THE CHARACTER IN THE PSEUDO-INPUT.
PTR 9 = I + 0. ADVANCE THE SPACE POINTER.
TO 97 IF PTR 8 GE 9. IS THE SPACE EXHAUSTED, YES.
TO 07 IF FLG I = 0. WAS THAT THE LAST CHARACTER, NO.
PTR Y = C - 9. SET THE PSEUDO-INPUT LENGTH.
PTR Y = Y / 7.
PTR Y = Y - 1.
VAL Y = PTR Y.
PTR Y = C + 0.
TO 04 IF VAL I NE 1. WAS THAT THE END OF THE CODE BODY, NO.
LOC 08.
PTR 9 = J - H. RESTORE FROM THE CURRENT RECURSION.
GET J = 9. PARAMETER POINTER.
PTR 9 = 9 - 7.
GET C = 9. TEXT SPACE POINTER.
PTR 9 = 9 - 7.
GET D = 9. RETURN ADDRESS.
PTR 9 = 9 - 7.
GET K = 9. CODE BODY POINTER.
PTR 9 = 9 - 7.
GET R = 9. ITERATION POINTER.
RETURN BY D.
LOC 09. DO PARAMETER CONVERSION.
PTR V = J + I. NO, FIND THE PARAMETER POINTER.
TO 21 IF VAL I = 6. SET A PARAMETER.
GET Y = V. AND LOAD IT.
TO 45 IF VAL I = 7. INITIATE REPETITION OVER AN ARGUMENT LIST.
TO 23 IF FLG Y = 3. ERROR IF PARAMETER IS UNDEFINED.
GET X = Y. GET THE FIRST CHARACTER.
TO 11 IF VAL I = 0. COPY CONVERSION.
TO 10 IF VAL I = 1. SYMBOL REFERENCE.
TO 12 IF VAL I = 2. LOCATION SYMBOL DEFINITION.
TO 15 IF VAL I = 4. REQUEST FOR EXPRESSION CONVERSION.
PTR X = Y + 0.
TO 20 IF VAL I = 3. REQUEST THE BREAK CHARACTER.
PTR N = VAL Y.
TO 18 IF VAL I = 5. REQUEST FOR PARAMETER LENGTH.
TO 23 IF VAL Y NE 1. IF NOT ONE CHARACTER, SIGNAL ERROR.
PTR N = VAL X.
TO 18 IF VAL I = 8. REQUEST FOR INTERNAL REPRESENTATION.
MESSAGE CONV TO 4. THE CONVERSION DIGIT IS UNAVAILABLE.
TO 94 BY B. CALL ERROR TRACEBACK.
TO 07. CONTINUE WITH THE LINE.
LOC 10. DEAL WITH A LOCATION SYMBOL.
PTR V = 9 + 7. STACK POINTER FOR SCANNER.
GET W = F. SET UP THE SYMBOL TREE.
PTR Z = F + 0. SET THE TREE POINTER TO THE SYMBOL ROOT.
TO 58 BY B. CALL ON THE SCANNER.
TO 07 IF FLG Y NE 1. WAS THE SYMBOL DEFINED, NO.
FLG I = 0. PREPARE TO COPY OVER THE SYMBOL VALUE.
GET X = Y. NO, GRAB THE FIRST CHARACTER.
LOC 11. COPY A PARAMETER TO THE PSEUDO-INPUT.
TO 07 IF VAL Y = 0. IS THE PARAMETER VOID, YES.
GET I = X. FETCH THE NEXT CHARACTER.
PTR X = 9 - 7. SET THE POINTER
STO 9 = X. AND PUT IT IN THE PSEUDO-INPUT.
PTR 9 = X + 0. POINT TO THE NEXT FREE SPACE.
VAL Y = Y - 1. DECREMENT THE CHARACTER COUNT.
TO 07 IF VAL Y = 0. ARE WE DONE, YES.
GET X = I. NO, GET THE NEXT CHARACTER.
PTR I = 9 - 7. SET ITS POINTER.
STO 9 = I. PUT AWAY THE COPY.
PTR 9 = I + 0. POINT TO THE NEXT FREE SPACE.
TO 97 IF PTR 8 GE 9. HAVE WE EXHAUSTED THE SPACE, YES.
VAL Y = Y - 1. NO, DROP THE COUNT OF CHARACTERS.
TO 11.
LOC 12. MOVE A DEFINITION TO THE OUTPUT.
FLG B = 2. ALLOW SYMBOL DEFINITION.
GET W = F. SET UP THE SYMBOL TREE.
PTR Z = F + 0. SET THE TREE POINTER TO THE SYMBOL ROOT.
TO 58 BY B. CALL ON THE SCANNER.
FLG B = 0. EXIT THE DEFINITION PHASE.
GET X = Y.
TO 11 IF FLG Y = 1. IS THIS A NEW SYMBOL, NO.
PTR Y = 8 + 0. YES, SET UP THE DEFINITION POINTER.
FLG Y = 1. MARK IT AS HAVING BEEN DEFINED.
PTR L = L + 1. BUMP THE LOCATION COUNTER
PTR X = L + 0. AND INSERT IT AS THE DEFINITION.
PTR W = 9 + 7. USE STORE AT THE TOP AS TEMPORARY.
VAL Y = 0 + 0. COUNT THE DIGITS.
LOC 13. CONVERT ONE DIGIT AT A TIME.
PTR V = X / 5. GET THE QUOTIENT BY INTEGER DIVISION.
PTR Z = V * 5. THE REMAINDER MUST BE FOUND BY MULTIPLYING
PTR X = X - Z. AND THEN SUBTRACTING.
VAL X = PTR X. MOVE THE RESULT TO THE VALUE FIELD.
PTR X = V + 0. THE QUOTIENT IS TO BE OPERATED ON NEXT.
PTR W = W - 7. ADVANCE THE TEMPORARY STORAGE POINTER.
STO W = X. AND SALT AWAY THE RESULT.
VAL Y = Y + 1. BUMP THE DIGIT COUNT.
TO 97 IF PTR 8 GE W. HAVE WE RUN OUT OF ROOM, YES.
TO 13 IF PTR X NE 0. NO, MUST WE GO ON, YES.
LOC 14. MOVE THE DIGITS TO THEIR DESTINATION.
GET X = W. RECOVER A POSSIBLE DIGIT.
PTR W = W + 7. MOVE THE DIGIT POINTER BACK.
VAL X = X + E. MAKE THE DIGITS INTO CHARACTERS
PTR X = 8 + 7. SET UP A POINTER TO THE NEXT SPACE.
STO 8 = X. PUT AWAY THE CHARACTER.
PTR 8 = X + 0. BUMP THE SPACE POINTER.
TO 14 IF PTR 9 GE W. DID WE REALLY HAVE ANOTHER DIGIT, YES.
STO 8 = 0. PUT IN THE TERMINATOR.
PTR 8 = 8 + 7. ADVANCE THE SPACE POINTER.
TO 97 IF PTR 8 GE 9.
STO U = Y. PUT AWAY THE POINTER TO THE DEFINITION.
GET X = Y. PICK UP THE FIRST CHAR OF THE DEFINITION.
FLG I = 0. CLEAN OUT THE INPUT BUFFER.
TO 11. COPY OUT THE VALUE.
LOC 15. PROCESS AN EXPRESSION PARAMETER.
TO 74 BY P. EVALUATE THE EXPRESSION.
TO 18 IF PTR N GE 0. AND TEST FOR NON-NEGATIVE.
PTR O = 9 - 7. IF NEGATIVE, INSERT A MINUS SIGN.
TO 97 IF PTR 8 GE O.
STO 9 = O.
PTR 9 = O + 0.
PTR N = 0 - N. MAKE THE NUMBER POSITIVE AND
TO 18. STORE DOWN.
LOC 16. CONVERSION OF PARAMETER ZERO (LOC. CNTR.)
GET Y = V. GRAB THE NEXT CREATED SYMBOL.
TO 17 IF FLG Y = 1. IS THIS A SYMBOL, NO.
PTR V = V - 7. YES, ADVANCE THE CREATED SYMBOL POINTER.
TO 16 IF VAL Y NE I. IS THIS THE RIGHT SYMBOL, NO.
PTR N = Y + 0. YES, SET UP ITS VALUE
TO 18. AND INSERT IT IN THE LINE
LOC 17. CREATE A NEW SYMBOL.
PTR Y = V + H. CHECK THAT THERE IS ROOM FOR IT.
TO 23 IF PTR Y = J. IF NOT, TREAT AS A CONVERSION ERROR.
PTR L = L + 1. BUMP THE LOCATION COUNTER.
PTR I = L + 0. SAVE THE NEW VALUE IN THE NEXT SPACE.
STO V = I.
PTR V = V - 7. FLAG THE NEXT ENTRY AS NO SYMBOL.
GET Y = V.
FLG Y = 1.
STO V = Y.
PTR N = L + 0. SET UP THE NUMBER TO BE CONVERTED.
LOC 18. CONVERT PTR X TO CHARACTERS, STORE DOWN.
PTR Y = N / 5. GET THE QUOTIENT BY INTEGER DIVISION.
PTR Z = Y * 5. THE REMAINDER MUST BE FOUND BY MULTIPLYING
PTR X = N - Z. AND THEN SUBTRACTING.
FLG X = 0.
VAL X = PTR X. MOVE THE RESULT TO THE VALUE FIELD.
PTR N = Y + 0. THE QUOTIENT IS TO BE OPERATED ON NEXT.
VAL G = G + 1. ADVANCE THE TEMPORARY STORAGE COUNT.
PTR 8 = 8 + 7.
STO 8 = X. AND SALT AWAY THE RESULT.
TO 18 IF PTR N NE 0. NO, MUST WE GO ON, YES.
LOC 19. MOVE THE DIGITS TO THEIR DESTINATION.
GET X = 8. RECOVER A POSSIBLE DIGIT.
PTR 8 = 8 - 7. MOVE THE DIGIT POINTER BACK.
VAL G = G - 1.
VAL X = X + E. MAKE THE DIGITS INTO CHARACTERS.
PTR X = 9 - 7. SET UP A POINTER TO THE NEXT SPACE.
STO 9 = X. PUT AWAY THE CHARACTER.
PTR 9 = X + 0. DROP THE SPACE POINTER.
TO 19 IF VAL G NE 0. DID WE REALLY HAVE ANOTHER DIGIT, YES.
TO 07. NO, GO BACK TO THE LINE PROCESSOR.
LOC 20. ADVANCE TO A BREAK CHARACTER.
GET X = X. GET THE NEXT CHARACTER
VAL Y = Y - 1. AND DROP THE NUMBER REMAINING.
TO 20 IF VAL Y NE L. WAS THAT THE BREAK, NO.
TO 07 IF FLG X = 1. END-OF-LINE IS THE NULL BREAK.
PTR X = 9 - 7. SET THE POINTER
TO 97 IF PTR 8 GE X.
STO 9 = X. AND PUT AWAY THE BREAK CHARACTER.
PTR 9 = X + 0.
TO 07.
LOC 21. SET A PARAMETER.
STO 9 = L. TERMINATE THE CURRENT LINE.
PTR K = K + 7. BYPASS THE NEXT CHARACTER.
PTR Y = C - 9. SET UP THE SPECIFICATION OF THE
PTR Y = Y / 7. CURRENT STRING.
FLG Y = 0.
VAL Y = PTR Y. LENGTH IN CHARACTERS.
PTR Y = C + 0. POINTER TO THE FIRST CHARACTER.
STO V = Y. SET THE PARAMETER STORE.
PTR C = 9 - 7. NEXT EMPTY SPACE FOR NEW LINE.
TO 05.
LOC 22. DECODE COMPILER SWITCHES.
PTR V = J + 0. SET A PARAMETER POINTER.
TO 16 IF PTR I = 0. IS THIS A CALL ON PARAMETER ZERO, YES.
TO 08 IF VAL I = 9. ESCAPE FROM THE CURRENT MACRO.
PTR V = V + 7. ADVANCE THE PARAMETER POINTER.
PTR K = K + 7. BYPASS THE CHARACTER FOLLOWING THE SWITCH.
TO 32 IF VAL I = 1. OUTPUT A LINE WITHOUT RESCANNING.
TO 32 IF VAL I = 2. CHANGE I/O UNITS AND COPY.
TO 33 IF VAL I = 3. REDEFINE A SYMBOL.
TO 42 IF VAL I = 4. SKIP ARG 1 LINES UNCONDITIONALLY.
TO 36 IF VAL I = 5. COMPARE ARG 1 AND ARG 2 AS STRINGS.
TO 39 IF VAL I = 6. COMPARE ARG 1 AND ARG 2 AS EXPRESSIONS.
TO 43 IF VAL I = 7. INITIATE A REPETITION UNDER COUNT CONTROL.
TO 47 IF VAL I = 8. ADVANCE TO THE NEXT MEMBER OF THE LIST.
TO 23 IF VAL I NE 0. IF NOT A REQUEST FOR TERMINATION, COMPLAIN
STOP. ELSE TERMINATE NORMALLY.
LOC 23. ERROR IN CONVERSION DIGIT.
MESSAGE CONV TO 4. PUT OUT THE MESSAGE.
TO 94 BY B. PRODUCE A TRACEBACK
TO 07. AND THEN CONTINUE.
LOC 32. CHECK FOR ALTERNATE OUTPUT UNIT.
GET X = K. THIS MIGHT BE A CHANNEL NUMBER.
VAL W = 3 + 0. THE DEFAULT OUTPUT CHANNEL IS 3.
TO 24 IF FLG X = 1. IF NO CHANNEL NUMBER, TAKE THE DEFAULT.
PTR K = K + 7. ELSE ADVANCE THE CODE BODY POINTER.
VAL W = X - E. CONVERT THE DIGIT TO AN INTEGER.
GET X = K. CHECK FOR REWIND REQUEST.
TO 24 IF FLG X = 1. IF NONE, CONTINUE.
REWIND W. ELSE REWIND THE OUTPUT CHANNEL.
PTR K = K + 7. AND ADVANCE THE CODE BODY POINTER.
LOC 24.
TO 31 IF VAL I = 2. INITIATE BLOCK COPYING.
STO 9 = L. TERMINATE THE CURRENT LINE.
PTR X = C + 0. POINT TO THE START OF THE LINE.
TO 57 IF PTR C NE 9. PUNCH IT IF IT EXISTS.
PTR K = K + 7.
GET I = K. GET THE NEXT COLUMN.
TO 25 IF FLG I NE 1. CONTINUE IF THIS LINE IS VALID.
PTR K = K - 7. ELSE BACKSPACE THE CODE BODY
TO 23. AND ISSUE AN ERROR MESSAGE.
LOC 25.
PTR Z = VAL I.
PTR Z = Z - E. SUBTRACT THE CHARACTER ZERO.
TO 28 IF PTR Z GE 5. CHECK FOR DIGIT.
TO 28 IF PTR 0 GE Z.
VAL X = I + 0. IF SO, SAVE FOR FUTURE REFERENCE.
PTR Z = Z * 7. COMPUTE THE PARAMETER LOCATION
PTR Y = J + Z. AND GRAB ITS SPECIFICATION.
GET Y = Y.
TO 27 IF FLG Y = 3. TREAT AN UNDEFINED PARAMETER AS VOID.
GET Z = Y. PICK UP THE FIRST CHARACTER.
LOC 26.
TO 27 IF VAL Y = 0. IS THE PARAMETER VOID, YES.
CHAR = VAL Z. NO, OUTPUT A CHARACTER.
GET Z = Z. PICK UP THE NEXT CHARACTER OF THE PARAMETER
VAL Y = Y - 1. AND DROP THE NUMBER REMAINING.
PTR K = K + 7. ADVANCE THE POINTER.
GET I = K. GRAB THE NEXT CHARACTER OF THE CODE BODY
TO 26 IF VAL I = X. IS IT THE SAME DIGIT, YES.
TO 25.
LOC 27. FILL A FIELD WITH SPACES.
CHAR = VAL F.
PTR K = K + 7.
GET I = K.
TO 27 IF VAL I = X.
TO 25.
LOC 28. COPY A NON-PARAMETER TO THE OUTPUT.
TO 57 IF FLG I = 1. QUIT AT THE END OF THE LINE.
CHAR = VAL I.
PTR K = K + 7. ELSE ADVANCE ALONG THE CODE BODY.
GET I = K.
TO 25.
LOC 31. CHECK FOR ALTERNATE INPUT UNIT.
GET I = A. RECALL THE CHANNEL SPEC.
TO 29 IF PTR C = 9. IF NO ALTERNATE INPUT UNIT, CONTINUE.
GET X = C. ELSE GRAB THE UNIT NUMBER
VAL I = X - E. AND CONVERT IT TO AN INTEGER.
STO A = I. CHANGE THE CURRENT UNIT IN STORE.
TO 29 IF PTR X = 9. IF NO REWIND REQUEST, CONTINUE.
REWIND I. ELSE PERFORM THE REWIND
TO 98 IF FLG I NE 0. AND QUIT UNLESS IT WAS ALL OK.
LOC 29. BLOCK COPY FROM INPUT TO OUTPUT.
GET X = V. PICK UP THE PARAMETER SPECIFICATION.
TO 05 IF VAL X = 0. NO COPYING IF PARAMETER IS VOID.
TO 05 IF FLG X = 3. OR UNDEFINED.
PTR Y = X + 0. ELSE SET UP THE ADDRESS OF THE FIRST CHAR.
READ NEXT I. GET THE NEXT LINE.
TO 05 IF FLG I = 1. QUIT ON ENDFILE
TO 98 IF FLG I NE 0. GET OUT UNLESS ALL IS OK.
LOC 30. CHECK FOR THE TERMINATOR.
TO 05 IF VAL X = 0. RETURN IF THE MATCH IS COMPLETE.
VAL X = X - 1. ELSE DECREMENT THE CHARACTER COUNT
GET Y = Y. PICK UP THE NEXT TERMINATOR CHARACTER.
VAL Z = CHAR. AND INPUT CHARACTER.
TO 30 IF VAL Y = Z. IF WE ARE STILL MATCHING, GO ON.
WRITE NEXT W. ELSE WRITE THE LINE
TO 29 IF FLG W = 0. AND KEEP LOOKING FOR THE TERMINATOR IF OK.
TO 98. ELSE I/O ERROR MESSAGE AND QUIT
LOC 33. REDEFINE A SYMBOL.
GET Y = V. NAME OF THE SYMBOL TO BE REDEFINED.
TO 23 IF FLG Y = 3. ERROR IF PARAMETER IS UNDEFINED.
TO 05 IF VAL Y = 0. IGNORE THE NULL SYMBOL.
GET X = Y. PICK UP THE FIRST CHARACTER.
FLG B = 2. ALLOW SYMBOL ENTRY.
GET W = F. SET UP THE SYMBOL TREE.
PTR Z = F + 0. SET THE TREE POINTER TO THE SYMBOL ROOT.
TO 58 BY B. CALL ON THE SCANNER.
FLG B = 0. RESET PHASE FLAG.
FLG W = Y. SAVE THE DEFINITION FLAG.
PTR W = U + 0. POINT TO THE DEFINITION POINTER.
PTR Z = Y + 0. SET THE SYMBOL POINTER
PTR V = V + 7. GET THE NEW DEFINITION OF THE SYMBOL.
GET Y = V.
TO 23 IF FLG Y = 3. ERROR IF PARAMETER IS UNDEFINED.
PTR X = Y + 0. POINT TO THE FIRST CHARACTER OF THE
FLG Z = 1. NEW DEFINITION. CLEAR OUT THE TEMPORARY
VAL Z = Y + 0. SET THE NEW SYMBOL LENGTH.
TO 35 IF FLG W NE 1. WAS THERE A DEFINITION, NO.
STO W = Z. YES, STORE THE NEW SYMBOL LENGTH.
TO 05 IF VAL Y = 0. IS THE DEFINITION VOID, NO.
LOC 34. INSERT THE NEW DEFINITION IN THE OLD SPACE.
GET X = X. GET THE NEXT DEFINITION CHARACTER.
PTR W = Z + 0. POINT TO THE NEXT SPACE.
GET Z = W. GRAB THE OLD CONTENTS OF THE SPACE.
VAL Z = X + 0. MOVE THE CHARACTER INTO THE SPACE,
STO W = Z. RETAINING THE OLD POINTER VALUE.
VAL Y = Y - 1. DECREMENT THE CHARACTER COUNT.
TO 35 IF PTR Z = 0. IS THERE MORE SPACE AVAILABLE, NO.
TO 34 IF VAL Y NE 0. YES, IS THERE MORE DEFINITION, YES.
TO 05.
LOC 35. CREATE NEW SPACE FOR THE DEFINITION.
PTR Z = 8 + 0. POINT TO THE NEXT AVAILABLE SPACE.
STO W = Z. PUT AWAY THE CHARACTER.
PTR 8 = 8 + 7. ADVANCE THE POINTER
TO 97 IF PTR 8 GE 9. AND TEST FOR SPACE OVERFILL.
PTR W = Z + 0. ADVANCE THE CHARACTER POINTER.
GET Z = X. GRAB THE NEXT DEFINITION CHARACTER.
PTR X = Z + 0. ADVANCE THE DEFINITION POINTER.
VAL Y = Y - 1. DECREMENT THE CHARACTER COUNT.
TO 35 IF VAL Y NE L. CHECK FOR TERMINATION OF THE DEFINITION.
STO W = 0. STORE THE TERMINATOR IF THERE IS NO MORE.
TO 05.
LOC 36. COMPARE TWO STRINGS.
GET I = K. PICK UP THE CONDITION CODE.
TO 23 IF FLG I NE 0. COMPLAIN IF ILLEGAL CONDITION CODE
PTR K = K + 7. BYPASS THE NEXT CHARACTER.
GET Y = V.
PTR V = V + 7.
GET Z = V.
TO 23 IF FLG Y = 3. ERROR IF PARAMETER IS UNDEFINED.
TO 23 IF FLG Z = 3.
PTR V = V + 7. OTHERWISE PICK UP THE THIRD ARGUMENT
TO 41 IF VAL Y NE Z. COULD THEY BE EQUAL, NO.
TO 38 IF VAL Y = 0. TWO NULL STRINGS ARE EQUAL.
PTR X = Z + 0. POINT X TO THE SECOND STRING.
LOC 37. COMPARE THE STRINGS CHARACTER BY CHARACTER.
GET X = X. GRAB THE NEXT CHARACTER OF EACH STRING.
GET Y = Y.
TO 41 IF VAL X NE Y. ARE THEY EQUAL, NO.
VAL Z = Z - 1. YES, DROP THE NUMBER REMAINING.
TO 37 IF VAL Z NE 0. ARE WE DONE, NO.
LOC 38. THE STRINGS ARE EQUAL.
TO 05 IF VAL I NE E. IS THE CONDITON CODE EQ, NO.
TO 42.
LOC 39. COMPARE TWO EXPRESSIONS.
GET I = K. PICK UP THE CONDITION CODE.
TO 23 IF FLG I NE 0. COMPLAIN IF ILLEGAL CONDITION CODE
PTR K = K + 7. BYPASS THE NEXT CHARACTER.
GET Y = V. FIRST ARGUMENT SPECIFICATION.
TO 23 IF FLG Y = 3. ERROR IF PARAMETER IS UNDEFINED.
TO 74 BY P. EVALUATE THE FIRST PARAMETER.
PTR I = N + 0. SAVE THE VALUE OF THE FIRST EXPRESSION.
PTR V = J + 4.
GET Y = V. SET UP THE SECOND PARAMETER.
TO 23 IF FLG Y = 3. ERROR IF PARAMETER IS UNDEFINED.
TO 74 BY P. EVALUATE IT.
PTR V = J + 4.
PTR V = V + 7.
PTR N = N - I. COMPUTE THE DIFFERENCE.
TO 38 IF PTR N = 0. WERE THE PARAMETERS EQUAL, YES.
TO 40 IF PTR N GE 0. NO, WAS THE SECOND LARGER, YES.
TO 05 IF VAL I = O. NO, WAS THE CONDITION LT, YES.
TO 41.
LOC 40. PARAMETER 1 LT PARAMETER 2.
TO 05 IF VAL I = N. WAS THE CONDITION GT, YES.
LOC 41. THE STRINGS ARE NOT EQUAL.
TO 05 IF VAL I = E. IS THE CONDITION CODE EQ, YES.
LOC 42. SET UP THE SKIP COUNTER.
GET Y = V.
TO 23 IF FLG Y = 3. ERROR IF PARAMETER IS UNDEFINED.
TO 05 IF VAL Y = 0. IS IT VOID, YES.
TO 74 BY P. CONVERT A POSSIBLE EXPRESSION.
PTR M = N + 0. SET THE COUNT.
TO 05.
LOC 43. ITERATE UNDER COUNT CONTROL.
PTR Y = C - 9. SET UP THE SPECIFICATION OF THE
PTR Y = Y / 7. CURRENT STRING.
VAL Y = PTR Y. LENGTH IN CHARACTERS.
TO 07 IF VAL Y = 0. IF NULL, IGNORE IT.
PTR Y = C + 0. POINTER TO THE FIRST CHARACTER.
TO 74 BY P. EVALUATE THE LINE AS AN EXPRESSION.
FLG Y = 1. SET UP THE RESULT AS AN ITERATION COUNT.
VAL Y = 0 + 0.
PTR Y = N + 1.
STO C = R. SAVE THE CURRENT ITERATION POINTER.
PTR Z = R + 0. PREPARE TO RESTORE IT.
PTR R = C + 0. SET A NEW ONE.
PTR C = C - 4.
STO C = K. SAVE THE CURRENT CODE BODY POINTER.
LOC 44. RE-ENTRY FOR ANOTHER ITERATION.
PTR C = R + 0. RESET THE TEXT POINTER.
PTR R = Z + 0. RESET THE ITERATION POINTER.
PTR Y = Y - 1. DECREMENT THE ITERATION COUNT.
TO 05 IF PTR 0 GE Y. GET OUT IF NO MORE ARE NEEDED.
PTR R = C + 0. ELSE RESET THE ITERATION POINTER.
PTR C = C - 7.
STO C = Y. SAVE THE CURRENT COUNT.
PTR C = C - 7.
GET K = C. RESTORE THE CODE BODY POINTER.
PTR C = C - 7. NEW SPACE FOR THE NEXT TEXT LINE.
TO 05.
LOC 45. ITERATE UNDER CONTEXT CONTROL.
STO 9 = L. TERMINATE THE PARAMETER STRING.
PTR W = C - 9. SPECIFY THE CURRENT STRING.
PTR W = W / 7. COMPUTE ITS LENGTH IN CHARACTERS.
FLG W = 0. FLAG FOR CONTEXT-CONTROLLED ITERATION.
VAL W = PTR W. LENGTH IN CHARACTERS.
PTR W = C + 0. POINTER TO THE FIRST CHARACTER.
PTR 9 = 9 - 7.
FLG B = 2. CONSTRUCT THE TREE FOR ARGUMENT SCANNING.
PTR B = 0 + 0. SET UP THE PARAMETER.
FLG U = 0. SET UP THE RIGHT PAREN.
VAL U = R + 0.
PTR U = 7 + 0.
FLG Z = 1. END-OF-LINE.
VAL Z = 0 + 0. INITIALIZE BREAK COUNT.
PTR Z = 0 + 0.
PTR X = 9 - 7.
LOC 46. ADD BREAK CHARACTERS TO THE TREE.
VAL Z = Z + 1. BUMP THE BREAK COUNT.
STO 9 = Z. END-OF-LINE.
PTR 9 = 9 - 7.
STO 9 = U. RIGHT PAREN.
PTR 9 = 9 - 7.
STO 9 = B. PARAMETER FLAG.
PTR 9 = 9 - 7.
PTR K = K + 7.
GET I = K. GRAB THE NEXT BREAK.
PTR I = X - 9. POINT TO THE ALTERNATIVE.
STO 9 = I. CURRENT BREAK CHARACTER.
PTR X = 9 + 0. SAVE THE CURRENT POSITION FOR AN ALTERNATE.
PTR 9 = 9 - 7.
TO 97 IF PTR 8 GE 9.
TO 46 IF FLG I NE 1.
STO 9 = B. ANOTHER PARAMETER FLAG.
FLG B = 0. RESET THE PHASE FLAG.
PTR Z = 9 + 0. SET UP A POINTER TO THE ROOT LOCATION.
PTR 9 = 9 - 7.
VAL U = M + 0. SET UP A LEFT PAREN.
STO 9 = U. TREE ROOT.
PTR 9 = 9 - 7.
STO 9 = R. PREVIOUS ROOT POINTER.
PTR 9 = 9 - 7.
STO 9 = C. PREVIOUS TEXT POINTER.
PTR 9 = 9 - 7.
STO 9 = V. POINTER TO PARAMETER STORE.
PTR 9 = 9 - 7.
STO 9 = Y. ORIGINAL PARAMETER SPEC.
PTR R = 9 - 7. NEW REPETITION POINTER.
STO R = Z. NEW ROOT POINTER.
PTR 9 = R - 7.
STO 9 = W. PARAMETER REMAINDER.
PTR 9 = 9 - 4.
STO 9 = K. CURRENT TEXT POINTER.
PTR Z = Z - 7. FIRST TIME ROOT POINTER.
TO 48.
LOC 47. RE-ENTER FOR NEXT REPETITION.
TO 05 IF PTR R = 0. IF THERE IS NO REPETITION, GET OUT.
GET Z = R. ELSE POINT THE SCANNER TO THE ROOT.
LOC 48. FIRST TIME ENTRY POINT.
PTR U = R - 7. REMAINDER OF THE LIST.
GET Y = U.
TO 44 IF FLG Y = 1. IS THIS ITERATION UNDER COUNT CONTROL, YES.
TO 49 IF FLG Y = 3. TERMINATE ON AN UNDEFINED PARAMETER.
TO 49 IF VAL Y = 0. TERMINATE THE ITERATION ON A NULL REMAINDER
STO U = 0. ELSE SET UP ANOTHER SCAN.
PTR U = U - 4.
GET K = U. RESET THE CODE BODY POINTER.
PTR V = U + 0. SET UP THE STACK POINTER.
PTR 9 = U - 7.
PTR C = 9 + 0. RESET THE TEXT ORIGIN.
GET X = Y. GRAB THE FIRST CHARACTER AND
TO 99 BY B. GO CHECK FOR SINGLE-CHARACTER BREAKOUT.
PTR Y = R + 4. GET THE ADDRESS OF THE PARAMETER
GET W = Y. TO BE FIDDLED.
PTR Y = R - 4. GET THE NEW VALUE OF THE SPECIFICATION.
TO 97 IF PTR 8 GE Y.
GET Y = Y.
STO W = Y. AND PUT IT IN THE PARAMETER SPACE.
TO 05. CONTINUE WITH THE CODE BODY.
LOC 99. CHECK AND SERVICE SINGLE-CHARACTER SPLITS.
TO 60 IF VAL Z NE 1. IF BREAK CHARACTERS USED, GO TO THE SCANNER
FLG X = 0. ELSE PICK OFF A SINGLE CHARACTER.
VAL X = Y - 1. DROP THE LENGTH OF THE PARAMETER.
VAL Y = 1 + 0. SET THE NEW PARAMETER LENGTH TO 1.
PTR U = U + 7. SAVE THE NEW PARAMETER SPECIFICATION.
STO U = Y.
PTR U = U + 7. ALSO SAVE THE REMAINDER OF THE STRING.
STO U = X.
RETURN BY B. RETURN AS THOUGH FROM THE SCANNER.
LOC 49. TERMINATE THE ITERATION.
TO 44 IF FLG Y = 1. IS THIS ITERATION UNDER COUNT CONTROL, YES.
PTR R = R + 7.
GET Y = R. RESTORE THE ORIGINAL VALUE OF THE
PTR R = R + 7. PARAMETER SPECIFICATION.
GET W = R.
STO W = Y.
PTR R = R + 7.
GET C = R. RESTORE THE TEXT POINTER.
PTR R = R + 7.
GET R = R.
TO 05.
LOC 50. DEFINE A MACRO.
FLG Y = 1. MARK IT AS DEFINED.
VAL Y = L + 0. LINE TERMINATOR.
PTR 8 = 8 - 7. PREPARE FOR A SPURIOUS ADVANCE.
TO 54. GO GET THE MCT.
LOC 51. DEAL WITH AN ESCAPE CHARACTER.
VAL I = CHAR. PICK UP THE NEXT CHARACTER.
STO 8 = I. ASSUME THAT IT IS A SPECIAL TO BE SAVED.
TO 52 IF VAL I = C. IF IT REALLY IS AN MCT PARAMETER OR END-
TO 52 IF VAL I = D. OF-LINE FLAG, THEN GO ON TO THE NEXT CHAR.
VAL I = I - E. ELSE CONVERT A POSSIBLE DIGIT CHARACTER.
FLG Z = 3. ASSUME THAT IT IS A FUNCTION CALL.
VAL Z = CHAR. GET THE PARAMETER CONVERSION OR FUNCTION.
VAL Z = Z - E. CONVERT FROM A CHARACTER TO AN INTEGER.
PTR Z = VAL I. PUT AWAY THE SPEC.
STO 8 = Z.
TO 52 IF PTR 0 GE Z. IF IT IS REALLY A FUNCTION, GO ON.
TO 52 IF PTR Z GE 5.
FLG Z = 2. OTHERWISE MAKE IT A PARAMETER CONVERSION.
PTR Z = Z * 7. SET UP THE RELATIVE ADDR OF THE PARAMETER.
STO 8 = Z.
LOC 52. PROCESS AN MCT LINE.
PTR 8 = 8 + 7. ADVANCE THE SPACE POINTER.
TO 97 IF PTR 8 GE 9. HAVE WE RUN OUT OF ROOM, YES.
VAL I = CHAR. READ THE NEXT CHARACTER.
STO 8 = I. STORE IT.
TO 51 IF VAL I = D. IS THIS AN ESCAPE CHARACTER, YES.
TO 53 IF VAL I = L. RECOGNIZE A CARRIAGE CONTROL.
TO 52 IF VAL I NE C. NO, WAS IT AN MCT END-OF-LINE, NO.
LOC 53.
PTR Y = 8 + 0. POINT TO THE CURRENT LINE TERMINATOR.
STO U = Y. SET UP THE PREVIOUS TERMINATOR.
PTR U = 8 + 0. UPDATE THE TERMINATOR ADDRESS.
LOC 54. READ AND STORE A NEW MCT LINE.
GET I = A. RECALL THE CHANNEL SPECIFIER.
READ NEXT I. GRAB THE NEXT LINE.
TO 98 IF FLG I NE 0. GET OUT UNLESS ALL IS OK.
VAL I = CHAR. READ THE FIRST CHARACTER OF A LINE.
PTR I = 0 + 0. CLEAN OUT THE INPUT REGISTER.
PTR 8 = 8 + 7. ADVANCE THE SPACE POINTER.
STO 8 = I. PUT IT AWAY.
TO 51 IF VAL I = D. WAS IT A PARAMETER FLAG, YES.
TO 52 IF VAL I NE C. WAS IT AN END-OF-LINE, NO.
PTR Y = 8 + 0. FILL IN THE PREVIOUS TERMINATOR.
STO U = Y.
STO 8 = 1.
PTR 8 = 8 + 7. ADVANCE THE SPACE POINTER.
TO 97 IF PTR 8 GE 9. HAVE WE OVERRUN THE AREA, YES.
VAL I = CHAR. GET THE NEXT CHARACTER.
TO 55 IF VAL I NE C. DID THAT CLOSE THE DEFINITION PHASE, NO.
FLG B = 0. YES, RESET THE PHASE FLAG.
TRAP. END OF MACROS
LOC 55. COMMON SYSTEM RETURN POINT.
RETURN BY D. REGISTER D IS THE RETURN ADDRESS.
LOC 56. PUNCH AN UNRECOGNIZED LINE.
VAL W = 3 + 0. CHANNEL 3 USED WHEN A LINE IS NOT MATCHED.
PTR X = C + 0. ADDRESS THE FIRST CHARACTER.
LOC 57. LOOP TO PUT OUT THE CHARACTERS.
GET X = X. GET THE NEXT ONE.
CHAR = VAL X. MOVE IT INTO THE LINE BUFFER.
TO 57 IF FLG X NE 1. HAVE WE REACHED THE END, NO.
WRITE NEXT W. YES, PUT IT OUT ON THE DESIGNATED CHANNEL.
TO 98 IF FLG W NE 0. TREAT ANY ERROR AS FATAL.
TO 55 IF VAL X = L. ELSE IF THE LINE IS COMPLETE, RETURN.
CHAR = VAL X. ELSE REPRINT THE LAST CHARACTER
TO 57. AND CONTINUE.
LOC 58. TRY FOR AN ALTERNATIVE MATCH.
PTR Z = W + Z. GET THE POINTER TO THE ALTERNATIVE.
TO 60 IF PTR W NE 0. WAS THERE ONE AFTER ALL, YES.
TO 71 IF FLG B = 2. NO, ARE WE DEFINING, YES.
LOC 59. TRY EXTENDING THE PREVIOUS PARAMETER.
TO 70 IF PTR V GE 9. IS THERE ONE TO EXTEND, NO.
GET Z = V. RECALL THE MACRO POINTER.
GET Y = Q. YES, RECALL THE INPUT POINTER
GET X = Y. AND THE CURRENT CHARACTER
TO 63 IF FLG Z = 2. IS THIS THE FIRST TIME FOR A PARAMETER, YES
TO 64 IF FLG Z = 3. NO, IS IT A PARAMETER EXTENSION, YES.
PTR V = Q + 7. ABANDON THE STACK ENTRY.
PTR Q = V + 7.
LOC 60. TRY AN ALTERNATIVE.
GET W = Z. GRAB THE MACRO CHARACTER.
TO 69 IF FLG W = 1. IS THIS THE END OF THE MACRO, YES.
TO 62 IF FLG W = 2. NO, IS IT A PARAMETER, YES.
TO 58 IF VAL Y = 0. NO, IS THIS THE END OF THE INPUT LINE, YES.
TO 58 IF VAL X NE W. NO, DOES THE CHARACTER MATCH, NO.
TO 61 IF PTR W = 0. IS THERE AN ALTERNATIVE, NO.
TO 61 IF FLG X = 3. DO NOT STACK ALTERNATIVES FOLLOWING A PARAM
TO 61 IF FLG B = 2. DO NOT STACK ALTERNATIVES DURING DEFINITION
PTR Q = V - 7.
PTR V = Q - 7.
TO 97 IF PTR 8 GE V.
STO Q = Y. SAVE THE INPUT POINTER
PTR W = W + Z. GET THE ADDRESS OF THE ALTERNATIVE.
STO V = W.
LOC 61.
VAL Y = Y - 1.
PTR Y = X + 0.
GET X = X. ADVANCE THE INPUT POINTER
PTR Z = Z + 7. ADVANCE THE MACRO POINTER.
TO 60. CONTINUE MATCHING.
LOC 62. SET UP A PARAMETER IF POSSIBLE.
TO 61 IF FLG X = 2. IS THIS A PARAMETER DEFINITION, YES.
TO 58 IF FLG B = 2. NO, COULD WE NEED A PARAMETER, NO.
PTR Q = V - 7. CREATE AN ENTRY FOR THE PARAMETER.
PTR V = Q - 7.
TO 97 IF PTR 8 GE V.
STO Q = Y.
FLG Z = 2. SET UP THE PARAMETER POINTER.
STO V = Z.
FLG X = 3. DONT STACK FURTHER ALTERNATIVES.
TO 58.
LOC 63. FIRST TIME ENTRY FOR PARAMETERS.
FLG Z = 3. SET FOR PARAMETER EXTENSION.
PTR Z = Z + 7.
STO V = Z.
PTR U = U + 7. ADVANCE THE PARAM STORE POINTER.
FLG W = 0.
VAL W = 0 + 0. SET THE PARAMETER LENGTH TO ZERO.
PTR W = Y + 0. POINT IT TO THE CURRENT INPUT CHARACTER.
STO U = W.
TO 60.
LOC 64. EXTEND THE CURRENT PARAMETER.
TO 68 IF VAL Y = 0. CAN IT BE EXTENDED, NO.
TO 68 IF VAL X = R. FAIL ON AN UNMATCHED CLOSING PAREN.
GET W = U. INCREASE THE PARAMETER LENGTH.
VAL W = W + 1.
VAL Y = Y - 1.
PTR Y = X + 0.
TO 67 IF VAL X NE M. IS THIS AN OPEN PAREN, NO.
VAL Z = 0 + 0. YES, ZERO THE PAREN COUNT.
LOC 65. OBTAIN A BALANCED STRING.
VAL Z = Z + 1. BUMP THE PARENTHESIS COUNT.
LOC 66.
TO 68 IF VAL Y = 0. FAIL IF THIS IS THE END.
GET X = X. GRAB THE NEXT INPUT CHARACTER.
VAL Y = Y - 1.
PTR Y = X + 0.
VAL W = W + 1. ELSE BUMP THE PARAMETER LENGTH.
TO 65 IF VAL X = M. IS IT ANOTHER OPEN PAREN, YES.
TO 66 IF VAL X NE R. NO, IS IT A CLOSE PAREN, NO.
VAL Z = Z - 1. YES, DROP THE PAREN COUNT.
TO 66 IF VAL Z NE 0. CONTINUE IF THE COUNT IS NONZERO.
LOC 67. CONTINUE THE SCAN.
GET X = X. GET THE NEXT INPUT CHARACTER.
STO Q = Y. INCREMENT THE INPUT POINTER.
STO U = W.
TO 60.
LOC 68. ABANDON THE CURRENT PARAMETER.
STO U = 3. SET THE PARAMETER UNDEFINED.
PTR U = U - 7. DROP THE PARAMETER STORE POINTER BACK.
PTR V = Q + 7. ABANDON THE STACK ENTRY.
PTR Q = V + 7.
TO 59. SEE IF THERE ARE OTHERS TO FALL BACK ON.
LOC 69.
TO 58 IF VAL Y NE 0. IS THIS A FINAL MATCH, NO.
PTR U = Z + 7. YES, POINT TO THE DEFINITION SPEC.
GET Y = U.
LOC 70.
RETURN BY B. COMMON RETURN POINT FOR PTR B RETURNS.
LOC 71. ROUTINE TO ADD MACRO DEFINITIONS.
PTR W = 8 - Z. CREATE THE ALTERNATE POINTER.
STO Z = W. CHANGE THE CURRENT ALTERNATE.
TO 73 IF VAL Y = 0. TERMINATE THE BRANCH IF THIS IS THE END.
LOC 72. READ THE REMAINDER OF THE TEMPLATE LINE.
VAL Y = Y - 1.
PTR Y = X + 0.
PTR X = 0 + 0. RESET THE POINTER OF THE CURRENT CHARACTER.
STO 8 = X. PUT IT AWAY.
PTR 8 = 8 + 7. ADVANCE THE SPACE POINTER.
TO 97 IF PTR 8 GE 9. HAVE WE OVERRUN THE AREA, YES.
GET X = Y. GRAB THE NEXT CHARACTER.
TO 72 IF VAL Y NE 0. WAS THAT THE LAST, NO.
LOC 73. TERMINATE A TREE BRANCH.
FLG X = 1. SET THE MACRO TERMINATOR.
PTR X = 0 + 0. SET FOR NO ALTERNATIVE.
STO 8 = X.
PTR U = 8 + 7. SET UP A DEFINITION POINTER.
FLG Y = 0.
PTR Y = U + 0.
STO U = Y.
PTR 8 = U + 7. POINT TO THE FIRST EMPTY SPACE.
TO 97 IF PTR 8 GE 9.
RETURN BY B.
LOC 74. EXPRESSION PROCESSOR.
PTR O = 9 + 0. SAVE THE CURRENT TOP OF FREE SPACE.
VAL S = Y + 0. SET UP THE STRING SPECIFIER.
PTR S = Y + 0.
PTR T = 0 + 0. INITIAL VALUE OF THE EXPRESSION IS ZERO.
TO 75 IF VAL Y NE 0. IS THE EXPRESSION VOID, NO.
PTR N = 0 + 0. YES, ITS VALUE IS ZERO.
RETURN BY P.
LOC 75.
VAL T = M + 0. STACK A LEFT PAREN.
LOC 76.
TO 93 IF VAL S = 0.
GET X = S. ELSE GRAB THE NEXT.
PTR Y = S + 0. POINT TO A POSSIBLE SECTION START.
VAL Y = 0 + 0. THE STRING IS INITIALLY EMPTY.
TO 77 IF VAL X NE M. IS THE CHARACTER A LEFT PAREN, NO.
STO 9 = T. YES, PUSH THE STACK.
PTR 9 = 9 - 7.
TO 97 IF PTR 8 GE 9.
VAL S = S - 1. DROP THE STRING LENGTH REMAINING.
PTR S = X + 0. BUMP THE POINTER.
TO 75.
LOC 77. SPECIFIY A SECTION.
TO 78 IF VAL X = N. IS THIS A PLUS, YES.
TO 78 IF VAL X = O. MINUS.
TO 78 IF VAL X = P. TIMES.
TO 78 IF VAL X = Q. DIVIDE.
TO 78 IF VAL X = R. RIGHT PAREN.
VAL Y = Y + 1. NOT AN OPERATOR. BUMP SECTION LENGTH.
GET X = X. GRAB THE NEXT CHARACTER.
TO 77 IF VAL S NE Y. IS THE STRING EXHAUSTED, NO.
VAL X = R + 0. YES, SET UP A RIGHT PAREN.
VAL S = S + 1. PRETEND THAT IT WAS IN THE INPUT STRING.
LOC 78.
VAL J = X + 0. SET UP THE SECTION OPERATOR.
PTR N = 0 + 0. ZERO THE ACCUMULATOR.
VAL S = S - Y. UPDATE THE STRING POINTER.
VAL S = S - 1.
PTR S = X + 0.
TO 83 IF VAL Y = 0. A NULL STRING HAS THE VALUE ZERO.
GET X = Y. GRAB FIRST CHARACTER OF NON-NULL STRING.
PTR U = VAL X. CHECK FOR A DIGIT.
PTR U = U - E.
TO 79 IF PTR U GE 5.
TO 81 IF PTR U GE 0.
LOC 79. IF FIRST CHARACTER IS NOT A DIGIT, LOOK UP.
PTR V = 9 + 7. STACK POINTER FOR SCANNER.
GET W = F. SET UP THE SYMBOL TREE.
FLG Y = 0. SET THE RESULTING SYMBOL UNDEFINED.
PTR Z = F + 0. SET THE TREE POINTER TO THE SYMBOL ROOT.
TO 58 BY B. LOOK UP THE SYMBOL VALUE.
TO 83 IF FLG Y NE 1. AN UNDEFINED SYMBOL HAS THE VALUE ZERO.
TO 83 IF VAL Y = 0. A NULL STRING HAS THE VALUE ZERO.
GET X = Y. GRAB FIRST CHARACTER OF NON-NULL STRING.
FLG N = 1. ASSUME IT IS A MINUS SIGN
TO 82 IF VAL X = O. AND IF IT IS GO ON TO THE NEXT DIGIT.
FLG N = 0. ELSE RESET THE SIGN TO PLUS.
PTR X = Y + 0. PREPARE FOR A SPURIOUS FETCH.
LOC 80. CHECK THE NEXT CHARACTER FOR DIGIT.
GET X = X. NO, GRAB THE NEXT CHARACTER.
PTR U = VAL X. CHECK FOR A DIGIT.
PTR U = U - E.
TO 81 IF PTR U = 0.
TO 93 IF PTR U GE 5.
TO 93 IF PTR 0 GE U.
LOC 81. INCORPORATE A DIGIT INTO THE SECTION VALUE.
PTR N = N * 5. MULTIPLY ACCUMULATOR BY 10.
PTR N = N + U. ADD CURRENT DIGIT.
LOC 82.
VAL Y = Y - 1. DROP THE REMAINING LENGTH.
TO 80 IF VAL Y NE 0. ARE WE DONE, NO.
TO 83 IF FLG N = 0. IS THE ACCUMULATOR NEGATIVE, NO.
FLG N = 0. YES, RESET THE SIGN BIT.
PTR N = 0 - N. NEGATE THE CONTENTS.
LOC 83. EVALUATE THE CURRENT SECTION.
TO 92 IF VAL J = R. IS THE SECTION OPERATOR A RIGHT PAREN, YES.
TO 90 IF VAL T = M. NO, IS THE STACK OPERATOR A LEFT PAREN, YES
TO 89 IF VAL J = P. NO, IS THE SECTION OPERATOR A TIMES, YES.
TO 89 IF VAL J = Q. NO, IS IT A DIVIDE, YES.
LOC 84. PERFORM A PENDING OPERATION.
TO 87 IF VAL T = Q. IS THE OPERATOR A DIVIDE, YES.
TO 86 IF VAL T = P. NO, IS IT A TIMES, YES.
TO 85 IF VAL T = O. NO, IS IT A MINUS, YES.
PTR T = T + N. PLUS.
TO 88.
LOC 85.
PTR T = T - N.
TO 88.
LOC 86.
PTR T = T * N.
TO 88.
LOC 87.
PTR T = T / N.
LOC 88.
VAL T = J + 0. RESET THE STACK OPERATOR.
TO 76 IF VAL J NE R. WAS THE SECTION OPERATOR A RIGHT PAREN, NO.
PTR N = T + 0. YES, KEEP EVALUATING.
PTR 9 = 9 + 7. POP THE STACK.
GET T = 9.
TO 92.
LOC 89. CHECK PRECEDENCE OF STACK OPERATORS.
TO 86 IF VAL T = P. EVALUATE IF THE STACK OPERATOR IS TIMES
TO 87 IF VAL T = Q. OR DIVIDE.
LOC 90. STACK A SECTION.
STO 9 = T. PUSH THE STACK.
PTR 9 = 9 - 7.
TO 97 IF PTR 8 GE 9.
VAL T = J + 0. SET THE OPERATOR
PTR T = N + 0. AND OPERAND ONTO THE STACK.
TO 76.
LOC 91. STACK IS EMPTY.
TO 93 IF VAL S NE 0. IS THE EXPRESSION EMPTY, NO.
RETURN BY P. YES, CORRECT RETURN.
LOC 92.
TO 84 IF VAL T NE M. IS THE STACK OPERATOR A LEFT PAREN, NO.
TO 91 IF PTR 9 = O. YES, IS THE STACK EMPTY, YES.
PTR 9 = 9 + 7. NO, POP IT UP.
GET T = 9.
TO 92 IF VAL S = 0. IS THERE MORE IN THE EXPRESSION, NO.
GET X = S. YES, GRAB THE NEXT CHARACTER.
VAL S = S - 1.
PTR S = X + 0.
VAL J = X + 0.
TO 92 IF VAL J = R. IS THE SECTION OPERATOR A RIGHT PAREN, YES.
TO 83 IF VAL J = N. NO, IS IT A PLUS, YES.
TO 83 IF VAL J = O. NO, MINUS, YES.
TO 83 IF VAL J = P. NO, TIMES, YES.
TO 83 IF VAL J = Q. NO, DIVIDE, YES.
LOC 93. ERROR IN ARITHMETIC EXPRESSION.
MESSAGE EXPR TO 4. ISSUE AN ERROR MESSAGE.
PTR N = 0 + 0. ZERO OUT A POSSIBLE SKIP COUNT.
PTR 9 = O + 0. RESET THE FREE SPACE POINTER.
TO 94 BY B. CALL ERROR TRACEBACK.
RETURN BY P. CONTINUE WITH THE LINE.
LOC 94. PROVIDE TRACEBACK FROM ERROR.
PTR X = C + 0. FIRST CHARACTER OF THE STRING BEING BUILT.
PTR Y = J + 0. CURRENT PARAMETER POINTER.
TO 96 IF PTR 9 GE C. IS THERE A LINE BEING CONSTRUCTED, NO.
STO 9 = L. YES, TERMINATE IT.
LOC 95. PRINTING LOOP.
GET X = X. GRAB THE NEXT CHARACTER.
CHAR = VAL X. MOVE IT TO THE LINE BUFFER.
TO 95 IF FLG X = 0. ARE WE DONE WITH THIS LINE, NO.
WRITE NEXT 4. YES, WRITE IT OUT.
TO 98 IF FLG 4 NE 0. TREAT AN ERROR AS FATAL.
TO 96 IF VAL X = L. IF THE LINE ENDED, FINE.
CHAR = VAL X. OTHERWISE RE-ISSUE THE LAST CHARACTER
TO 95. AND KEEP OUTPUTTING.
LOC 96.
TO 70 IF PTR Y = 0. ARE THERE MORE, NO.
PTR Y = Y - H. YES, MOVE BACK UP THE CHAIN.
PTR X = Y - 7.
GET Y = Y. PREVIOUS PARAMETER POINTER.
GET X = X. CURRENT TEXT POINTER.
TO 95.
LOC 97. THE WORKING AREA HAS BEEN OVERFILLED.
MESSAGE FULL TO 4. ISSUE AN ERROR MESSAGE.
TO 94 BY B. CALL ERROR TRACEBACK.
STOP.
LOC 98. AN I/O ERROR HAS OCCURRED
MESSAGE IOCH TO 4. ISSUE THE CHANNEL ERROR MESSAGE
TO 94 BY B. AND PROVIDE A TRACEBACK.
STOP.
END PROGRAM.