-- file: WeaveParse2.mesa -- Pascal-to-Mesa translator output, translated at September 23, 1986 1:27:38 pm PDT DIRECTORY PascalBasic, PascalWizardFiles, WeaveProcs, WeaveVars; WeaveParse2: PROGRAM IMPORTS PascalWizardFiles, WeaveProcs, WeaveVars EXPORTS WeaveProcs = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, WeaveProcs, WeaveVars; --141:----PROCEDURE PRINT←CAT(C:EIGHT←BITS); -- BEGIN CASE C OF 1:WRITE(TERM←OUT,'simp');2:WRITE(TERM←OUT,'math'); -- 3:WRITE(TERM←OUT,'intro');4:WRITE(TERM←OUT,'open'); -- 5:WRITE(TERM←OUT,'beginning');6:WRITE(TERM←OUT,'close'); -- 7:WRITE(TERM←OUT,'alpha');8:WRITE(TERM←OUT,'omega'); -- 9:WRITE(TERM←OUT,'semi');10:WRITE(TERM←OUT,'terminator'); -- 11:WRITE(TERM←OUT,'stmt');12:WRITE(TERM←OUT,'cond'); -- 13:WRITE(TERM←OUT,'clause');14:WRITE(TERM←OUT,'colon'); -- 15:WRITE(TERM←OUT,'exp');16:WRITE(TERM←OUT,'proc'); -- 17:WRITE(TERM←OUT,'casehead');18:WRITE(TERM←OUT,'recordhead'); -- 19:WRITE(TERM←OUT,'varhead');20:WRITE(TERM←OUT,'elsie'); -- 21:WRITE(TERM←OUT,'casey');22:WRITE(TERM←OUT,'module'); -- OTHERS:WRITE(TERM←OUT,'UNKNOWN')END;END;----:141----147: --PROCEDURE PRINT←TEXT(P:TEXT←POINTER);VAR J:0..MAX←TOKS;R:0..10239; -- BEGIN IF P>=TEXT←PTR THEN WRITE(TERM←OUT,'BAD')ELSE FOR J:=TOK←START[P] -- TO TOK←START[P+1]-1 DO BEGIN R:=TOK←MEM[J]MOD 10240; -- CASE TOK←MEM[J]DIV 10240 OF 1:BEGIN WRITE(TERM←OUT,'\\',XCHR[123]); -- PRINT←ID(R);WRITE(TERM←OUT,XCHR[125]);END; -- 2:BEGIN WRITE(TERM←OUT,'\&',XCHR[123]);PRINT←ID(R); -- WRITE(TERM←OUT,XCHR[125]);END;3:BEGIN WRITE(TERM←OUT,'<');PRINT←ID(R); -- WRITE(TERM←OUT,'>');END;4:WRITE(TERM←OUT,'[[',R:1,']]'); -- 5:WRITE(TERM←OUT,'|[[',R:1,']]|'); -- OTHERS:[148:]CASE R OF 131:WRITE(TERM←OUT,'\mathbin',XCHR[123]); -- 132:WRITE(TERM←OUT,'\mathrel',XCHR[123]); -- 133:WRITE(TERM←OUT,'\mathop',XCHR[123]);134:WRITE(TERM←OUT,'[ccancel]'); -- 135:WRITE(TERM←OUT,'[cancel]');136:WRITE(TERM←OUT,'[indent]'); -- 137:WRITE(TERM←OUT,'[outdent]');139:WRITE(TERM←OUT,'[backup]'); -- 138:WRITE(TERM←OUT,'[opt]');140:WRITE(TERM←OUT,'[break]'); -- 141:WRITE(TERM←OUT,'[force]');142:WRITE(TERM←OUT,'[fforce]'); -- 143:WRITE(TERM←OUT,'[quit]');OTHERS:WRITE(TERM←OUT,XCHR[R])END[:148]END; -- END;END;----:147----173:-- Red: PROCEDURE[J: SixteenBits,K: EightBits, C: EightBits,D: PascalInteger] = BEGIN I:PascalInteger[0..MaxScraps]; Cat↑[J]←C; Trans↑[J]←TextPtr;TextPtr←TextPtr+1;TokStart↑[TextPtr]←TokPtr; IF INT[K]>1 THEN BEGIN FOR i:INT IN [ INT[ INT[J]+K ].. INT[LoPtr ]] DO I ← i; Cat↑[I-K+1]←Cat↑[I]; Trans↑[I-K+1]←Trans↑[I]; ENDLOOP;LoPtr←LoPtr-K+1; END;--174: IF Pp+D>=ScrapBase THEN Pp←Pp+D ELSE Pp←ScrapBase--:174--; END;--:173 --175:-- Sq: PROCEDURE[J: SixteenBits,K: EightBits,C: EightBits,D: PascalInteger] = BEGIN I:PascalInteger[0..MaxScraps]; IF K=1 THEN BEGIN Cat↑[J]←C;--174: IF Pp+D>=ScrapBase THEN Pp←Pp+D ELSE Pp←ScrapBase--:174--; END ELSE BEGIN FOR i:INT IN [ INT[J ].. INT[ INT[J]+K-1 ]] DO I ← i; TokMem↑[TokPtr]←40960+Trans↑ [I];TokPtr←TokPtr+1; ENDLOOP;Red[J,K,C,D]; END; END;--:175----179: --PROCEDURE PROD(N:EIGHT←BITS);VAR K:1..MAX←SCRAPS; -- BEGIN IF TRACING=2 THEN BEGIN BEGIN WRITELN(TERM←OUT); -- WRITE(TERM←OUT,N:1,':');END; -- FOR K:=SCRAP←BASE TO LO←PTR DO BEGIN IF K=PP THEN WRITE(TERM←OUT,'*') -- ELSE WRITE(TERM←OUT,' ');PRINT←CAT(CAT[K]);END; -- IF HI←PTR<=SCRAP←PTR THEN WRITE(TERM←OUT,'...');END;END;----:179----180: --151:-- FiveCases: PROCEDURE = BEGIN {SELECT Cat↑[Pp]FROM 5 =>--153: IF Cat↑[Pp+1]=6 THEN BEGIN IF(Cat↑[Pp+2]=10)OR (Cat↑[Pp+2]=11) THEN BEGIN Sq[ Pp,3,11,-2];--PROD(5)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+1]=11 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←140;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,5,-1]; --PROD(6)-- GOTO Label31; END--:153--;3 =>--160: IF Cat↑[Pp+1]=11 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←32;TokPtr←TokPtr+1; TokMem↑[TokPtr]←138;TokPtr←TokPtr+1;TokMem↑[TokPtr]←55; TokPtr←TokPtr+1;TokMem↑[TokPtr]←135;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,11,-2]; --PROD(17)-- GOTO Label31; END--:160--;2 =>--161: IF Cat↑[Pp+1]=6 THEN BEGIN TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←36;TokPtr←TokPtr+1;Red[Pp,1,11,-2];--PROD(18)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=14 THEN BEGIN TokMem↑[TokPtr]←141; TokPtr←TokPtr+1;TokMem↑[TokPtr]←139;TokPtr←TokPtr+1; TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,3,-3]; --PROD(19)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=2 THEN BEGIN Sq[Pp,2,2,-1]; --PROD(20)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=1 THEN BEGIN Sq[Pp,2,2,-1]; --PROD(21)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=11 THEN BEGIN TokMem↑[TokPtr]←36; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←36;TokPtr←TokPtr+1;TokMem↑[TokPtr]←136; TokPtr←TokPtr+1;TokMem↑[TokPtr]←140;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1;TokMem↑[TokPtr]←137; TokPtr←TokPtr+1;TokMem↑[TokPtr]←141;TokPtr←TokPtr+1; Red[Pp,2,11,-2];--PROD(22)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=10 THEN BEGIN TokMem↑[TokPtr]←36; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,11,-2]; --PROD(23)-- GOTO Label31; END--:161--;4 =>--163: IF(Cat↑[Pp+1]=17)AND (Cat↑[Pp+2]=6) THEN BEGIN TokMem↑[TokPtr]←40960+Trans ↑[Pp];TokPtr←TokPtr+1;TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1;TokMem↑[TokPtr]←137; TokPtr←TokPtr+1;TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1;Red[Pp,3,2,-1]; --PROD(26)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=6 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←92;TokPtr←TokPtr+1; TokMem↑[TokPtr]←44;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,2,-1]; --PROD(27)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=2 THEN--164: BEGIN IF(Cat↑[Pp+2]=17)AND (Cat↑[Pp+3]=6) THEN BEGIN TokMem↑[TokPtr]← 40960+Trans↑[Pp];TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+1]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1;TokMem↑[TokPtr]←137; TokPtr←TokPtr+1;TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+3];TokPtr←TokPtr+1;Red[Pp,4,2,-1]; --PROD(28)-- GOTO Label31; END ELSE IF Cat↑[Pp+2]=6 THEN BEGIN Sq[Pp,3,2,-1]; --PROD(29)-- GOTO Label31; END ELSE IF Cat↑[Pp+2]=14 THEN BEGIN Sq[Pp+1,2,2,0]; --PROD(30)-- GOTO Label31; END ELSE IF Cat↑[Pp+2]=16 THEN BEGIN IF Cat↑[Pp+3]=3 THEN BEGIN TokMem↑ [TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;TokMem↑[TokPtr]←133; TokPtr←TokPtr+1;TokMem↑[TokPtr]←135;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1; TokMem↑[TokPtr]←125;TokPtr←TokPtr+1;Red[Pp+1,3,2,0];--PROD(31)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+2]=9 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp+1]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+2]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←92;TokPtr←TokPtr+1; TokMem↑[TokPtr]←44;TokPtr←TokPtr+1;TokMem↑[TokPtr]←138; TokPtr←TokPtr+1;TokMem↑[TokPtr]←53;TokPtr←TokPtr+1; Red[Pp+1,2,2,0];--PROD(32)-- GOTO Label31; END ELSE IF Cat↑[Pp+2]=19 THEN BEGIN IF Cat↑[Pp+3]=3 THEN BEGIN TokMem↑ [TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;TokMem↑[TokPtr]←133; TokPtr←TokPtr+1;TokMem↑[TokPtr]←135;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1; TokMem↑[TokPtr]←125;TokPtr←TokPtr+1;Red[Pp+1,3,2,0];--PROD(31)-- GOTO Label31; END; END; END--:164 ELSE IF Cat↑[Pp+1]=16 THEN BEGIN IF Cat↑[Pp+2]=3 THEN BEGIN TokMem↑ [TokPtr]←133;TokPtr←TokPtr+1;TokMem↑[TokPtr]←135; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+1]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←125;TokPtr←TokPtr+1; Red[Pp+1,2,2,0];--PROD(34)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+1]=1 THEN BEGIN Sq[Pp+1,1,2,0];--PROD(35)-- GOTO Label31; END ELSE IF(Cat↑[Pp+1]=11)AND (Cat↑[Pp+2]=6) THEN BEGIN TokMem↑[TokPtr]← 40960+Trans↑[Pp];TokPtr←TokPtr+1;TokMem↑[TokPtr]←36; TokPtr←TokPtr+1;TokMem↑[TokPtr]←135;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1;TokMem↑[TokPtr]←36; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+2]; TokPtr←TokPtr+1;Red[Pp,3,2,-1];--PROD(36)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=19 THEN BEGIN IF Cat↑[Pp+2]=3 THEN BEGIN TokMem↑ [TokPtr]←133;TokPtr←TokPtr+1;TokMem↑[TokPtr]←135; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+1]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←125;TokPtr←TokPtr+1; Red[Pp+1,2,2,0];--PROD(37)-- GOTO Label31; END; END--:163--;1 =>--168: IF Cat↑[Pp+1]=6 THEN BEGIN Sq[Pp,1,11,-2];--PROD(43)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=14 THEN BEGIN TokMem↑[TokPtr]←141; TokPtr←TokPtr+1;TokMem↑[TokPtr]←139;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,3,-3]; --PROD(44)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=2 THEN BEGIN Sq[Pp,2,2,-1]; --PROD(45)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=22 THEN BEGIN Sq[Pp,2,22,0]; --PROD(46)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=1 THEN BEGIN Sq[Pp,2,1,-2]; --PROD(47)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=10 THEN BEGIN Sq[Pp,2,11,-2]; --PROD(48)-- GOTO Label31; END--:168--; ENDCASE => NULL;Pp←Pp+1;EXITS Label31 => NULL}; END; AlphaCases: PROCEDURE = BEGIN --152: {IF Cat↑[Pp+1]=2 THEN BEGIN IF Cat↑[Pp+2]=14 THEN BEGIN Sq[Pp+1,2,2,0]; --PROD(1)-- GOTO Label31; END ELSE IF Cat↑[Pp+2]=8 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←32;TokPtr←TokPtr+1; TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←36;TokPtr←TokPtr+1;TokMem↑[TokPtr]←32; TokPtr←TokPtr+1;TokMem↑[TokPtr]←136;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1;Red[Pp,3,13,-2]; --PROD(2)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+1]=8 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←32;TokPtr←TokPtr+1; TokMem↑[TokPtr]←136;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,13,-2]; --PROD(3)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=1 THEN BEGIN Sq[Pp+1,1,2,0]; --PROD(4)-- GOTO Label31; END--:152--;Pp←Pp+1;EXITS Label31 => NULL}; END;--:151 Translate: PROCEDURE RETURNS[TranslateResult: TextPointer] = BEGIN I:PascalInteger[1..MaxScraps]; J:PascalInteger[0..MaxScraps]; --176:-- Pp←ScrapBase;LoPtr←Pp-1;HiPtr←Pp;--183: --IF TRACING=2 THEN BEGIN BEGIN WRITELN(TERM←OUT); -- WRITE(TERM←OUT,'Tracing after l.',LINE:1,':');END; -- IF HISTORY=0 THEN HISTORY:=1;IF LOC>50 THEN BEGIN WRITE(TERM←OUT,'...'); -- FOR K:=LOC-50 TO LOC DO WRITE(TERM←OUT,XCHR[BUFFER[K-1]]); -- END ELSE FOR K:=1 TO LOC DO WRITE(TERM←OUT,XCHR[BUFFER[K-1]]);END----:183 {WHILE TRUE DO BEGIN--177: IF INT[LoPtr]<Pp+3 THEN BEGIN DO IF INT[HiPtr]<=ScrapPtr THEN BEGIN LoPtr ←LoPtr+1;Cat↑[LoPtr]←Cat↑[HiPtr];Trans↑[LoPtr]←Trans↑[HiPtr]; HiPtr←HiPtr+1; END; IF( INT[HiPtr]>ScrapPtr)OR (LoPtr=Pp+3) THEN EXIT; ENDLOOP; FOR i:INT IN [ INT[LoPtr+1 ].. INT[Pp+3 ]] DO I ← i; Cat↑[I]←0 ENDLOOP; END--:177--; IF( INT[TokPtr+8]>MaxToks)OR ( INT[TextPtr+4]>MaxTexts) THEN BEGIN--IF TOK←PTR> -- MAX←TOK←PTR THEN MAX←TOK←PTR:=TOK←PTR; -- IF TEXT←PTR>MAX←TXT←PTR THEN MAX←TXT←PTR:=TEXT←PTR; BEGIN PascalWriteLn[file: @TermOut]; {PascalWriteLongString[file: @TermOut, item: "! Sorry, "]; PascalWriteLongString[file: @TermOut, item: "token/text"]; PascalWriteLongString[file: @TermOut, item: " capacity exceeded"]};Error[]; History←3;JumpOut[]; END; END;IF INT[Pp]>LoPtr THEN GOTO Label30;--150: IF INT[Cat↑[Pp]]<=7 THEN IF INT[Cat↑[Pp]]<7 THEN FiveCases [] ELSE AlphaCases [] ELSE BEGIN {SELECT Cat↑[Pp]FROM 17 =>--154: IF Cat↑[Pp+1]=21 THEN BEGIN IF Cat↑[Pp+2]=13 THEN BEGIN TokMem↑[TokPtr]← 40960+Trans↑[Pp];TokPtr←TokPtr+1;TokMem↑[TokPtr]←137; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+1]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+2]; TokPtr←TokPtr+1;Red[Pp,3,17,0];--PROD(7)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+1]=6 THEN BEGIN IF Cat↑[Pp+2]=10 THEN BEGIN TokMem↑ [TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1;TokMem↑[TokPtr]←135; TokPtr←TokPtr+1;TokMem↑[TokPtr]←137;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1;Red[Pp,3,11,-2]; --PROD(8)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+1]=11 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←141;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,17,0]; --PROD(9)-- GOTO Label31; END--:154--;21 =>--155: IF Cat↑[Pp+1]=13 THEN BEGIN Sq[Pp,2,17,0];--PROD(10)-- GOTO Label31; END--:155--; 13 =>--156:--IF Cat↑[Pp+1]=11 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←140;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1;TokMem↑[TokPtr]←137; TokPtr←TokPtr+1;TokMem↑[TokPtr]←141;TokPtr←TokPtr+1; Red[Pp,2,11,-2];--PROD(11)-- GOTO Label31; END--:156--;12 =>--157: IF(Cat↑[Pp+1]=13)AND (Cat↑[Pp+2]=11) THEN IF Cat↑[Pp+3]=20 THEN BEGIN TokMem ↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←140;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+3];TokPtr←TokPtr+1; TokMem↑[TokPtr]←32;TokPtr←TokPtr+1;TokMem↑[TokPtr]←135; TokPtr←TokPtr+1;Red[Pp,4,13,-2];--PROD(12)-- GOTO Label31; END ELSE BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←140;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1;TokMem↑[TokPtr]←137; TokPtr←TokPtr+1;TokMem↑[TokPtr]←141;TokPtr←TokPtr+1; Red[Pp,3,11,-2];--PROD(13)-- GOTO Label31; END--:157--;20 =>--158: BEGIN Sq[Pp,1,3,-3];--PROD(14)-- GOTO Label31; END--:158--;15 =>--159: IF Cat↑[Pp+1]=2 THEN BEGIN IF Cat↑[Pp+2]=1 THEN IF Cat↑[Pp+3]#1 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1; TokMem↑[TokPtr]←125;TokPtr←TokPtr+1;Red[Pp,3,2,-1];--PROD(15)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+1]=1 THEN IF Cat↑[Pp+2]#1 THEN BEGIN TokMem↑[TokPtr] ←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1; TokMem↑[TokPtr]←125;TokPtr←TokPtr+1;Red[Pp,2,2,-1];--PROD(16)-- GOTO Label31; END--:159--;22 =>--162: IF(Cat↑[Pp+1]=10)OR (Cat↑[Pp+1]=9) THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑ [Pp];TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+1]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←141;TokPtr←TokPtr+1; Red[Pp,2,11,-2];--PROD(24)-- GOTO Label31; END ELSE BEGIN Sq[Pp,1,1,-2]; --PROD(25)-- GOTO Label31; END--:162--;16 =>--165: IF Cat↑[Pp+1]=5 THEN BEGIN IF(Cat↑[Pp+2]=6)AND (Cat↑[Pp+3]=10) THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1;TokMem↑[TokPtr]←137; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+1]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+2]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+3]; TokPtr←TokPtr+1;Red[Pp,4,11,-2];--PROD(38)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+1]=11 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←140;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,16,-2]; --PROD(39)-- GOTO Label31; END--:165--;18 =>--166: IF(Cat↑[Pp+1]=3)AND (Cat↑[Pp+2]=21) THEN BEGIN TokMem↑[TokPtr]←40960+Trans ↑[Pp];TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+1]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←32;TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1;Red[Pp,3,21,-2]; --PROD(40)-- GOTO Label31; END ELSE BEGIN TokMem↑[TokPtr]←136; TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp];TokPtr←TokPtr+1; TokMem↑[TokPtr]←135;TokPtr←TokPtr+1;Red[Pp,1,17,0];--PROD(41)-- GOTO Label31; END--:166--;9 =>--167:--BEGIN Sq[Pp,1,10,-3];--PROD(42)-- GOTO Label31; END--:167--;11 =>--169: IF Cat↑[Pp+1]=11 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←140;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,11,-2]; --PROD(49)-- GOTO Label31; END--:169--;10 =>--170:--BEGIN Sq[Pp,1,11,-2];--PROD(50)-- GOTO Label31; END--:170--;19 =>--171:--IF Cat↑[Pp+1]=5 THEN BEGIN Sq[Pp,1,11,-2]; --PROD(51)-- GOTO Label31; END ELSE IF Cat↑[Pp+1]=2 THEN BEGIN IF Cat↑[Pp+2]=14 THEN BEGIN TokMem↑ [TokPtr]←36;TokPtr←TokPtr+1;TokMem↑[TokPtr]←40960+Trans↑[Pp+1]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+2];TokPtr←TokPtr+1;Red[Pp+1,2,3,1]; --PROD(52)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+1]=1 THEN BEGIN IF Cat↑[Pp+2]=14 THEN BEGIN Sq[Pp+1,2, 3,1];--PROD(53)-- GOTO Label31; END; END ELSE IF Cat↑[Pp+1]=11 THEN BEGIN TokMem↑[TokPtr]←40960+Trans↑[Pp]; TokPtr←TokPtr+1;TokMem↑[TokPtr]←140;TokPtr←TokPtr+1; TokMem↑[TokPtr]←40960+Trans↑[Pp+1];TokPtr←TokPtr+1;Red[Pp,2,19,-2]; --PROD(54)-- GOTO Label31; END--:171--; ENDCASE => NULL;Pp←Pp+1;EXITS Label31 => NULL}; END--:150--; END ENDLOOP ; EXITS Label30 => NULL};--:176--IF(LoPtr=ScrapBase)AND (Cat↑[LoPtr]#2) THEN TranslateResult←Trans↑[LoPtr] ELSE--181:--BEGIN--182: --IF(LO←PTR>SCRAP←BASE)AND(TRACING=1)THEN BEGIN BEGIN WRITELN(TERM←OUT); -- WRITE(TERM←OUT,'Irreducible scrap sequence in section ',MODULE←COUNT:1); -- END;WRITELN(TERM←OUT,':');IF HISTORY=0 THEN HISTORY:=1; -- FOR J:=SCRAP←BASE TO LO←PTR DO BEGIN WRITE(TERM←OUT,' '); -- PRINT←CAT(CAT[J]);END;END;----:182-- FOR i:INT IN [ INT[ScrapBase ].. INT[LoPtr ]] DO J ← i; IF J#ScrapBase THEN BEGIN TokMem ↑[TokPtr]←32;TokPtr←TokPtr+1; END; IF Cat↑[J]=2 THEN BEGIN TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; END; TokMem↑[TokPtr]←40960+Trans↑[J];TokPtr←TokPtr+1; IF Cat↑[J]=2 THEN BEGIN TokMem↑[TokPtr]←36;TokPtr←TokPtr+1; END; IF INT[TokPtr+6]>MaxToks THEN BEGIN PascalWriteLn[file: @TermOut]; {PascalWriteLongString[file: @TermOut, item: "! Sorry, "]; PascalWriteLongString[file: @TermOut, item: "token"]; PascalWriteLongString[file: @TermOut, item: " capacity exceeded"]};Error[]; History←3;JumpOut[]; END; ENDLOOP;TextPtr←TextPtr+1; TokStart↑[TextPtr]←TokPtr;TranslateResult←TextPtr-1; END--:181--; END;--:180 --184:----196:-- AppComment: PROCEDURE = BEGIN TextPtr←TextPtr+1; TokStart↑[TextPtr]←TokPtr; IF( INT[ScrapPtr]<ScrapBase)OR ( INT[Cat↑[ScrapPtr]]<8)OR ( INT[Cat↑[ScrapPtr]]>10) THEN BEGIN ScrapPtr←ScrapPtr+1;Cat↑[ScrapPtr]←10;Trans↑[ScrapPtr]←0; END ELSE BEGIN TokMem↑[TokPtr]←40960+Trans↑[ScrapPtr]; TokPtr←TokPtr+1; END;TokMem↑[TokPtr]←TextPtr+40959; TokPtr←TokPtr+1;Trans↑[ScrapPtr]←TextPtr;TextPtr←TextPtr+1; TokStart↑[TextPtr]←TokPtr; END;--:196----197:-- AppOctal: PROCEDURE = BEGIN TokMem↑[TokPtr]←92;TokPtr←TokPtr+1;TokMem↑[TokPtr]←79; TokPtr←TokPtr+1;TokMem↑[TokPtr]←123;TokPtr←TokPtr+1; WHILE( INT[Buffer↑[Loc]]>=48)AND ( INT[Buffer↑[Loc]]<=55)DO BEGIN BEGIN IF INT[TokPtr+2]>MaxToks THEN BEGIN PascalWriteLn[file: @TermOut]; {PascalWriteLongString[file: @TermOut, item: "! Sorry, "]; PascalWriteLongString[file: @TermOut, item: "token"]; PascalWriteLongString[file: @TermOut, item: " capacity exceeded"]};Error[]; History←3;JumpOut[]; END;TokMem↑[TokPtr]←Buffer↑[Loc]; TokPtr←TokPtr+1; END;Loc←Loc+1; END ENDLOOP ;BEGIN TokMem↑[TokPtr]←125; TokPtr←TokPtr+1;ScrapPtr←ScrapPtr+1;Cat↑[ScrapPtr]←1; Trans↑[ScrapPtr]←TextPtr;TextPtr←TextPtr+1; TokStart↑[TextPtr]←TokPtr; END; END; AppHex: PROCEDURE = BEGIN TokMem↑[TokPtr]←92;TokPtr←TokPtr+1;TokMem↑[TokPtr]←72; TokPtr←TokPtr+1;TokMem↑[TokPtr]←123;TokPtr←TokPtr+1; WHILE(( INT[Buffer↑[Loc]]>=48)AND ( INT[Buffer↑[Loc]]<=57))OR (( INT[Buffer↑[Loc]]>=65)AND ( INT[Buffer↑[Loc]]<=70))DO BEGIN BEGIN IF INT[TokPtr+2]>MaxToks THEN BEGIN PascalWriteLn[file: @TermOut];{PascalWriteLongString[file: @TermOut, item: "! Sorry, "]; PascalWriteLongString[file: @TermOut, item: "token"]; PascalWriteLongString[file: @TermOut, item: " capacity exceeded"]}; Error[];History←3;JumpOut[]; END;TokMem↑[TokPtr]←Buffer↑[Loc]; TokPtr←TokPtr+1; END;Loc←Loc+1; END ENDLOOP ;BEGIN TokMem↑[TokPtr]←125; TokPtr←TokPtr+1;ScrapPtr←ScrapPtr+1;Cat↑[ScrapPtr]←1; Trans↑[ScrapPtr]←TextPtr;TextPtr←TextPtr+1; TokStart↑[TextPtr]←TokPtr; END; END;--:197----187:-- END.