Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50205/algol2.met
There are 2 other files named algol2.met in the archive. Click here to see a list.
00100	.SUBSYNTAX STATEMENTS
00200	
00300	.INTEGER I
00400	
00500	.INTERNAL FORST,CASEST,WHILEST,IFST,INTASSI,REFASSI,STRASSI
00600	.INTERNAL SETARRAY,ARRAYSS,ARRAYEND,STRSSEND,STRSTORE,SUBSTR
00700	.INTERNAL DEFINE,ARGGET,BASE,REFSTORE
00800	.EXTERNAL AC,ARGCT,ARGNUM,STATEMENT,INTEXPR,REFEXPR,STREXPR
00900	.EXTERNAL BOOLEX,ENDBLK,STRTMP,REFTMP
01000	
01100	BASE: .IF(BL#.EQ.CL#) #3"(%B)" /
01200	  .EMPTY #3"(%)" .OUT("MOVE"-"%,^D"BL#"+2(%B)") ;
01300	
01400	REFSTORE: #1"R." [*:=REFTMP] [REFTMP:=REFTMP+1] +%1
01500	  ^1 .ENTERC %1 .SET 4 .SET 15 .SET 22
01600	  .OUT("MOVEM"-"%TB,$"B#"."S#"(%B)")
01700	  .OUT("SETZ"-"%TB,") ;
01800	
01900	CASEST: .PEEK("CASE" .NOT(-.ID)) "CASE" [AC:=AC+1] INTEXPR "OF" "BEGIN" #3"0"
02000	 .OUT("JUMPLE"-"%1,"*1) .OUT("CAILE"-"%1,"*2) .OUT("JRST"-*1)
02100	 .OUT("JRST"-*3"(%1)") CASEPART *(";" .OUT("JRST"-*1) CASEPART)
02200	 "END" .OUT(*2"="-^3"^D"*) [I:=*] .LABEL *3 .OUT("JRST"-*1)
02300	 %1 *(.IF(I.GT.0) [I:=I-1] ^2 %3) ^1 [I:=*]
02400	 *(.IF(I.GT.0) [I:=I-1] ^3 .OUT("JRST"-"$"*)) .LABEL *1;
02500	
02600	CASEPART: .*1 %2 .LABEL *1 ^3[*:=*+1]%3 STATEMENT;
02700	
02800	WHILEST: .PEEK("WHILE" .NOT(-.ID)) "WHILE" .LABEL *2 BOOLEX "DO" .OUT("JUMPGE"-"%0,"*1)
02900	 STATEMENT .OUT("JRST"-*2) .LABEL *1;
03000	
03100	IFST: .PEEK("IF" .NOT(-.ID)) "IF" BOOLEX "THEN" .OUT("JUMPGE"-"%0,"*1) STATEMENT
03200	 ("ELSE" .OUT("JRST"-*2) .LABEL *1 STATEMENT .LABEL *2/
03300	 .EMPTY .LABEL *1);
03400	
03500	FORST: "FOR " .ID %2 .ENTERC .SET 21 .SET 3 .CHECK 26 CLEAR .CHECK 15 CLEAR
03600	 .CHECK 6 CLEAR .CHECK 10 CLEAR ":=" INTEXPR "STEP" INTEXPR "UNTIL" INTEXPR
03700	 "DO" ^2%2 .LOOKC .SET 26 .OUT("MOVEM"-"%0,$"B#"."S#"(%B)")
03800	 .OUT("MOVEM"-"%1,$"B#"."S#"+1(%B)") .OUT("MOVEM"-"%2,$"B#"."S#"+2(%B)")
03900	 .LABEL *1 .OUT("SKIPG"-"$"B#"."S#"+1(%B)")
04000	 .OUT("JRST"-".+4") .OUT("CAMLE"-"%0,$"B#"."S#"+2(%B)")
04100	 .OUT("JRST"-*2) .OUT("JRST"-".+3")
04200	 .OUT("CAMGE"-"%0,$"B#"."S#"+2(%B)") .OUT("JRST"-*2)
04300	 STATEMENT ^2 .LOOKC .OUT("MOVE"-"%0,$"B#"."S#"+1(%B)")
04400	 .OUT("ADDB"-"%0,$"B#"."S#"(%B)") .OUT("JRST"-*1) .CLEAR 26
04500	 .LABEL *2 ;
04600	
04700	INTASSI: .PEEK(.ID .LOOK .CHECK 3 SET) .CHECK 21 CLEAR
04800	 (.CHECK 6 SET %1 "(" REFEXPR ")" ":=" REFSTORE
04900	 INTEXPR ^1 .LOOKC .OUT("MOVE"-"%,$"B#"."S#"(%B)") .OUT("SETZM"-"$"B#"."S#"(%B)")
05000	 ^1 .LOOK .OUT("MOVEM"-"%0,$"B#"."S#"(%)")/
05100	 .CHECK 13 SET (.CHECK 10 SET ":=" %1 INTEXPR ^1 .LOOK #2"3" ARGGET /
05200	 ":=" %1 INTEXPR ^1 .LOOK
05300	  BASE .OUT("MOVEM"-"%0,$"B#"."S#^3*))/
05400	 .CHECK 11 SET SETARRAY "(" INTEXPR ")" ":=" #3"2" ARRAYSS
05500	  INTEXPR [AC:=AC-1] ARRAYEND .OUT("MOVEM"-"%2,(%1)")/
05600	 .CHECK 12 SET SETARRAY "(" INTEXPR "," #3"2" ARRAYSS INTEXPR
05700	  ")" #3"5" ARRAYSS ":=" INTEXPR [AC:=AC-1] ARRAYEND .OUT("MOVEM"-"%2,(%1)"));
05800	
05900	ARGGET: ARGNUM BASE ^3 .OUT("MOVE"-"%AL,2"*) .OUT("MOVE"-"%T,"*)
06000	 .OUT("MOVE"-"%T,@4*^D"[*:=ARGCT]*"(%AL)")
06100	 .OUT("XCT"-"4*^D"*"+"^2*"(%AL)") .OUT("SETZ"-"%T,");
06200	
06300	SETARRAY: %1 [AC:=AC+1] (.IF(AC.EQ.0) [AC:=AC+1] #3"1"
06400	 /.EMPTY #3"0") .IF(AC.LE.6)
06500	 (.CHECK 10 SET #2"1" ARGGET .OUT("HRRZ"-"%"[*:=AC]*",(%)") /
06600	 BASE [*:=AC] .OUT("HRRZ"-"%"*",$"B#"."S#^3*)) ^3;
06700	
06800	ARRAYSS: [AC:=AC-1] ^1%1 .LOOK 
06900	 (.CHECK 10 SET #2"1" ARGGET .OUT("SUBSC"-"%"[*:=AC]*","^3*"(%)") /
07000	 ^3%2 BASE [*:=AC] .OUT("SUBSC"-"%"*",$"B#"."S#"+"^2*^3*));
07100	
07200	ARRAYEND: ^1 .LOOK 
07300	 (.CHECK 10 SET #2"1" ARGGET .OUT("ADD"-"%"[*:=AC]*",1(%)") /
07400	 BASE [*:=AC] .OUT("ADD"-"%"*",$"B#"."S#"+1"^3*));
07500	
07600	REFASSI: .PEEK(.ID .LOOK .CHECK 4 SET)
07700	 (.CHECK 6 SET %1 "(" REFEXPR ")" ":=" REFSTORE
07800	 REFEXPR ^1 .LOOKC .OUT("MOVE"-"%,$"B#"."S#"(%B)") [REFTMP:=REFTMP-1] %2 ^1 .LOOK
07900	 .OUT("MOVEM"-"%TB,$"B#"."S#"(%)") ^2 .LOOKC .OUT("SETZB"-"%TB,$"B#"."S#"(%B)")/
08000	 .CHECK 13 SET (.CHECK 10 SET ":=" %1 REFEXPR ^1 .LOOK #2"3" ARGGET
08100	 .OUT("SETZ"-"%TB,") /
08200	 ":=" %1 REFEXPR ^1 .LOOK
08300	 BASE .OUT("MOVEM"-"%TB,$"B#"."S#^3*) .OUT("SETZ"-"%TB,"))/
08400	 .CHECK 11 SET SETARRAY "(" INTEXPR ")" ":=" #3"2" ARRAYSS
08500	  REFEXPR ARRAYEND .OUT("MOVEM"-"%TB,(%1)") .OUT("SETZ"-"%TB,")/
08600	 .CHECK 12 SET SETARRAY "(" INTEXPR "," #3"2" ARRAYSS INTEXPR
08700	 ")" #3"5" ARRAYSS ":=" REFEXPR ARRAYEND .OUT("MOVEM"-"%TB,(%1)")
08800	 .OUT("SETZ"-"%TB,"));
08900	
09000	SUBSTR: ^1 .LOOK BASE .OUT("SUBST"-"%"[*:=AC]*",$"B#"."S#^3*)
09100	 (.CHECK 22 SET .OUT("HLLZS"-"$"B#"."S#"+1(%B)") [STRTMP:=STRTMP-1]/.EMPTY);
09200	
09300	STRSSEND: ^1 .LOOK 
09400	 (.CHECK 10 SET #2"1" ARGGET .OUT("SUBSTS"-"%"[*:=AC]*",(%)") /
09500	 BASE .OUT("SUBSTS"-"%"[*:=AC]*",$"B#"."S#^3*));
09600	
09700	STRSTORE: #1"S." [*:=STRTMP] [STRTMP:=STRTMP+1] +%1 ^1 .ENTERC %1 .SET 2
09800	 .SET 1 .SET 15 .SET 13 .SET 22 .OUT("MOVE2M"-[*:=AC]"%"*",$"B#"."S#"(%B)") [AC:=AC-1];
09900	
10000	STRASSI: .PEEK(.ID .LOOK .CHECK 1 SET) .CHECK 25 CLEAR
10100	 (.CHECK 6 SET %1 "(" REFEXPR ")" REFSTORE
10200	  ("(" INTEXPR "," INTEXPR ")" ":=" STREXPR ^1 .LOOKC
10300	  .OUT("MOVE"-"%,$"B#"."S#"(%B)") [REFTMP:=REFTMP-1]
10400	  .OUT("SETZM"-"$"B#"."S#"(%B)") ^1 .LOOK
10500	  .OUT("SUBST"-"%0,$"B#"."S#"(%)") .OUT("SMOVE"-"%0,%2") /
10600	 ":=" STREXPR ^1 .LOOKC .OUT("MOVE"-"%,$"B#"."S#"(%B)")
10700	  .OUT("SETZM"-"$"B#"."S#"(%B)") ^1 .LOOK
10800	  (.CHECK 36 SET .OUT("MOVE2M"-"%0,$"B#"."S#"(%)") /
10900	   .OUT("SMOVEM"-"%0,$"B#"."S#"(%)")) ) /
11000	 .CHECK 13 SET %1 ("(" INTEXPR "," INTEXPR ")" ":=" STREXPR ^1 .LOOK
11100	  (.CHECK 10 SET #2"1" ARGGET / BASE .OUT("SUBST"-"%0,$"B#"."S#^3*))
11200	  .OUT("SMOVE"-"%0,%2") / ":=" STREXPR ^1 .LOOK
11300	  (.CHECK 10 SET #2"1" ARGGET / BASE
11400	   (.CHECK 36 SET .OUT("MOVE2M"-"%0,$"B#"."S#^3*) /
11500	    .OUT("SMOVEM"-"%0,$"B#"."S#^3*)) ) )/
11600	 (.CHECK 11 SET %1 [AC:=0] .OUT("SETZ"-"%0,")
11700	   "(" INTEXPR ")" #3"2" ARRAYSS /
11800	  .CHECK 12 SET %1 [AC:=0] .OUT("SETZ"-"%0,")
11900	   "(" INTEXPR "," #3"2" ARRAYSS INTEXPR ")" #3"5" ARRAYSS) [AC:=1]
12000	  ("(" INTEXPR "," INTEXPR ")" ":=" STREXPR [AC:=0] STRSSEND
12100	   .OUT("SUBST"-"%2,%0") .OUT("SMOVE"-"%2,%4") /
12200	  ":=" STREXPR [AC:=0] STRSSEND .OUT("SMOVE"-"%0,%2")) );
12300	
12400	DEFINE: .OUT("DEFINE"-"MOVE2(AC,MEM)<")
12500	 .OUT("MOVE"-"AC,MEM") .OUT("MOVE"-"1+AC,1+MEM>")
12600	 .OUT("DEFINE"-"MOVE2M(AC,MEM)<")
12700	 .OUT("MOVEM"-"AC,MEM") .OUT("MOVEM"-"1+AC,1+MEM>")
12800	 .OUT("DEFINE"-"BITS(BITST)<") .OUT(".TEMP=="-"0")
12900	 .OUT(".CNTR=="-"0") .OUT("IRPC"-"BITST,<")
13000	 .OUT(".TEMP=="-".TEMP*2+BITST") .OUT(".CNTR=="-".CNTR+1")
13100	 .OUT("IFE"-".CNTR-^D36,<") .OUT("EXP"-".TEMP")
13200	 .OUT(".TEMP=="-"0") .OUT(".CNTR=="-"0>>")
13300	 .OUT("IFN"-".CNTR,<") .OUT("EXP"-"<.TEMP>_<^D36-.CNTR>>>")
13400	 .OUT("OPDEF"-"CSTER"-"[BYTE (9) 1 (4) 1]")
13500	 .OUT("OPDEF"-"CSTNR"-"[BYTE (9) 2 (4) 1]")
13600	 .OUT("OPDEF"-"CSTLR"-"[BYTE (9) 3 (4) 1]")
13700	 .OUT("OPDEF"-"CSTLER"-"[BYTE (9) 4 (4) 1]")
13800	 .OUT("OPDEF"-"CSTGR"-"[BYTE (9) 5 (4) 1]")
13900	 .OUT("OPDEF"-"CSTGER"-"[BYTE (9) 6 (4) 1]")
14000	 .OUT("OPDEF"-"SMOVE"-"[BYTE (9) 7 (4) 1]")
14100	 .OUT("OPDEF"-"SMOVEM"-"[BYTE (9) 7]")
14200	 .OUT("OPDEF"-"SUBST"-"[BYTE (9) 10]")
14300	 .OUT("OPDEF"-"SUBSTS"-"[BYTE (9) 10 (4) 1]")
14400	 .OUT("OPDEF"-"ARECD"-"[BYTE (9) 11]")
14500	 .OUT("OPDEF"-"AARRY"-"[BYTE (9) 12]")
14600	 .OUT("OPDEF"-"RARRY"-"[BYTE (9) 13]")
14700	 .OUT("OPDEF"-"ASTRA"-"[BYTE (9) 14]")
14800	 .OUT("OPDEF"-"IS"-"[BYTE (9) 26]")
14900	 .OUT("OPDEF"-"SUBSC"-"[BYTE (9) 36]")
15000	 .OUT("OPDEF"-"ASTRG"-"[BYTE (9) 37 (4) 0]")
15100	 .OUT("OPDEF"-"PROC"-"[BYTE (9) 37 (4) 1]")
15200	 .OUT("OPDEF"-"BLOCK"-"[BYTE (9) 37 (4) 2]")
15300	 .OUT("OPDEF"-"ERROR"-"[BYTE (9) 37 (4) 13]")
15400	 .OUT("OPDEF"-"RESET"-"[BYTE (9) 37 (4) 17]")
15500	 .OUT("OPDEF"-"ERROR"-"[BYTE (9) 37 (4) 13]")
15600	 .OUT("OPDEF"-"READV"-"[BYTE (9) 27 (4) 1]")
15700	 .OUT("OPDEF"-"WRITE"-"[BYTE (9) 30]")
15800	 .OUT("OPDEF"-"CLRBK"-"[BYTE (9) 37 (4) 14]")
15900	 .OUT("OPDEF"-"BKNORM"-"[BYTE (9) 33]")
16000	 .OUT("OPDEF"-"BKIGNR"-"[BYTE (9) 34]")
16100	 .OUT("OPDEF"-"BKKEEP"-"[BYTE (9) 33 (4) 1]")
16200	 .OUT("OPDEF"-"BKLEAV"-"[BYTE (9) 34 (4) 1]")
16300	 .OUT("OPDEF"-"GETBK"-"[BYTE (9) 35]")
16400	 .OUT("OPDEF"-"OPENI"-"[BYTE (9) 25]")
16500	 .OUT("OPDEF"-"OPENO"-"[BYTE (9) 25 (4) 1]")
16600	 .OUT("OPDEF"-"CLOSEF"-"[BYTE (9) 37 (4) 10]")
16700	 .OUT("OPDEF"-"EFILE"-"[BYTE (9) 37 (4) 11]")
16800	 .OUT("OPDEF"-"GETLN"-"[BYTE (9) 31]")
16900	 .OUT("OPDEF"-"PUTLN"-"[BYTE (9) 32]")
17000	 .OUT("OPDEF"-"CALLUO"-"[BYTE (9) 37 (4) 12]")
17100	 .OUT("%0="-"0") .OUT("%1="-"1") .OUT("%2="-"2") .OUT("%3="-"3")
17200	 .OUT("%4="-"4") .OUT("%5="-"5") .OUT("%6="-"6") .OUT("%7="-"7")
17300	 .OUT("%="-"12") .OUT("%AL="-"13") .OUT("%T="-"14") .OUT("%TB="-"15")
17400	 .OUT("%B="-"16") .OUT("%P="-"17") .OUT("MLON") .OUT("SALL")
17500	 .OUT("EXTERN"-"%ENTRY,%STAT,%OPENT,%STRIN,%INTST,%INTBI,%BITIN");
17600	
17700	.END