*DECK NDLSTD IDENT NDLSTD ENTRY STD$STA ENTRY STD$RET ENTRY STDYES ENTRY STDNO ENTRY TFLAG EXT NEXLXID,SYNSECT,LEXSNC,LINELMT,NWORD EXT SYNTBL,LBLPNTR,TRACE,NDLDIAG,PRINTRC,LEXSCAN,NEXTYPE EXT NEXLENW,NEXLENG EXT SWITCHV STKLIMT EQU 64 SPACE ALLOCATED FOR PROCESSOR REQUEST STACK SNW EQU 13 CODE FOR LEXSCAN SCAN-NEXT-WORD REQUEST. ************************************************************************ * * S T D $ S T A R T * * * * * ENTRY CONDITIONS: * * A CALL PARAMETER IS LOCATION OF BASE OF SWITCH VECTOR TO BE USED * * IN EXECUTING SUBROUTINE CALL INSTRUCTIONS FOR SEMANTIC PROCESSING.* * PRIOR TO CALL TO STD$START, LEXSCAN MUST HAVE BEEN CALLED TO SCAN * * THE 1ST SOURCE WORD AND IDENTIFY IT. * * * * EXTERNAL REFERENCES: * * SYNTBLE, TRACEM, AND LBLPTRS TABLES BUILT BY SYNGEN AND SEPARATELY* * COMPILED ARE EXTERNALLY DEFINED ARRAYS. * * SYNSECT IS AN EXTERNALLY DEFINED ITEM FROM WHICH STD OBTAINS INDEX* * VALUES FOR +SUBS INSTRUCTIONS. * * NEXTYPE IS AN EXTERNALLY DEFINED ITEM CONTAINING CODES FOR THE * * SYNTACTIC TYPE OF THE NEXT SOURCE WORD. * * DIAG IS THE DIAGNOSTIC MODULE OF ADL WHICH IS CALLED WHENEVER * * A DIAGNOSTIC INSTRUCTION IS EXECUTED. * * LEXSCAN IS AN ENTRY CALLED TO REQUEST THE IDENTIFICATION OF THE * * NEXT SOURCE WORD. * * LEXSNC IS THE ENTRY POINT CALLED TO REQUEST LEXSCAN TO SKIP TO * * THE NEXT SOURCE RECORD AND CONTINUE PROCESSING. * * * * EXIT CONDITIONS: * * STD EXISTS LOGICALLY AS A CO-ROUTINE, SO THERE IS NO LOGICAL EXIT.* * WHEN THE END OF THE SOURCE STREAM IS ENCOUNTERED, HOWEVER, A * * SEMANTIC PROCESSOR MAY CALL STD$RETURN, RESULTING IN A RETURN TO * * WHOMEVER CALLED STD$START. * * * * ERROR CONDITIONS: * * IF A 03777 INSTRUCTION IS ENCOUNTERED, IT SIGNIFIES A REFERENCE * * TO AN UNDEFINED SYMBOL IN THE SYNGEN INPUT SOURCE. STD WILL CAUSE * * A MODE 1 ERROR IF SUCH AN INSTRUCTION IS EXECUTED. * * A 13777 INSTRUCTION IS A REFERENCE TO AN UNDEFINED SEMANTIC SUB- * * ROUTINE IN THE SOURCE INPUT TO SYNGEN AND CAUSES STD TO GENERATE A* * MODE 1 ERROR. * * IF THE STD PROCESSOR REQUEST STACK UNDERFLOWS, A COMPILER ERROR * * MESSAGE IS ISSUED AND THE JOB ABORTED. * * IF THE STD PROCESSOR REQUEST STACK OVERFLOWS, A COMPILER ERROR * * MESSAGE IS ISSUED AND THE JOB ABORTED. * ************************************************************************ STD$RET DATA 0 ENTRY FOR RETURN FROM SEMANTIC ROUTINES. STD$STA DATA 0 ENTRY FOR STARTING SYNTAX ANALYSIS. SA1 DIAGSTD MX2 24 LX2 54 BX6 -X2*X1 SA6 DIAGSTD SA1 NDLDIAG BIND THE LOCATION OF THE LX1 30 SA2 DIAGSTD APPROPRIATE DIAGNOSTIC RTN BX6 X1+X2 SA6 DIAGSTD SA4 SUBCALL+1 FETCH CODE SKELETON FOR SWITCH CALL. SA1 SWITCHV MX6 42 LOCATION OF BASE OF SWITCH VECTOR BX4 X6*X4 BX6 X1+X4 ADD ADDRESS OF SWITCH TO CODE. MX7 0 SA6 A4 STORE WORD OF CODE CONTAINING SWITCH ADDR. SA7 INSTWD INITIALIZE NEXT-INSTRUCTION-WORD-POINTER. SX6 1 SA7 TRANWD INITIALIZE NEXT-TRANSFER-WORD-POINTER. SA6 TRANPAR INITIALIZE NEXT-TRANSFER-PARCEL-POINTER. SA1 LBLPNTR FETCH POINTER TO FIRST SYNTBL SECTION IX1 X1+X6 SA1 X1 SX6 -1 SA7 INSTPAR INITIALIZE NEXT-INSTRUCTION-PARCEL-POINTER. SA6 STKPTR INITIALIZE PTR TO STD"S CALL STACK. BX6 X1 SA7 STKPTR INITIALIZE PROCESSOR REQUEST STACK LEVEL. SA6 SECTAD SAVE POINTER TO 1ST SYNTBLE SECTION. EQ GETINST FETCH FIRST SYNTBLE INSTRUCTION. STDNO DATA 0 GETINST SA1 INSTWD FETCH NEXT-INSTRUCTION-WORD-POINTER. SA2 INSTPAR FETCH NEXT-INSTRUCTION-PARCEL-POINTER. SA4 TFLAG CHECK TRACE REQUEST FLAG. ZR X4,NOTOUT IF ZERO, PUT OUT NO TRACE. SX5 X4-1 ZR X5,TROUT IF TFLAG = 1 THEN TRACE IS PUT OUT. SX7 B0 IF TFLAG > 1 THEN TFLAG IS RESET AND NO SA7 A4 TRACE IS PUT OUT. SA1 INSTWD EQ NOTOUT TROUT LX1 2 USE THE WORD AND PARCEL RELATIVE VALUES TO IX5 X1+X2 OBTAIN AN INDEX INTO TRACEM TABLE. SA1 LINECNT SA4 LINELMT IX7 X4-X1 NZ X7,TLINE TEST FOR TRACE LIMIT EXCEEDED. SA7 LINECNT SX7 -1 SA7 TFLAG SA1 INSTWD EQ NOTOUT TLINE SX7 X1+1 SA7 LINECNT SB3 1 SA4 TRACE FETCH APPROPRIATE TRACE MESSAGE IX4 X4+X5 SA4 X4 BX6 X4 SA6 TMSG+1 STORE TRACE MESSAGE IN SKELETON WSA. SA3 NEXLENW SA2 NEXLENG SX5 X3-5 SA4 NWORD STORE CONTENTS OF NEXWORD IN TRACE MESSAGE. NG X5,LT4WORDS MAX OF 4 WORDS LISTED ON TRACE. SX3 4 LT4WORDS SB2 X3-1 SX7 X2+40 SB4 TMSG+3 SA7 TLG LE B2,ALLNEXT SB7 1 LOOPNEX BX6 X4 SA4 A4+B3 SA6 B4+B7 SB2 B2-B3 SB4 B4+B7 NE B2,LOOPNEX ALLNEXT BX6 X4 SA6 B4+B3 SA3 NEXLXID FETCH NEXLXID. MX7 30 RJ BINCON CONVERT TO DISPLAY CODE. SA4 =5LLXID= BX6 X4+X6 SA6 TMSG+3 SA3 NEXTYPE FETCH NEXTYPE. RJ BINCON CONVERT TO DISPLAY CODE. SA4 =5LTYPE= BX6 X4+X6 SA6 TMSG+2 SA1 AWRITE RJ PRINTRC SA1 INSTWD SA2 INSTPAR NOTOUT SA3 SYNTBL IX3 X3+X1 SA3 X3 BX6 X2 MX0 15 MASK FOR INSTRUCTION. LX6 4 16 * PARCEL. SB1 X6 SB7 X2+1 INCREMENT NEXT-INSTRUCTION-PARCEL-POINTER. SB2 X2 SB2 B1-B2 15 * PARCEL SX2 B7-4 LX6 X3,B2 LEFT-JUSTIFY PROPER PARCEL OF SYNTBLE WORD. BX5 X0*X6 ISOLATE INSTRUCTION. NZ X2,SETPAR IF NEXT PARCEL IS IN THE NEXT SYNTBLE WORD SB7 B0 THEN NEXT-INSTRUCTION-PARCEL-POINTER MUST SX6 X1+1 BE SET TO 1ST PARCEL OF NEXT SYNTBLE WORD SA6 A1 AND NEXT-INSTRUCTION-WORD-POINTER INCRMENTD SETPAR SX7 B7 MX1 56 MASK FOR SEPARATING OPERATOR AND OPERAND. SA7 A2 STORE NEXT-INSTRUCTION-PARCEL-POINTER. LX1 56 BX6 X1*X5 PICK OFF OPERAND. BX2 -X1*X5 PICK OFF OPERATOR. AX6 45 LX2 4 SA6 OPERAND SAVE OPERAND. SB1 X2 SAVE OPERATOR IN B1 FOR USE IN A SWITCH JP B1+OPRATOR SWITCH TO PROPER OPERATOR ROUTINE. OPRATOR EQ DRIVEREQ OPERATOR = 0. EQ DIAGNOS OPERATOR = 1. EQ SUBCALL OPERATOR = 2. EQ KEY$ OPERATOR = 3. EQ KEY OPERATOR = 4. EQ LBLCALL OPERATOR = 5. EQ ERROP OPERATOR = 6. EQ ERROP OPERATOR = 7. EQ SUBLBL OPERATOR = 8. EQ SUBLBL OPERATOR = 9. EQ SUBLBL OPERATOR = 10. EQ SUBLBL OPERATOR = 11. EQ TRANSF OPERATOR = 12. EQ TRANSF OPERATOR = 13. EQ TRANSF OPERATOR = 14. TRANSF MX0 58 LAST 2 BITS OF OPERATOR TELL WHICH PARCEL. SA5 SECTAD GET ADDRESS OF CURRENT SYNTBLE SECTION. BX7 -X0*X2 SA7 TRANPAR SET NEXT-TRANSFER-PARCEL-POINTER. IX6 X6+X5 OPERAND VALUE IS NEXT-TRANSFER-WORD- SA6 TRANWD POINTER VALUE RELATIVE TO BASE OF SECTION. EQ GETINST FETCH NEXT INSTRUCTION. SUBLBL MX0 58 LAST 2 BITS OF OPERATOR TELL WHICH PARCEL. SA5 SECTAD GET BASE ADDRESS OF CURRENT LABELLED SECT. BX7 -X0*X2 SA7 A2 SET NEXT-INSTRUCTION-PARCEL-POINTER. IX6 X5+X6 SA6 A1 SET NEXT-INSTRUCTION-WORD-POINTER. EQ GETINST FETCH NEXT INSTRUCTION. LBLCALL SA2 STKPTR FETCH DEPTH OF PROCESSOR REQUEST STACK. SX3 X2-STKLIMT CHECK DEPTH OF STACK AGAINST ALLOCATED SIZE NZ X3,STKOK IF STACK OVERFLOW OCCURS, PRINT DAYFILE MESSAGE OVRFLOW MESSAGE AND ABORT JOB. ABORT STKOK SX4 X2+1 PUCH DOWN STACK BY INCREMENTING DEPTH-PTR. SA5 SECTAD FETCH POINTER TO BASE OF CURRENT SYNTBLE SECTION. SA1 A1 FETCH NEXT-INSTRUCTION-WORD-POINTER. LX5 2 SA3 TRANWD FETCH NEXT-TRANSFER-WORD-POINTER. BX5 X5+X7 COMBINE SECTADD WITH NEXT-PARCEL-POINTER. SA2 TRANPAR FETCH NEXT-TRANSFER-PARCEL-POINTER. LX5 18 BX5 X1+X5 INSERT NEXT-INSTRUCTION-WORD POINTER. LX2 18 POSITION NEXT-TRANSFER-PARCEL-POINTER. BX1 X2+X3 LX5 20 IX7 X5+X1 PLACE NEXT-INSTRUCTION AND NEXT-TRANSFER SA7 STDSTK+X4 POINTERS ON TOP OF PROCESSOR REQUEST STACK. SA2 LBLPNTR USE OPERAND AS INDEX INTO LBLPTR TABLE IX2 X2+X6 SA2 X2 BX7 X4 MX6 0 START OF NEW LABELLED SECTION IS WORD BNDRY SA7 STKPTR STORE NEW DEPTH-POINTER VALUE. SA6 INSTPAR STORE NEW NEXT-INSTRUCTION-PARCEL-POINTER. BX7 X2 SA7 SECTAD SAVE POINTER TO NEW LABELLED SECTION. SA7 INSTWD STORE NEW NEXT-INSTRUCTIO-WORD-POINTER. EQ GETINST FETCH NEXT INSTRUCTION. KEY SA1 NEXLXID FETCH LEXID OF NEXT SOURCE WORD, AND MX0 49 COMPARE 11 LOW-ORDER BITS WITH OPERAND BX1 -X0*X1 VALUE. IX4 X6-X1 NZ X4,GETINST IF SOURCE WORD IS NOT THE SPECIFIC KEYWORD TESTED FOR, THEN GO EXECUTE NEXT SYNTBLE INSTRUCTION. RJ LEXSCAN IF SOURCE = KEYWORD BEING TESTED FOR, CALL LEXSCAN TO ADVANCE IN SOURCE STREAM AND EQ GETINST THEN GO EXECUTE THE NEXT SYNTBLE INSTRUCT. KEY$ SA1 NEXLXID FETCH LEXID OF NEXT SOURCE WORD AND COMPARE MX0 49 11 LOW-ORDER BITS WITH OPERAND VALUE. BX1 -X0*X1 IX4 X6-X1 NZ X4,GETINST IF NOT THE KEYWORD THEN GO EXECUTE THE NEXT SYNTBLE INSTRUCTION. RJ LEXSCAN IF SOURCE = KEYWORD BEING TESTED FOR, CALL LEXSCAN TO ADVANCE IN SOURCE STREAM AND EQ STDYES+1 JUMP TO NEXT-TRANSFER-POINT. SUBCALL SB1 X6 OPERAND USED AS INDEX INTO USER"S SWITCH VECTOR TO CALL A SEMANTIC PROCESSING RTN. SB4 3777B TEST FOR A REFERENCE TO A SUBROUTINE WHICH SX1 B1 EQ B1,B4,GENMODE WAS UNDEFINED AT SYNGEN TIME. JP B0+0 THIS CODE WILL BE MODIFIED AT EXECUTION. DIAGNOS SA1 OPNDADD PASS OPERAND AS PARAMETER IN CALL TO THE DIAGSTD VFD 6/1,54/0 DIAGNOSTIC MODULE EQ GETINST FETCH NEXT INSTRUCTION. DRIVEREQ ZR X5,GETINST INSTRUCTION PARCEL OF ZERO TREATED AS NO-OP SX4 X6-3 ZR X4,SUBS IF OPERAND IS 3 THEN INSTRUCTION IS +SUBS. PL X4,AMBIG ELSE MAY BE EITHER TYPE CHECK OR SCAN REQ. LX4 59 SHIFT TO FIND WHETHER OPERAND = YES OR NO. SA1 STKPTR FETCH PTR TO TOP OF PROCESSOR REQUEST STACK SB1 X1 SA3 STDSTK+X1 FETCH TOP OF STACK. GE B1,OKSTK IF STACK UNDERFLOW OCCURS, ABORT WITH A MESSAGE UNDRFLO DAYFILE MESSAGE. ABORT OKSTK LX3 20 MX0 2 MASK FOR PARCEL POINTER. SX7 X3 ISOLATE BASE ADDRESS OF SYNTBLE SECTION. PL X4,NO LX3 20 POSITION TO YES-RETURN POINTERS. NO LX0 20 SA7 SECTAD SAVE BASE ADDRESS OF SECTION TO WHICH CONTROL IS RETURNING. LX3 20 POSITION TO YES OR NO RETURN POINTERS. SX6 X3 ISOLATE WORD POINTER. BX7 X3*X0 ISOLATE PARCEL POINTER. SA6 INSTWD STORE NEXT-INSTRUCTION-WORD-POINTER. AX7 18 SA7 INSTPAR STORE NEXT-INSTRUCTION-PARCEL-POINTER. PL X4,SETRANS FOR YES-RETURN, SET TRANSFER POINTERS = 0. SX6 B0 MX7 0 EQ STORTRN SETRANS LX3 20 FOR NO-RETURN, RESET TRANSFER POINTERS WITH SX6 X3 STACKED VALUES. BX7 X3*X0 STORTRN SA6 TRANWD STORE NEXT-TRANSFER-WORD-POINTER. AX7 18 SX6 X1-1 POP REQUEST STACK. SA7 TRANPAR STORE NEXT-TRANSFER-PARCEL-POINTER. SA6 STKPTR EQ GETINST FETCH NEXT INSTRUCTION. SUBS SA2 SYNSECT USE VALUE ON SYNSECT AS OPERAND FOR A BX6 X2 LABEL CALL. ZR X2,GENMODE 0 IS AN ILLEGAL INDEX VALUE FOR LBLPTRS ARRAY. EQ LBLCALL AMBIG SB1 X6-100 TEST FOR SCAN REQUEST OR TYPE CHECK. LT B1,SCANREQ OPERAND < 100 MEANS POSSIBLE SCAN REQUEST. SB4 3777B-100 TEST FOR UNDEFINED REFERENCE AT SYNGEN EQ B1,B4,GENMODE TIME WHICH RESULTED IN AN INSTRUCTION DESIGNED TO GENERATE A MODE 1 ERROR. IN THE FOLLOWING TEST, THE TEST IS TRUE (RESULTING IN A CALL TO STDYES) IF THE TWO VALUES IN NEXTYPE AND OPERAND ARE EQUAL OR NEXTYPE SPECIFIES A TYPE INCLUDED IN A MORE GENERAL TYPE CODED IN OPERAND. SA4 NEXTYPE FETCH SYNTACTIC-TYPE CODE OF NEXT SOURCE SB2 X4-100 WORD AND COMPARE WITH OPERAND VALUE. IF THE EQ B1,B2,EQLTYPE VALUES ARE NOT EQUAL HAVE TO GO THROUGH JP B1+TYPECHK SWITCH TO COMPLETE TYPE TEST. TYPECHK EQ GETINST OPERAND = 100, TYPE TESTED FOR = KEYWORD. EQ GETINST OPERAND = 101, TYPE TESTED FOR = NAME. GE B2,B1,EQLTYPE OPERAND = 102, TYPE TESTED FOR = ANY EQ GETINST LITERAL STRING. EQ NONNUM OPERAND = 103, TYPE TESTED FOR = NONNUMERIC EQ GETINST OPERAND = 104, TYPE TESTED FOR = CHAR MASK. EQ GETINST OPERAND = 105, TYPE TESTED FOR = BIT MASK. GE B2,B1,EQLTYPE OPERAND = 106, TYPE TESTED FOR = ANY EQ GETINST NUMERIC TYPE EQ GETINST OPERAND = 107, TYPE TESTED FOR = INTEGER. EQ GETINST OPERAND = 108, TYPE TESTED FOR = FIXED PT. EQ GETINST OPERAND = 109, TYPE TESTED FOR = COMPLEX. GE B2,B1,EQLTYPE OPERAND = 110, TYPE TESTED FOR = EITHER EQ GETINST SINGLE OR DOUBLE PREC FLOATING POINT. EQ GETINST OPERAND = 111, TYPE TESTED FOR = SINGLE. EQ GETINST OPERAND = 112, TYPE TESTED FOR = DOUBLE. EQLTYPE RJ LEXSCAN THE NEXT SOURCE WORD IS THE TYPE TESTED FOR EQ STDYES+1 ADVANCE IN SOURCE AND JMP TO NEXT TRANSFER. NONNUM LT B2,B1,GETINST NEXT SOURCE TYPE IS NON-NUMERIC IF THE SB3 106-100 CODE < 106 AND > 102 LT B2,B3,EQLTYPE EQ GETINST SCANREQ SB2 X6-SNW IF SCAN REQUEST IS +SNC THEN CALL LEXSNC TO GT B2,B0,SNCREQ GET THE NEXT SOURCE RECORD. EQ B2,B0,SNWREQ IF +SNW THEN CALL LEXSCAN TO GET THE NEXT SOURCE WORD. SA4 NEXTYPE REQUEST IS +EOT OR +EOF. IF NEXTYPE IS BX4 X4-X6 EITHER EOT OR EOF AND THE REQUESTED TYPE IS NZ X4,GETINST DIFFERENT , GO TO STDNO EQ STDYES+1 THE SAME , GO TO STDYES SNWREQ RJ LEXSCAN SCAN NEXT SOURCE WORD. EQ GETINST FETCH THE NEXT INSTRUCTION PARCEL. SNCREQ RJ LEXSNC IF REQUEST IS +SNC, CALL LEXSNC TO GET THE 1ST SOURCE WORD IN THE NEXT SOURCE RECORD. EQ GETINST FETCH THE NEXT INSTRUCTION PARCEL. STDYES DATA 0 SA1 TRANWD FETCH NEXT-TRANSFER-WORD-POINTER. SA2 TRANPAR FETCH NEXT-TRANSFER-PARCEL-POINTER. MX6 0 BX7 X1 SA6 TRANWD SET NEXT-TRANSFER-WORD-POINTER TO ZERO. SA7 INSTWD STORE NEW VALUE IN NEXT-INSTRUCTION-WORD. SA6 A2 SET NEXT-TRANSFER-PARCEL-POINTER TO ZERO. BX7 X2 SA7 INSTPAR STORE NEW VALUE IN NEXT-INSTRUCTION-PARCEL. EQ GETINST FETCH NEXT INSTRUCTION. GENMODE EQ 377777B GENERATES A MODE ERROR FOR UNDEFINED REF- ERENCE INSTRUCTIONS. ERROP ABORT BINCON DATA 0 CONVERTS A 12-BIT, UNSIGNED, BINARY INTEGER MX0 48 IN X3 TO DISPLAY-CODED OCTAL,LEFT-JUSTIFIED BX3 -X0*X3 IN X6 AND PADDED WITH 1 BLANK TO MAKE 5 NZ X3,NONZERO CHARACTERS RETURNED IN X6. SA4 =5R 0 BX6 X4 EQ BINCON NONZERO MX0 57 SB7 4 MX6 0 SB6 -1 LX3 48 SHIFTL LX3 3 BX4 -X0*X3 SX5 X4+33B SB7 B7+B6 BX6 X6+X5 BX3 X3*X0 LX6 6 NE B7,SHIFTL SX5 55B BX6 X6+X5 EQ BINCON OPNDADD CON OPERAND POINTER TO OPERAND FOR PARAMETER PASSING CON NULL,NULL END OF PARAMETER LIST FOR DIAG NULL DATA 0 DUMMY PARAMETER FOR DIAG LINECNT BSSZ 1 TFLAG DATA 0 FLAG FOR TRACE REQUEST INSTWD BSS 1 NEXT-INSTRUCTION-WORD-POINTER INSTPAR BSS 1 NEXT-INSTRUCTION-PARCEL-POINTER TRANWD BSS 1 NEXT-TRANSFER-WORD-POINTER TRANPAR BSS 1 NEXT-TRANSFER-PARCEL-POINTER STKPTR BSS 1 POINTER TO TOP OF PROCESSOR REQUEST STACK OPERAND BSS 1 VALUE OF CURRENT OPERAND SECTAD BSS 1 POINTER TO 1ST WORD OF CURRENT SYNTBLE SECT STDSTK BSS STKLIMT SPACE FOR PROCESSOR REQUEST STACK ZEROES DATA 10H0000000000 BLANKS DATA 10H TMSG DIS ,* INSTRUCT= * DATA 40H OVRFLOW DIS ,* COMPILER ERROR - STD STACK OVERFLOW * VFD 48/8H ,12/0 UNDRFLO DIS ,* COMPILER ERROR - STD STACK UNDERFLOW* VFD 48/8H ,12/0 AWRITE CON TMSG,TLG,TRC PARAMETER LIST FOR WRITE TLG DATA 110 NUMBER CHARS IN TRACE OUTPUT LINE. TRC BSS 1 I/O RETURN CODE FROM WRITE END