Trailing-Edge
-
PDP-10 Archives
-
decuslib10-07
-
43,50433/pascmp.pas
There are 4 other files named pascmp.pas in the archive. Click here to see a list.
00100 %$L-,C-,D-,T-,V:001200000214B\
00200 program pascmp;
00300 include 'pasprm.pas'; (* set up tops10 and tops20 *)
00400 %*********************************************************
00500 * *
00600 * *
00700 * STEP-WISE DEVELOPMENT OF A PASCAL COMPILER *
00800 * ****************************************** *
00900 * *
01000 * *
01100 * STEP 5: SYNTAX ANALYSIS INCLUDING ERROR *
01200 * HANDLING; CHECKS BASED ON DECLARA- *
01300 * 15/3/73 TIONS; ADDRESS AND CODE GENERATION *
01400 * FOR A HYPOTHETICAL STACK COMPUTER *
01500 * *
01600 * *
01700 * AUTHOR: URS AMMANN *
01800 * FACHGRUPPE COMPUTERWISSENSCHAFTEN *
01900 * EIDG. TECHNISCHE HOCHSCHULE *
02000 * CH-8006 ZUERICH *
02100 * *
02200 * CODE GENERATION FOR DECSYSTEM 10 BY *
02300 * C.-O. GROSSE-LINDEMANN, F.-W. LORENZ, *
02400 * H.-H. NAGEL, P.J. STIRL *
02500 * *
02600 * MODIFICATIONS TO GENERATE RELOCATABLE OBJECT CODE *
02700 * BY E. KISICKI (DEC 74) *
02800 * *
02900 * DEBUG SYSTEM BY P. PUTFARKEN (DEC 74) *
03000 * *
03100 * INSTITUT FUER INFORMATIK, D-2 HAMBURG 13, *
03200 * SCHLUETERSTRASSE 70 / GERMANY *
03300 * *
03400 * *
03500 *********************************************************\
03600
03700
03800
03900 % HOW TO GENERATE A NEW PASCAL COMPILER
04000
04100 SOURCES:
04200 A) ASCII: PASREL.PAS
04300 RUNTIM.MAC
04400 DEBSUP.MAC
04500 DEBUG .PAS
04600 B) BINARY: PASREL.SHR
04700 PASREL.LOW
04800 PASLIB.REL (CHECK INITPROCEDURE "SEARCH LIBRARIES")
04900
05000 ! IF THE NEW COMPILER SHOULD NOT BE MADE AVAILABLE FOR GENERAL USE ON SYS,
05100 ! ENTER THE APPROPIATE DIRECTORY SPECIFICATIONS IN INITPROCEDURE "SEARCH LIBRARIES"
05200
05300
05400 STEP ACTION
05500
05600 0 SAVE ALL SOURCE FILES ON DECTAPES!!
05700 1 .COPY PASLBN.REL=PASLIB.REL
05800 2 IF THERE ARE NO CHANGES TO RUNTIM.MAC, DEBSUP.MAC, OR DEBUG.PAS
05900 THEN GOTO STEP 9
06000 3 UPDATE RUNTIM.MAC
06100 4 ASSEMBLE " --> RUNTIM.REL
06200 5 UPDATE DEBSUP.MAC
06300 6 ASSEMBLE " --> DEBSUP.REL
06400 7 UPDATE DEBUG.PAS
06500 .RUN PASREL
06600 *DEBUG.PAS --> DEBUG.REL
06700 8 .R FUDGE2
06800 *PASLBN.REL=PASLBN.REL<RUNSP>,RUNTIM.REL<RUNSP>(R)$
06900 *PASLBN.REL=PASLBN.REL<DEBSP>,DEBSUP.REL<DEBSP>(R)$
07000 *PASLBN.REL=PASLBN.REL<DEBUG>,DEBUG.REL<DEBUG>(R)$
07100 *^C
07200 --> PASLBN.REL
07300 9 UPDATE PASREL.PAS
07400 UPDATE "HEADER" IN PASREL.PAS
07500 IF THERE ARE NEW ENTRIES TO RUNSP OR DEBSP
07600 CHECK
07700 INITPROCEDURE "RUNTIME-, DEBUG-SUPPORTS", "SUPPORTS"
07800 AND
07900 PROCEDURE "SUPPORT"
08000 10 .RUN PASREL
08100 *PASREL.PAS --> PASREL.REL
08200 11 .LOAD PASREL,/SEARCH PASLBN.REL
08300 .SSAVE PASREL 36 --> PASREL.SHR
08400 PASREL.LOW
08500
08600 36 K CORE ONLY IF NO RUNTIMECHECK (C-) AND NO DEBUG OPTION (D-) , OTHERWISE MORE !
08700
08800 12 .RENAME PAS1.PAS=PASREL.PAS
08900 13 .RUN PASREL
09000 *PAS1.PAS --> PAS1.REL
09100 14 .LOAD PAS1,/SEARCH PASLBN.REL
09200 .SSAVE PAS1 36 --> PAS1.SHR
09300 PAS1.LOW
09400 14.1 .RENAME PAS2.PAS=PAS1.PAS
09500 14.2 .RUN PAS1
09600 *PAS2.PAS --> PAS2.REL
09700 14.3 .LOAD PAS2,/SEARCH PASLBN.REL
09800 .SSAVE PAS2 36 --> PAS2.SHR
09900 --> PAS2.LOW
10000 15 .R FILCOM
10100 *TTY:=PAS2.LOW,PAS1.LOW
10200 NO DIFFERENCES ENCOUNTERED
10300 *TTY:=PAS2.SHR,PAS1.SHR
10400 FILE 1) DSK:PAS2.SHR CREATED: XXX
10500 FILE 2) DSK:PAS1.SHR CREATED: XXX
10600 400005 604163 XXXXXX 604163 XXXXXX XXXXXX
10700 %FILES ARE DIFFERENT
10800
10900 16 .DELETE PASREL.*,PAS1.*,PAS2.REL,PASLIB.REL
11000 .PRINT PAS2.LST
11100 .RENAME PASREL.*=PAS2.*
11200 .RENAME PASLIB.REL=PASLBN.REL
11300
11400
11500 *******************************************************************\
11600
11700 %HINTS FOR INTERPRETING ABBREVIATED IDENTIFIERS
11800 BRACK : BRACKET "[ ]" IX : INDEX
11900 C : CURRENT L : LOCAL
12000 C : COUNTER L : LEFT
12100 CST : CONSTANT PARENT : "( )"
12200 CTP : IDENTIFIER POINTER P/PTR : POINTER
12300 EL : ELEMENT P/PROC : PROCEDURE
12400 F : FORMAL R : RIGHT
12500 F : FIRST S : STRING
12600 F : FILE SY : SYMBOL
12700 F/FUNC : FUNCTION V : VARIABLE
12800 G : GLOBAL V : VALUE
12900 ID : IDENTIFIER
13000 REL : RELATIVE REL : RELOCATION\
13100
13200 (*LOCAL CHANGE HISTORY
13300 1 CLEAN UP COMMENT SCANNING AND ALLOW /* */ BRACKETS.
13400 NOTE THAT THIS \ WOULD HAVE TERMINATED THIS COMMENT
13500 PRIOR TO FIX.
13600 2 INCREASE STACKANDHEAP, GET CORE IF NEEDED ON PROGRAM
13700 ENTRY, FIX PARAMETER PASSING BUG, LOAD PASREL FROM
13800 SYS: INSTEAD OF DSK:, GENERATE FLOAT AND FIX INLINE.
13900 (FROM HEDRICK)
14000 NB: RUNTIM has now been modified to pass all characters,
14100 including control characters as well as lower case.
14200 It no longer turns tabs into spaces. Thus it was
14300 necessary to put this file through a program that
14400 expanded tabs into spaces when they were in strings.
14500 Thus FILCOM with the old version should specify /S
14600 or lots of irrelevant differences will be found.
14700 3 MAP LOWER CASE TO UPPER EXCEPT IN STRINGS. (DOESN'T
14800 SOLVE THE PROBLEM ABOUT SETS, THOUGH.) HEDRICK.
14900 4 use SCAN for file spec's, and fix to be called by
15000 COMPIL. Hedrick.
15100 5 add /CREF switch. Hedrick.
15200 6 allow PROGRAM statement. Syntax check but ignore it.
15300 fix bug that caused lower case char. after a string to put compiler in loop
15400 allow <> for #
15500 allow LABEL declaration. Syntax check bug ignore it.
15600 with /CREF/OBJ put only 3 instructions per line (4
15700 overflow a LPT line)
15800 use standard PACK and UNPACK
15900 catch illegal characters
16000 7 add /HEAP switch for size of stack and heap
16100 treat lower case as upper in sets
16200 10 Add STRSET and STRWRITE - equivalent to RESET and
16300 REWRITE, but sets I/O into string
16400 also GETINDEX, CLOSE, ROUND, CALLI
16500 ALSO REDID RESET/REWRITE TO TAKE GOOD FILE NAMES
16600 11 Modify compiler to use new RESET/REWRITE.
16700 12 Make PASCAL programs self-expanding
16800 13 ADD DDT SYMBOL NAMES FOR ROUTINES(BLOCK-STRUCTURED)
16900 use PROGRAM name as module and entry name
17000 allow strset/write on non-TEXT files
17100 add opt. 4th arg to strset/write: limit
17200 14 allow read of string - gets rest of line
FIX ILL MEM REF IN READREADLN
21500 ADD ERR MSG FOR ASSIGN TO FTN NAME OUTSIDE BODY
21600 32 add APPEND
21700 33 full implementation of PROGRAM statement
21800 version numbering of output files and program
21900 allow proc and func as parameters
22000 remove LOC (subsumed by above)
22100 add $V directive for version number
22200 34 allow list of entry points in PROGRAM statement
22300 35 fix error recovery in BLOCK, especially for /NOMAIN
22400 36 ALLOW DEBUGGING MULTIPLE FILES
22500 remove T- option
22600 NB: I have not removed the variables for T-, and also
22700 supports exist for indeb. and exdeb., though they
22800 are no longer used in PASCMP.
22900 37 fix bug in static link for level one proc's
23000 40 use RESDEV as external name for DISMISS
23100 by default put request for PASLIB before FORLIB
23200 improve format of /OBJECT listing
23300 fix arg's to predefined functions
23400 fix comparison of unpacked strings
23500 41 make it restartable
23600 change kludge for file OUTPUT
23700 42 allow variable records for GET,PUT,and DUMPx
23800 Currently DUMPx implemented in kludgey way.
23900 43 add 5 locations to file block for new runtimes
24000 add PUTX
24100 add optional arg to useti
24200 allow 12 digit octal number
24300 44 Add SETPOS and CURPOS to compiler
24400 45 Add NEXTBLOCK to compiler and make check for
24500 AC overlap with APPEND,UPDATE
24600 46 Repair CALLI to use 1 for true, and accept all
24700 possible argument formats.
24800 47 Add some more functions
24900 Repair calculations for NEW with packed arrays
25000 50 Generate correct code for 400000,,0
25100 Reinitialize file ctl blocks at start
25200 Don't open INPUT or OUTPUT unless asked
25300 51 Allow mismatch of byte size for SETSTRING
25400 Fix GETLINENR
25500 52 Fixes from CMU:
25600 To CALLNONSTANDARD: when depositing directly into
25700 display, moved 2 ac's for all arg's of size 2,
25800 without checking to see if VAR. Assumed AC was
25900 unchanged by BLT.
26000 To SIMPLEEXPRESSION: optimization sometimes negated
26100 a real constant. If had been declared by CONST,
26200 future ref's were to the negated quantity!
26300 53 Problems with dynamic memory expansion:
26400 Arbitrarily asked for 40b more locations above
26500 end of stack (for runtimes). But some odd
26600 procedure calls use more. Need to figure out
26700 how much memory is used.
26800 CORERR just allocated memory up to (P). Should
26900 be 40(P), or however much is really needed.
27000 So add STKOFFMAX, to keep track of how much
27100 really needed. CORALLOC is addr of the test for
27200 sufficient memory, fixed up.
27300 54 More dynamic memory: Need to accumulate offsets
27400 above top of stack, in case of
27500 x(1,2,3,4,5,f(1,2,3,4,5,6)), etc., though an
27600 actual problem seems a bit unlikely.
27700 55 Add require source file feature
27800 56 Clean up syntax for require file
27900 57 add tops20 version
28000 60 make tops20 strings work more like tops10
28100 61 add jsys pseudo-runtime
28200 add tops20 runtimes and restrict runtimes that work only on one system
28300 add +*@ after file name to control gtfjn in tops20
28400 62 make sure there is never data above the stack pointer
28500 63 convert time, runtime, setuwp for tops20
28600 64 input:/ for tops-20
28700 empty entry in record
28800 non-local goto's
28900 fix procedure param's if not in ac's
29000 65 allow extra semicolon in case
29100 remove references to exit labels
29200 66 speed up non-local goto's
29300 67 fix external proc's as proc param's
29400 70 fix ill mem ref if certain errors in type decl
29500 71 make file name in fcb be 7 bit for tops20
29600 72 make two fixup chains for 2 word constants, to
29700 prevent giving LINK an ill mem ref
29800 73 make new use getfn for file names, to get EXTERN files
29900 74 allow new init. so tops10 version can work with emulator
30000 75 fix non-loc goto's - typo made goto chain bad
30100 76 allow a set in reset/rewrite to specify bits.
30200 allow break char set in read/readln
30300 77 fix jsys and reset set arguments
30400 100 fix ac usage in readreadln from strings
30500 101 fix fltr and fix code generation
30600 102 Add klcpu - put improved packed array code under it
30700 103 Fix pointer to global symbol table in case that level
30800 has already been output by some inner procedure
30900 104 Check stack overflow
31000 Check to be sure structures aren't too big
31100 Range check subranges in for loop and value parameters
31200 105 Use tables instead of -40B to convert from lower case
31300 106 Make subranges of reals illegal
31400 107 Abort creation of .REL file on all errors
31500 110 Allow [x..y] set construct
31600 111 Allow STRING and POINTER parameters to EXTERN proc's
31700 112 Clrbfi when error detected. Bounds check sets [a..b]
31800 113 Make real number reader handle exact things exactly
31900 Don't demand foward type ref's resolved at end of require file
32000 114 Write local fixups even if only non-loc gotos
32100 Make CREF not say .FIELDID. for local gotos
32200 maxint = 377777777777B
32300 115 Make tops10=false, kl=false work (tenex)
32400 116 IDRECSIZE entries for param, labelt type
32500 Make NEXT NIL instead of 0 when not used, for COPYCTP
32600 117 Fix enumerated type in record
32700 120 Make initialization routine use JSP, for T20/Tenex so
32800 don't have ill mem ref if emulator present
32900 121 Initialize CODEARRAY: fix bollixed INITPROC's
33000 122 KA's. This includes fixing COPYSTP so it doesn't
33100 try to follow NIL pointers. Harmless if 377777 is a
33200 legal address, but it isn't for KA's.
33300 123 Do POPF when can't find included file, so close gets done.
33400 124 Limit initprocedures to top level.
33500 Initialize CREF off
33600 125 Do POPF when expected eof inside included file.
33700 126 Detect procedures not beginning with BEGIN
33800 127 INit CREF to FALSE, fix [const..var] set construct
33900 130 Fix KA bug wherein random word in core image is garbage
34000 131 Move cixmax to pasprm.pas so tops20 can use big value
34100 132 Replace KA10 with KACPU for op codes and NOVM for old
34200 memory allocation.
34300 133 Fix JSYS to allow functions within it. Garbaged stack.
34400 134 Allow DELETE in Tops-10, too.
34500 135 Fix LOG2 for big numbers. Prevent ill mem ref's in
34600 PACK and UNPACK with syntax errors.
34700 136 Add header line at top of each page with pg. number
34800 137 Reset line no. to 1 at start of page.
34900 Fix bug in set constructors for CHAR
35000 140 Chnage order of SETMAP to closer to ASCII collating seq.
35100 141 Fix problem where REGC gets messed up by array subscript
35200 calculations when ONFIXEDREGC is in effect.
35300 Detect overflow in number scanning with JFCL.
35400 142 Make real number scanner scan anything legitimate
35500 143 Redo I/O to string in Tops-10 for new runtimes and fix
35600 onfixedregc code for packed arrays
35700 144 Allow :/ in program and :@ in reset for Tops-10
35800 145 Change external name of GET to GET. for Wharton
35900 146 Reinit count in putrelcode to avoid garbage in .REL file
36000 147 Lines start with 2 on new pages.
36100 150 Fix bug in forward type references,
36200 error recovery in fieldlist if garbage case type
36300 symbol table in forward proc's for debugger
36400 151 Fix reversed args in I,J:INTEGER in procedure decl.
36500 152 Add DISPOSE
36600 153 Fix some reg usage problems with DISPOSE
36700 154 More reg usage problems with DISPOSE
36800 155 Source file name in DEBUG block
36900 156 Detect FTNNAME^.field := value. Only bare ftn name
37000 allowed on LHS of assignment.
37100 157 Add $A- to turn off arith check
37200 160 Add compiler switch /ARITHCHECK
37300 161 fix STRINg and POINTER
37400 162 fix REGSIZE
37500 163 fix TIME for Tops-20
37600 164 use Polish fixups in CASE
37700 165 in type decl, make sure ^THING gets local defn of THING,
37800 even if it happens later and there is a higher level defn.
37900 (This requires treating ^THING as forward always.)
38000 166 make assignment to func id from inner func work
38100 initialize frecvar in fieldlist, to prevent ill mem ref
38200 with null record decl.
38300 167 improvements to edit 165
38400 170 more improvements to 165 (this time to error handling)
38500 171 allow read into packed objects
38600 allow read and write of binary files
38700 make sure default file names don't use user-declared INPUT,
38800 and OUTPUT
38900 fix NEW of pointer that is part of packed array
39000 172 option string as third arg of RESET, etc.
39100 evaluate upper bound of FOR statement only once
39200 173 allow files in any context; internal files
39300 174 fix to initprocedures from Hisgen
39400 175 make getfn take a param telling runtime validity check
39500 needed. SETSTRING, etc., do not
39600 176 better unterminated-comment error messages
39700 177 fix AC allocation in GETFILENAME
39800 200 fix addressing problem in loading file pointers
39900 201 make most manipulation of zero size objects be no-op.
40000 Previously one might stomp on the next variable.
40100 202 insufficient initialization before RESET(TTY), etc.
40200 fix POINTER passed by ref
40300 203 fix glitch in edit 202
40400 204 don't validity check the FCB for CLOSE, RCLOSE, and DISMISS
40500 205 fix AC in RENAME
40600 206 allow constants in WRITE statements for FILE OF INTEGER, etc.
40700 207 fix AC in GETFILENAME (again...)
40800 210 Allow 9 digit HEX numbers
40900 211 Fix output of string constants in .REL file
41000 212 Better error message if INPUT or OUTPUT redefined
41100 213 Fix procedure exit code if there is local variable
41200 214 Make debugger see locals of forward declared proc's
41300 *)
41400
41500 CONST
41600 HEADER = 'PASCAL %12(214)';
41700
41800 DISPLIMIT = 20; MAXLEVEL = 8;
41900 STRGLGTH = 120; BITMAX = 36;
42000 (* 43 - longer file block for new runtimes *)
42100 SIZEOFFILEBLOCK=43B ; {plus size of component}
42200 OFFSET=40B; %FUER SETVERARBEITUNG DER ASCIICHARACTER\
42300 CHCNTMAX = 132; %MAXIMUM OF CHARACTERS IN ONE LINE\
42400 LEFT = 2;RIGHT = 1;BOTH = 3;NO = 0;
42500
42600 %KONSTANTEN VON BODY: \
42700 %*********************\
42800
42900 (* move cixmax to param file *)
43000 HWCSTMAX = 377777B; LABMAX = 20;
43100 (* 2 - increase default stack space *)
43200 (* 7 - stackandheap now set by switch *)
43300 (* 137 - fix set constructor for CHAR *)
43400 MAXERR = 4; BASEMAX = 71; CHARMAX = 177B;
43500
43600 %ADDRESSES:
43700 **********\
43800
43900 HAC=0; %HILFSREGISTER\
44000 TAC=1; %HILFSREGISTER AUCH FUER BYTEPOINTER\
44100 REGIN=1; %INITIALISE REGC\
44200 PARREGCMAX=6; %HIGHEST REGISTER USED FOR PARAMETERS\
44300 WITHIN=12; %FIRST REGISTER FOR WITHSTACK\
44400 NEWREG=13; %LAST PLACE OF NEW-STACK\
44500 BASIS=14; %BASIS ADDRESS STACK\
44600 TOPP=15; %FIRST FREE PLACE IN DATASTACK\
44700 PROGRST = 145B; %LOC 140B..144B RESERVED FOR DEBUG-PROGR.\
44800 HIGHSTART=400000B;
44900 MAXADDR=777777B;
45000
45100
45200
45300
45400
45500 TYPE
45600 %DESCRIBING:\
45700 %***********\
45800
45900
46000 %BASIC SYMBOLS\
46100 %*************\
46200
46300 SYMBOL = (IDENT,INTCONST,REALCONST,STRINGCONST,NOTSY,MULOP,ADDOP,RELOP,
46400 LPARENT,RPARENT,LBRACK,RBRACK,COMMA,SEMICOLON,PERIOD,ARROW,
46500 COLON,BECOMES,LABELSY,CONSTSY,TYPESY,VARSY,VALUESY,FUNCTIONSY,
46600 (* 6 - add PROGRAM statement *)
46700 (* 56 - ADD INCLUDE *)
46800 PROCEDURESY,SETSY,PACKEDSY,ARRAYSY,RECORDSY,FILESY,FORWARDSY,PROGRAMSY,INCLUDESY,
46900 BEGINSY,IFSY,CASESY,REPEATSY,WHILESY,FORSY,WITHSY,LOOPSY,
47000 GOTOSY,EXITSY,ENDSY,ELSESY,UNTILSY,OFSY,DOSY,TOSY,DOWNTOSY,
47100 EXTERNSY,PASCALSY,FORTRANSY,ALGOLSY,COBOLSY,
47200 THENSY,OTHERSY,INITPROCSY,OTHERSSY);
47300
47400 OPERATOR = (MUL,RDIV,ANDOP,IDIV,IMOD,PLUS,MINUS,OROP,LTOP,LEOP,GEOP,GTOP,
47500 NEOP,EQOP,INOP,NOOP);
47600
47700 SETOFSYS = SET OF SYMBOL;
47800
47900 (* 23 - check for bad pointer *)
48000 (* 24 - ONLY CLEAR NEW WHEN TYPECHECKING *)
48100 (* 104 - new tops10 stackoverflow *)
48200 (* 152 - DISPOSE *)
48300 SUPPORTS = (FIRSTSUPPORT,STACKOVERFLOW,DEBSTACK,BADPOINT,ALLOCATE,CLEARALLOC,DEALLOCATE,
48400 (* 173 - internal files *)
48500 WITHFILEDEALLOCATE,
48600 (* 43 - add PUTX *)
48700 (* 64 - non-loc goto *)
48800 EXITGOTO,EXITPROGRAM,GETLINE,GETFILE,PUTLINE,PUTFILE,PUTXFILE,
48900 (* 57 - Add strset and strwrite external routines *)
49000 RESETFILE,REWRITEFILE,RESETSTRING,REWRITESTRING,GETCHARACTER,PUTPAGE,ERRORINASSIGNMENT,
49100 (* 173 - internal files *)
49200 FILEUNINITIALIZED,INITFILEBLOCK,
49300 WRITEPACKEDSTRING,WRITESTRING,WRITEBOOLEAN,READCHARACTER,READINTEGER,READREAL,
49400 (* 171 - RECORD READ/WRITE *)
49500 (* 206 - extend for constants *)
49600 READRECORD,WRITERECORD,WRITESCALAR,
49700 BREAKOUTPUT,OPENTTY,INITIALIZEDEBUG,ENTERDEBUG,INDEXERROR,WRITEOCTAL,WRITEINTEGER,WRITEREAL,
49800 (* 10 add CLOSE *)
49900 WRITEHEXADECIMAL,WRITECHARACTER,CONVERTINTEGERTOREAL,
50000 (* 14 and lots more *)
50100 (* 33 - PROGRAM statement *)
50200 CONVERTREALTOINTEGER,CLOSEFILE,READSTRING,READPACKEDSTRING,READFILENAME,
50300 NAMEFILE,DISFILE,UPFILE,APFILE,READDUMP,WRITEDUMP,SETIN,SETOUT,BREAKINPUT,
50400 (* 74 - tops20 routines *)
50500 SETPOSF,CURPOSF,NEXTBLOCKF,SPACELEFTF,GETXF,DELFILE,RELFILE,INITMEM,INITFILES,
50600 (* 163 - tops20 TIME function *)
50700 GETDAYTIME,LASTSUPPORT);
50800
50900 %CONSTANTS\
51000 %*********\
51100
51200 CSTCLASS = (INT,REEL,PSET,STRD,STRG);
51300 CSP = ^ CONSTNT;
51400 (* 55 - add require files *)
51500 STRGARR = PACKED ARRAY[1..STRGLGTH] OF CHAR;
51600 CONSTNT = RECORD
51700 SELFCSP: CSP; NOCODE: BOOLEAN;
51800 CASE CCLASS: CSTCLASS OF
51900 INT : (INTVAL: INTEGER; INTVAL1:INTEGER %TO ACCESS SECOND WORD OF PVAL\ );
52000 REEL: (RVAL: REAL);
52100 PSET: (PVAL: SET OF 0..71);
52200 STRD,
52300 STRG: (SLGTH: 0..STRGLGTH;
58500 ARRAYY : (ARRAYSP: STP)
58600 END;
58700 GLOBPTR = RECORD
58800 NEXTGLOBPTR: GTP ;
58900 FIRSTGLOB,
59000 LASTGLOB : ADDRRANGE ;
59100 FCIX : CODERANGE
59200 END ;
59300
59400 FILBLCK = PACKED RECORD
59500 NEXTFTP : FTP ;
59600 FILEIDENT : CTP
59700 END ;
59800
59900 %NAMES\
60000 %*****\
60100
60200 (* 64 - non-loc goto *)
60300 (* 111 - STRING, POINTER *)
60400 (* PARAMS is a special kind of TYPES. It is used only for
60500 predeclared identifiers describing kludgey types that are
60600 valid only in procedure parameter lists. *)
60700 IDCLASS = (TYPES,KONST,VARS,FIELD,PROC,FUNC,LABELT,PARAMS);
60800 SETOFIDS = SET OF IDCLASS;
60900 IDKIND = (ACTUAL,FORMAL);
61000 PACKKIND = (NOTPACK,PACKK,HWORDR,HWORDL);
61100 CHARWORD = PACKED ARRAY [1..5] OF CHAR;
61200 %ALFA = PACKED ARRAY [1..ALFALENG] OF CHAR;\
61300
61400 IDENTIFIER = PACKED RECORD
61500 NAME: ALFA;
61600 LLINK, RLINK: CTP;
61700 IDTYPE: STP; NEXT: CTP;
61800 SELFCTP: CTP; NOCODE: BOOLEAN;
61900 CASE KLASS: IDCLASS OF
62000 KONST: (VALUES: VALU);
62100 VARS: (VKIND: IDKIND; VLEV: LEVRANGE;
62200 CHANNEL: ACRANGE; VDUMMY: 0..31; VADDR: ADDRRANGE);
62300 FIELD: (PACKF: PACKKIND; FDUMMY: 0..7777B;
62400 FLDADDR: ADDRRANGE);
62500 %IF PACKF=PACKK THEN FLDADDR CONTAINS THE
62600 ABSOLUTE ADDRESS OF THE CORRESPONDING BYTEPOINTER
62700 -----> ENTERBODY\
62800 PROC,
62900 FUNC: (PFCHAIN: CTP; CASE PFDECKIND: DECLKIND OF
63000 STANDARD: (KEY: 1..44);
63100 DECLARED: (PFLEV: LEVRANGE; PFADDR: ADDRRANGE;
63200 CASE PFKIND: IDKIND OF
63300 ACTUAL: (FORWDECL: BOOLEAN; TESTFWDPTR: CTP;
63400 EXTERNDECL: BOOLEAN; LANGUAGE: SYMBOL;
63500 EXTERNALNAME: ALFA;
63600 LINKCHAIN: PACKED ARRAY[LEVRANGE] OF ADDRRANGE;
63700 (* 62 - clean of stack offsets *)
63800 POFFSET:ADDRRANGE)));
63900 (* 66 - non-local goto's *)
64000 LABELT: (SCOPE:LEVRANGE;NONLOCGOTO:BOOLEAN;
64100 GOTOCHAIN:ADDRRANGE;LABELADDRESS:ADDRRANGE)
64200 END;
64300
64400
64500 DISPRANGE = 0..DISPLIMIT;
64600 WHERE = (BLCK,CREC);
64700 (* 61 - new type to separate tops10 and tops20 ftns *)
64800 machine = (okname,t10name,t20name);
64900
65000 %RELOCATION\
65100 %**********\
65200
65300 RELBYTE = 0..3B %(NO,RIGHT,LEFT,BOTH)\;
65400
65500 RELWORD = PACKED ARRAY[0..17] OF RELBYTE;
65600
65700 %EXPRESSIONS\
65800 %***********\
65900
66000 ATTRKIND = (CST,VARBL,EXPR);
66100
66200 ATTR = RECORD
66300 TYPTR: STP;
66400 CASE KIND: ATTRKIND OF
66500 CST: (CVAL: VALU);
66600 VARBL: (PACKFG: PACKKIND; INDEXR: ACRANGE; INDBIT: IBRANGE;
66700 VLEVEL: LEVRANGE; BPADDR,DPLMT: ADDRRANGE; VRELBYTE: RELBYTE; SUBKIND: STP);
66800 EXPR: (REG:ACRANGE)
66900 END;
67000
67100 TESTP = ^ TESTPOINTER;
67200 TESTPOINTER = PACKED RECORD
67300 ELT1,ELT2: STP;
67400 LASTTESTP: TESTP
67500 END;
67600
67700 (* 65 - remove exit labels *)
67800
67900 %TYPES FROM BODY \
68000 %****************\
68100
68200 (* 13 - ADD WRITEBLOCK FOR DDT SYMBOLS *)
68300 WRITEFORM = (WRITEENTRY,WRITENAME,WRITEHISEG,WRITEGLOBALS,WRITECODE,WRITEINTERNALS,
68400 (* 164 - add Polish fixups *)
68500 WRITEPOLISH,WRITELIBRARY,
68600 (* 173 - remove writefileblock *)
68700 WRITESYMBOLS,WRITEBLK,WRITESTART,WRITEEND);
68800
68900 UPDATEFORM = (C,D);
69000 ETP = ^ ERRORUPDATE;
69100 ERRORUPDATE = PACKED RECORD
69200 NUMBER: INTEGER;
69300 NEXT: ETP;
69400 CASE FORM: UPDATEFORM OF
69500 C: (STRING: ALFA);
69600 D: (INTVAL: INTEGER)
69700 END;
69800
69900 KSP = ^ KONSTREC;
70000 KONSTREC = PACKED RECORD
70100 (* 72 - two fixup chains for 2 word consts *)
70200 ADDR, ADDR1, KADDR: ADDRRANGE;
70300 CONSTPTR: CSP;
70400 NEXTKONST: KSP
70500 END;
70600 (* 164 - Polish fixups for CASE *)
70700 POLPT = ^ POLREC;
70800 {This record indicates a Polish fixup to be done at address WHERE in
70900 the code. The RH of WHERE is to get the BASE (assumed relocatable),
71000 adjusted by OFFSET (a constant). This is needed because the loader
71100 assumes that any address < 400000B is in the lowseg. So to get the
71200 virtual start of the CASE statement branch table we need to use
71300 this to adjust the physical start of the table by the first case
71400 index}
71500 POLREC = PACKED RECORD
71600 WHERE: ADDRRANGE;
71700 BASE: ADDRRANGE;
71800 OFFSET: INTEGER;
71900 NEXTPOL: POLPT
72000 END;
72100
72200 PDP10INSTR = PACKED RECORD
72300 INSTR : INSTRANGE ;
72400 AC : ACRANGE;
72500 INDBIT : IBRANGE;
72600 INXREG : ACRANGE;
72700 ADDRESS : ADDRRANGE
72800 END ;
72900
73000 HALFS = PACKED RECORD
73100 LEFTHALF: ADDRRANGE;
73200 RIGHTHALF: ADDRRANGE
73300 END;
73400
73500 PAGEELEM = PACKED RECORD
73600 WORD1: PDP10INSTR;
73700 LHALF: ADDRRANGE; RHALF: ADDRRANGE
73800 END;
73900 DEBENTRY = RECORD
74000 (* 36 - ALLOW MULTIPLE MODULES *)
74100 NEXTDEB: INTEGER; %WILL BE PTR TO NEXT ENTRY\
74200 LASTPAGEELEM: PAGEELEM;
74300 (* 103 - fix global id tree *)
74400 GLOBALIDTREE: CTP;
74500 STANDARDIDTREE: CTP;
74600 INTPOINT: STP;
74700 REALPOINT: STP;
74800 CHARPOINT: STP;
74900 MODNAME: ALFA;
75000 (* 155 - add source information *)
75100 SOURCE: PACKED ARRAY[1..167]OF CHAR;
75200 END;
75300
75400 (* 4 - add data structure for SCAN to return *)
75500 (* 11 - modify structure and add type for the REL file *)
75600 INTFILE = FILE OF INTEGER;
75700 RPGDATA = RECORD
75800 (* 7 - add /HEAP switch *)
75900 RELNAME:ALFA;
76000 (* 24 - allow user to set first loc of stack and heap *)
76100 STACKVAL:INTEGER;
76200 HEAPVAL:INTEGER;
76300 (* 33 - version no. *)
76400 VERVAL:INTEGER;
76500 (* 25 - add /ZERO *)
76600 (* 160 - add /ARITHCHECK *)
76700 ASW,ZSW,LSW,TSW,MSW,CSW,DSW,CRSW,RPGSW:BOOLEAN
76800 END;
76900 RPGPT = ^ RPGDATA;
77000 (* 33 - PROGRAM statement *)
77100 (* 61 - allow +* in tops20 *)
77200 PROGFILE = PACKED RECORD
77300 FILID:ALFA;
77400 NEXT:^PROGFILE;
77500 (* 64 - INPUT:/ *)
77600 wild,newgen,oldfile,interact,seeeol:Boolean
77700 END;
77800 (* 157 - See if we need INITTTY *)
77900 PROGFILEPT = ^ PROGFILE;
78000
78100 %------------------------------------------------------------------------------\
78200
78300
78400 VAR
78500 %RETURNED BY SOURCE PROGRAM SCANNER INSYMBOL:\
78600 %********************************************\
78700
78800 SY: SYMBOL; %LAST SYMBOL\
78900 OP: OPERATOR; %CLASSIFICATION OF LAST SYMBOL\
79000 VAL: VALU; %VALUE OF LAST CONSTANT\
79100 LGTH: INTEGER; %LENGTH OF LAST STRING CONSTANT\
79200 ID: ALFA; %LAST IDENTIFIER (POSSIBLY TRUNCATED)\
79300 CH: CHAR; %LAST CHARACTER\
79400
79500
79600 %COUNTERS:\
79700 %*********\
79800
79900 RTIME,
80000 I: INTEGER;
80100 SUPPORTIX: SUPPORTS;
80200 LANGUAGEIX: SYMBOL;
80300 CHCNT: 0..132; %CHARACTER COUNTER\
80400 CODEEND, %FIRST LOCATION NOT USED FOR INSTRUCTIONS\
80500 LCMAIN,
80600 (* 5 - some new variables for CREF *)
80700 LC,IC,BEGLC,BEGIC: ADDRRANGE; %DATA LOCATION AND INSTRUCTION COUNTER\
80800 (* 176 - new vars for unterminated comment *)
80900 comment_page, comment_line: integer;
81000
81100 %SWITCHES:\
81200 %*********\
81300
81400 (* 25 - ADD /ZERO *)
81500 ZERO, %ON TO INITIALIZE LOCAL VAR'S\
81600 (* 4 - variable for COMPIL linkage *)
81700 RPGENTRY, %ON IF CALLED CALLED BY COMPIL\
81800 (* 5 - new variables for CREF *)
81900 CREF, %ON IF CREF LISTING BEING MADE\
82000 DP,BEGDP, %DECLARATION PART\
82100 RESETFLAG, %TO IGNORE SWITCHES WHICH MUST NOT BE RESET\
82200 PRTERR, %TO ALLOW FORWARD REFERENCES IN POINTER TYPE
82300 DECLARATION BY SUPPRESSING ERROR MESSAGE\
82400 MAIN, %IF FALSE COMPILER PRODUCES EXTERNAL PROCEDURE OR FUNCTION\
82500 doinitTTY, %TTYOPEN needed\
82600 TTYINUSE, %no longer used ?\
82700 TTYSEEEOL, %TTY:# in program state\
82800 DEBUG, %ENABLE DEBUGGING\
82900 DEBUGSWITCH, %INSERT DEBUGINFORMATION\
83000 LISTCODE, %LIST MACRO CODE\
83100 INITGLOBALS, %INITIALIZE GLOBAL VARIABLES\
83200 LOADNOPTR, %TRUE IF NO POINTERVARIABLE SHALL BE LOADED\
83300 (* 157 - separate control for arith overflow *)
83400 ARITHCHECK, %SWITCH FOR DETECTING ARITH ERRORS\
83500 RUNTMCHECK: BOOLEAN; %SWITCH FOR RUNTIME-TESTS\
83600 (* 24 - ALLOW USER TO SET FIRST LOC OF STACK AND HEAP *)
83700 STACK,HEAP: ADDRRANGE; %FIRST ADDR OF STACK AND HEAP\
83800 (* 12 - stackandheap no longer needed *)
83900 (* 33 - VERSION NO. *)
84000 version:packed record %version no. for output\
84100 case boolean of
84200 true:(word:integer);
84300 false:(who:0..7B;major:0..777B;minor:0..77B;edit:0..777777B)
84400 end;
84500
84600
84700 %POINTERS:\
84800 %*********\
84900
85000 LOCALPFPTR, EXTERNPFPTR: CTP; %PTRS TO LOCAL/EXTERNAL PROC/FUNC-CHAIN\
85100 (* 111 - STRING, POINTER *)
85200 (* 202 - POINTER by ref *)
85300 INTPTR,REALPTR,CHARPTR,ANYFILEPTR,STRINGPTR,POINTERPTR,POINTERREF,
85400 BOOLPTR,NILPTR,TEXTPTR: STP; %POINTERS TO ENTRIES OF STANDARD IDS\
85500 (* 135 - ill mem ref in PACK, UNPACK *)
85600 UARRTYP:STP;
85700 UTYPPTR,UCSTPTR,UVARPTR,
85800 UFLDPTR,UPRCPTR,UFCTPTR, %POINTERS TO ENTRIES FOR UNDECLARED IDS\
85900 (* 64 - non-loc goto *)
86000 ulblptr,
86100 FWPTR: CTP; %HEAD OF CHAIN OF FORW DECL TYPE IDS\
86200 ERRMPTR,ERRMPTR1: ETP; %TO CHAIN ERROR-UPDATES\
86300 (* 65 - remove exit labels *)
86400 LASTBTP: BTP; %HEAD OF BYTEPOINTERTABLE\
86500 SFILEPTR,
86600 FILEPTR: FTP;
86700 FIRSTKONST: KSP;
86800 (* 164 - Polish fixups for CASE *)
86900 FIRSTPOL: POLPT;
87000 ALFAPTR, DATEPTR: STP;
87100 FGLOBPTR,CGLOBPTR : GTP ; %POINTER TO FIRST AND CURRENT GLOBAL INITIALISATION RECORD\
87200 GLOBTESTP : TESTP ; %POINTER TO LAST PAIR OF POINTERTYPES\
87300 (* 4 - Here is the main structure for the SCAN linkage *)
87400 SCANDATA : RPGPT ; %DATA FROM SCAN OF FILE NAMES\
87500 (* 33 - PROGRAM STATEMENT *)
87600 NPROGFILE, %NEW FILE NAME\
87700 LPROGFILE, %LAST FILE NAME IN LIST\
87800 FPROGFILE:PROGFILEPT; %FIRST FILE NAME IN LIST\
87900 (* 64 - non-loc goto *)
88000 lastlabel:ctp;
88100 (* 171 - treat file names as special *)
88200 infile,outfile,ttyfile,ttyoutfile:ctp; {Pointers to ID's for
88300 INPUT, OUTPUT, TTY, TTYOUT}
88400
88500 %BOOKKEEPING OF DECLARATION LEVELS:\
88600 %**********************************\
88700
88800 (* 5 - new variable for CREF *)
88900 LEVEL,BEGLEVEL: LEVRANGE; %CURRENT STATIC LEVEL\
89000 DISX, %LEVEL OF LAST ID SEARCHED BY SEARCHID\
89100 TOP: DISPRANGE; %TOP OF DISPLAY\
89200
89300 DISPLAY: %WHERE: MEANS:\
89400 ARRAY[DISPRANGE] OF
89500 PACKED RECORD
89600 %=BLCK: ID IS VARIABLE ID\
89700 (* 5 - new variable for CREF *)
89800 BLKNAME: ALFA; %NAME OF BLOCK\
89900 FNAME: CTP; %=CREC: ID IS FIELD ID IN RECORD WITH\
90000 CASE OCCUR: WHERE OF % CONSTANT ADDRESS\
90100 CREC: (CLEV: LEVRANGE; %=VREC: ID IS FIELD ID IN RECORD WITH\
90200 CINDR: ACRANGE; % VARIABLE ADDRESS\
90300 CINDB: IBRANGE;
90400 CRELBYTE: RELBYTE;
90500 CDSPL,
90600 CLC : ADDRRANGE)
90700 END;
90800
90900