{2:}{4:}{$C-,A+,D-}{[$C+,D+]}{:4} PROGRAM WEAVE(WEB←FILE,CHANGE←FILE,TEX←FILE);LABEL 9999;CONST{8:} MAX←BYTES=45000;MAX←NAMES=5000;MAX←MODULES=2000;HASH←SIZE=353; BUF←SIZE=5000;LONGEST←NAME=400;LONG←BUF←SIZE=5400;LINE←LENGTH=80; MAX←REFS=25000;MAX←TOKS=20000;MAX←TEXTS=2000;MAX←SCRAPS=1000; STACK←SIZE=200;{:8}TYPE{11:}ASCII←CODE=0..127;{:11}{12:} TEXT←FILE=PACKED FILE OF CHAR;{:12}{36:}EIGHT←BITS=0..255; SIXTEEN←BITS=0..65535;{:36}{38:}NAME←POINTER=0..MAX←NAMES;{:38}{47:} XREF←NUMBER=0..MAX←REFS;{:47}{48:} XMEM←RECORD=PACKED RECORD NUM←FIELD:SIXTEEN←BITS; XLINK←FIELD:SIXTEEN←BITS;END;{:48}{53:}TEXT←POINTER=0..MAX←TEXTS;{:53} {202:}MODE=0..1;OUTPUT←STATE=RECORD END←FIELD:SIXTEEN←BITS; TOK←FIELD:SIXTEEN←BITS;MODE←FIELD:MODE;END;{:202}VAR{9:}HISTORY:0..3; {:9}{13:}XORD:ARRAY[CHAR]OF ASCII←CODE;XCHR:ARRAY[ASCII←CODE]OF CHAR; {:13}{20:}TERM←OUT:TEXT←FILE;{:20}{23:}WEB←FILE:TEXT←FILE; CHANGE←FILE:TEXT←FILE;{:23}{25:}TEX←FILE:TEXT←FILE;{:25}{27:} BUFFER:ARRAY[0..LONG←BUF←SIZE]OF ASCII←CODE;{:27}{29:}PHASE←ONE:BOOLEAN; PHASE←THREE:BOOLEAN;{:29}{37:} BYTE←MEM:PACKED ARRAY[0..1,0..MAX←BYTES]OF ASCII←CODE; BYTE←START:ARRAY[0..MAX←NAMES]OF SIXTEEN←BITS; LINK:ARRAY[0..MAX←NAMES]OF SIXTEEN←BITS; ILK:ARRAY[0..MAX←NAMES]OF SIXTEEN←BITS; XREF:ARRAY[0..MAX←NAMES]OF SIXTEEN←BITS;{:37}{39:}NAME←PTR:NAME←POINTER; BYTE←PTR:ARRAY[0..1]OF 0..MAX←BYTES;{:39}{45:} MODULE←COUNT:0..MAX←MODULES; CHANGED←MODULE:PACKED ARRAY[0..MAX←MODULES]OF BOOLEAN; CHANGE←EXISTS:BOOLEAN;{:45}{49:}XMEM:ARRAY[XREF←NUMBER]OF XMEM←RECORD; XREF←PTR:XREF←NUMBER;XREF←SWITCH,MOD←XREF←SWITCH:0..10240;{:49}{54:} TOK←MEM:PACKED ARRAY[0..MAX←TOKS]OF SIXTEEN←BITS; TOK←START:ARRAY[TEXT←POINTER]OF SIXTEEN←BITS;TEXT←PTR:TEXT←POINTER; TOK←PTR:0..MAX←TOKS;{MAX←TOK←PTR,MAX←TXT←PTR:0..MAX←TOKS;}{:54}{56:} ID←FIRST:0..LONG←BUF←SIZE;ID←LOC:0..LONG←BUF←SIZE; HASH:ARRAY[0..HASH←SIZE]OF SIXTEEN←BITS;{:56}{64:}CUR←NAME:NAME←POINTER; {:64}{66:}MOD←TEXT:ARRAY[0..LONGEST←NAME]OF ASCII←CODE;{:66}{72:} LINE:INTEGER;OTHER←LINE:INTEGER;TEMP←LINE:INTEGER; LIMIT:0..LONG←BUF←SIZE;LOC:0..LONG←BUF←SIZE;INPUT←HAS←ENDED:BOOLEAN; CHANGING:BOOLEAN;{:72}{74:} CHANGE←BUFFER:ARRAY[0..BUF←SIZE]OF ASCII←CODE;CHANGE←LIMIT:0..BUF←SIZE; {:74}{94:}CUR←MODULE:NAME←POINTER;SCANNING←HEX:BOOLEAN;{:94}{109:} NEXT←CONTROL:EIGHT←BITS;{:109}{115:}LHS,RHS:NAME←POINTER;{:115}{119:} CUR←XREF:XREF←NUMBER;{:119}{122:} OUT←BUF:ARRAY[0..LINE←LENGTH]OF ASCII←CODE;OUT←PTR:0..LINE←LENGTH; OUT←LINE:INTEGER;{:122}{130:}DIG:ARRAY[0..4]OF 0..9;{:130}{145:} CAT:ARRAY[0..MAX←SCRAPS]OF EIGHT←BITS; TRANS:ARRAY[0..MAX←SCRAPS]OF 0..10239;PP:0..MAX←SCRAPS; SCRAP←BASE:0..MAX←SCRAPS;SCRAP←PTR:0..MAX←SCRAPS;LO←PTR:0..MAX←SCRAPS; HI←PTR:0..MAX←SCRAPS;{MAX←SCR←PTR:0..MAX←SCRAPS;}{:145}{178:} {TRACING:0..2;}{:178}{203:}CUR←STATE:OUTPUT←STATE; STACK:ARRAY[1..STACK←SIZE]OF OUTPUT←STATE;STACK←PTR:0..STACK←SIZE; {MAX←STACK←PTR:0..STACK←SIZE;}{:203}{220:}SAVE←LINE:INTEGER; SAVE←PLACE:SIXTEEN←BITS;{:220}{230:}THIS←MODULE:NAME←POINTER;{:230} {235:}NEXT←XREF,THIS←XREF,FIRST←XREF,MID←XREF:XREF←NUMBER;{:235}{241:} K←MODULE:0..MAX←MODULES;{:241}{243:} BUCKET:ARRAY[ASCII←CODE]OF NAME←POINTER;NEXT←NAME:NAME←POINTER; C:ASCII←CODE;H:0..HASH←SIZE;BLINK:ARRAY[0..MAX←NAMES]OF SIXTEEN←BITS; {:243}{245:}CUR←DEPTH:EIGHT←BITS;CUR←BYTE:0..MAX←BYTES;CUR←BANK:0..1; CUR←VAL:SIXTEEN←BITS;{MAX←SORT←PTR:0..MAX←SCRAPS;}{:245}{247:} COLLATE:ARRAY[0..100]OF ASCII←CODE;{:247}{259:} {TROUBLE←SHOOTING:BOOLEAN;DDT:SIXTEEN←BITS;DD:SIXTEEN←BITS; DEBUG←CYCLE:INTEGER;DEBUG←SKIPPED:INTEGER;TERM←IN:TEXT←FILE;}{:259} {265:}PROCEDURE TTY←REWRITE(VAR F:TEXT←FILE);EXTERNAL; PROCEDURE FILE←RESET(VAR F:TEXT←FILE;EXT:ALFA);EXTERNAL; PROCEDURE FILE←REWRITE(VAR F:TEXT←FILE;EXT:ALFA);EXTERNAL; PROCEDURE FILE←CLOSE(VAR F:TEXT←FILE);EXTERNAL; FUNCTION FILE←GET←POS(VAR F:TEXT←FILE):INTEGER;EXTERNAL;{:265}{30:} {PROCEDURE DEBUG←HELP;FORWARD;}{:30}{31:}PROCEDURE ERROR; VAR K,L:0..LONG←BUF←SIZE;BEGIN{32:} BEGIN IF LOC>=LIMIT THEN L:=LIMIT ELSE L:=LOC; IF CHANGING THEN WRITELN(TERM←OUT,'. (change file pos:',FILE←GET←POS( CHANGE←FILE)-(LIMIT-L)-2:1,')')ELSE WRITELN(TERM←OUT,'. (pos:', FILE←GET←POS(WEB←FILE)-(LIMIT-L)-2:1,')'); FOR K:=1 TO L DO IF BUFFER[K-1]=9 THEN WRITE(TERM←OUT,' ')ELSE WRITE( TERM←OUT,XCHR[BUFFER[K-1]]);WRITELN(TERM←OUT); FOR K:=1 TO L DO WRITE(TERM←OUT,' '); FOR K:=L+1 TO LIMIT DO WRITE(TERM←OUT,XCHR[BUFFER[K-1]]); IF BUFFER[LIMIT]=124 THEN WRITE(TERM←OUT,XCHR[124]);WRITE(TERM←OUT,' '); END{:32};BREAK(TERM←OUT);HISTORY:=2;{DEBUG←SKIPPED:=DEBUG←CYCLE; DEBUG←HELP;}END;{:31}{33:}PROCEDURE JUMP←OUT;BEGIN GOTO 9999;END;{:33} PROCEDURE INITIALIZE;VAR{16:}I:0..255;{:16}{40:}WI:0..1;{:40}{57:} H:0..HASH←SIZE;{:57}{248:}C:ASCII←CODE;{:248}BEGIN{10:}HISTORY:=0;{:10} {14:}XCHR[32]:=' ';XCHR[33]:='!';XCHR[34]:='"';XCHR[35]:='#'; XCHR[36]:='$';XCHR[37]:='%';XCHR[38]:='&';XCHR[39]:='''';XCHR[40]:='('; XCHR[41]:=')';XCHR[42]:='*';XCHR[43]:='+';XCHR[44]:=',';XCHR[45]:='-'; XCHR[46]:='.';XCHR[47]:='/';XCHR[48]:='0';XCHR[49]:='1';XCHR[50]:='2'; XCHR[51]:='3';XCHR[52]:='4';XCHR[53]:='5';XCHR[54]:='6';XCHR[55]:='7'; XCHR[56]:='8';XCHR[57]:='9';XCHR[58]:=':';XCHR[59]:=';';XCHR[60]:='<'; XCHR[61]:='=';XCHR[62]:='>';XCHR[63]:='?';XCHR[64]:='@';XCHR[65]:='A'; XCHR[66]:='B';XCHR[67]:='C';XCHR[68]:='D';XCHR[69]:='E';XCHR[70]:='F'; XCHR[71]:='G';XCHR[72]:='H';XCHR[73]:='I';XCHR[74]:='J';XCHR[75]:='K'; XCHR[76]:='L';XCHR[77]:='M';XCHR[78]:='N';XCHR[79]:='O';XCHR[80]:='P'; XCHR[81]:='Q';XCHR[82]:='R';XCHR[83]:='S';XCHR[84]:='T';XCHR[85]:='U'; XCHR[86]:='V';XCHR[87]:='W';XCHR[88]:='X';XCHR[89]:='Y';XCHR[90]:='Z'; XCHR[91]:='[';XCHR[92]:='\';XCHR[93]:=']';XCHR[94]:='↑';XCHR[95]:='←'; XCHR[96]:='`';XCHR[97]:='a';XCHR[98]:='b';XCHR[99]:='c';XCHR[100]:='d'; XCHR[101]:='e';XCHR[102]:='f';XCHR[103]:='g';XCHR[104]:='h'; XCHR[105]:='i';XCHR[106]:='j';XCHR[107]:='k';XCHR[108]:='l'; XCHR[109]:='m';XCHR[110]:='n';XCHR[111]:='o';XCHR[112]:='p'; XCHR[113]:='q';XCHR[114]:='r';XCHR[115]:='s';XCHR[116]:='t'; XCHR[117]:='u';XCHR[118]:='v';XCHR[119]:='w';XCHR[120]:='x'; XCHR[121]:='y';XCHR[122]:='z';XCHR[123]:='{';XCHR[124]:='|'; XCHR[125]:='}';XCHR[126]:='~';XCHR[0]:=' ';XCHR[127]:=' ';{:14}{17:} FOR I:=1 TO 31 DO XCHR[I]:=CHR(I);{:17}{18:} FOR I:=0 TO 255 DO XORD[CHR(I)]:=32;FOR I:=1 TO 126 DO XORD[XCHR[I]]:=I; {:18}{21:}TTY←REWRITE(TERM←OUT);{:21}{26:} FILE←REWRITE(TEX←FILE,'tex ');{:26}{41:} FOR WI:=0 TO 1 DO BEGIN BYTE←START[WI]:=0;BYTE←PTR[WI]:=0;END; BYTE←START[2]:=0;NAME←PTR:=1;{:41}{43:}ILK[0]:=0;{:43}{50:}XREF←PTR:=0; XREF←SWITCH:=0;MOD←XREF←SWITCH:=0;XMEM[0].NUM←FIELD:=0;XREF[0]:=0;{:50} {55:}TOK←PTR:=1;TEXT←PTR:=1;TOK←START[0]:=1;TOK←START[1]:=1; {MAX←TOK←PTR:=1;MAX←TXT←PTR:=1;}{:55}{58:} FOR H:=0 TO HASH←SIZE-1 DO HASH[H]:=0;{:58}{95:}SCANNING←HEX:=FALSE; {:95}{103:}MOD←TEXT[0]:=32;{:103}{125:}OUT←PTR:=1;OUT←LINE:=1; OUT←BUF[1]:=99;WRITE(TEX←FILE,'\input webma');{:125}{127:} OUT←BUF[0]:=92;{:127}{146:}SCRAP←BASE:=1;SCRAP←PTR:=0;{MAX←SCR←PTR:=0;} {:146}{204:}{MAX←STACK←PTR:=0;}{:204}{246:}{MAX←SORT←PTR:=0;}{:246} {249:}COLLATE[0]:=0;COLLATE[1]:=32;FOR C:=1 TO 31 DO COLLATE[C+1]:=C; FOR C:=33 TO 47 DO COLLATE[C]:=C;FOR C:=58 TO 64 DO COLLATE[C-10]:=C; FOR C:=91 TO 94 DO COLLATE[C-36]:=C;COLLATE[59]:=96; FOR C:=123 TO 126 DO COLLATE[C-63]:=C;COLLATE[64]:=95; FOR C:=97 TO 122 DO COLLATE[C-32]:=C; FOR C:=48 TO 57 DO COLLATE[C+43]:=C;{:249}{260:}{TROUBLE←SHOOTING:=TRUE; DEBUG←CYCLE:=1;DEBUG←SKIPPED:=0;TRACING:=0;TROUBLE←SHOOTING:=FALSE; DEBUG←CYCLE:=99999;RESET(TERM←IN,'TTY:','/I');}{:260}END;{:2}{24:} PROCEDURE OPEN←INPUT;BEGIN FILE←RESET(WEB←FILE,'web '); FILE←RESET(CHANGE←FILE,'changes ');END;{:24}{28:} FUNCTION INPUT←LN(VAR F:TEXT←FILE):BOOLEAN;VAR FINAL←LIMIT:0..BUF←SIZE; BEGIN LIMIT:=0;FINAL←LIMIT:=0; IF EOF(F)THEN INPUT←LN:=FALSE ELSE BEGIN WHILE NOT EOLN(F)DO BEGIN BUFFER[LIMIT]:=XORD[F↑];GET(F);LIMIT:=LIMIT+1; IF BUFFER[LIMIT-1]<>32 THEN FINAL←LIMIT:=LIMIT; IF LIMIT=BUF←SIZE THEN BEGIN WHILE NOT EOLN(F)DO GET(F);LIMIT:=LIMIT-1; BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'! Input line too long');END; LOC:=0;ERROR;END;END;READLN(F);LIMIT:=FINAL←LIMIT;INPUT←LN:=TRUE;END; END;{:28}{44:}PROCEDURE PRINT←ID(P:NAME←POINTER);VAR K:0..MAX←BYTES; W:0..1; BEGIN IF P>=NAME←PTR THEN WRITE(TERM←OUT,'IMPOSSIBLE')ELSE BEGIN W:=P MOD 2; FOR K:=BYTE←START[P]TO BYTE←START[P+2]-1 DO WRITE(TERM←OUT,XCHR[BYTE←MEM [W,K]]);END;END;{:44}{51:}PROCEDURE NEW←XREF(P:NAME←POINTER);LABEL 10; VAR Q:XREF←NUMBER;M,N:SIXTEEN←BITS; BEGIN IF((ILK[P]>3)OR(BYTE←START[P]+1=BYTE←START[P+2]))AND(XREF←SWITCH=0 )THEN GOTO 10;M:=MODULE←COUNT+XREF←SWITCH;XREF←SWITCH:=0;Q:=XREF[P]; IF Q>0 THEN BEGIN N:=XMEM[Q].NUM←FIELD; IF(N=M)OR(N=M+10240)THEN GOTO 10 ELSE IF M=N+10240 THEN BEGIN XMEM[Q]. NUM←FIELD:=M;GOTO 10;END;END; IF XREF←PTR=MAX←REFS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','cross reference',' capacity exceeded'); ERROR;HISTORY:=3;JUMP←OUT;END ELSE BEGIN XREF←PTR:=XREF←PTR+1; XMEM[XREF←PTR].NUM←FIELD:=M;END;XMEM[XREF←PTR].XLINK←FIELD:=Q; XREF[P]:=XREF←PTR;10:END;{:51}{52:} PROCEDURE NEW←MOD←XREF(P:NAME←POINTER);VAR Q,R:XREF←NUMBER; BEGIN Q:=XREF[P];R:=0; IF Q>0 THEN BEGIN IF MOD←XREF←SWITCH=0 THEN WHILE XMEM[Q].NUM←FIELD>= 10240 DO BEGIN R:=Q;Q:=XMEM[Q].XLINK←FIELD; END ELSE IF XMEM[Q].NUM←FIELD>=10240 THEN BEGIN R:=Q; Q:=XMEM[Q].XLINK←FIELD;END;END; IF XREF←PTR=MAX←REFS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','cross reference',' capacity exceeded'); ERROR;HISTORY:=3;JUMP←OUT;END ELSE BEGIN XREF←PTR:=XREF←PTR+1; XMEM[XREF←PTR].NUM←FIELD:=MODULE←COUNT+MOD←XREF←SWITCH;END; XMEM[XREF←PTR].XLINK←FIELD:=Q;MOD←XREF←SWITCH:=0; IF R=0 THEN XREF[P]:=XREF←PTR ELSE XMEM[R].XLINK←FIELD:=XREF←PTR;END; {:52}{59:}FUNCTION ID←LOOKUP(T:EIGHT←BITS):NAME←POINTER;LABEL 31; VAR I:0..LONG←BUF←SIZE;H:0..HASH←SIZE;K:0..MAX←BYTES;W:0..1; L:0..LONG←BUF←SIZE;P:NAME←POINTER;BEGIN L:=ID←LOC-ID←FIRST;{60:} H:=BUFFER[ID←FIRST];I:=ID←FIRST+1; WHILE I<ID←LOC DO BEGIN H:=(H+H+BUFFER[I])MOD HASH←SIZE;I:=I+1;END{:60}; {61:}P:=HASH[H]; WHILE P<>0 DO BEGIN IF(BYTE←START[P+2]-BYTE←START[P]=L)AND((ILK[P]=T)OR( (T=0)AND(ILK[P]>3)))THEN{62:}BEGIN I:=ID←FIRST;K:=BYTE←START[P]; W:=P MOD 2;WHILE(I<ID←LOC)AND(BUFFER[I]=BYTE←MEM[W,K])DO BEGIN I:=I+1; K:=K+1;END;IF I=ID←LOC THEN GOTO 31;END{:62};P:=LINK[P];END;P:=NAME←PTR; LINK[P]:=HASH[H];HASH[H]:=P;31:{:61};IF P=NAME←PTR THEN{63:} BEGIN W:=NAME←PTR MOD 2; IF BYTE←PTR[W]+L>MAX←BYTES THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','byte memory',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END; IF NAME←PTR+2>MAX←NAMES THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','name',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;I:=ID←FIRST;K:=BYTE←PTR[W]; WHILE I<ID←LOC DO BEGIN BYTE←MEM[W,K]:=BUFFER[I];K:=K+1;I:=I+1;END; BYTE←PTR[W]:=K;BYTE←START[NAME←PTR+2]:=K;NAME←PTR:=NAME←PTR+1;ILK[P]:=T; XREF[P]:=0;END{:63};ID←LOOKUP:=P;END;{:59}{67:} FUNCTION MOD←LOOKUP(L:SIXTEEN←BITS):NAME←POINTER;LABEL 31;VAR C:0..4; J:0..LONGEST←NAME;K:0..MAX←BYTES;W:0..1;P:NAME←POINTER;Q:NAME←POINTER; BEGIN C:=2;Q:=0;P:=ILK[0];WHILE P<>0 DO BEGIN{69:} BEGIN K:=BYTE←START[P];W:=P MOD 2;C:=1;J:=1; WHILE(K<BYTE←START[P+2])AND(J<=L)AND(MOD←TEXT[J]=BYTE←MEM[W,K])DO BEGIN K:=K+1;J:=J+1;END; IF K=BYTE←START[P+2]THEN IF J>L THEN C:=1 ELSE C:=4 ELSE IF J>L THEN C:= 3 ELSE IF MOD←TEXT[J]<BYTE←MEM[W,K]THEN C:=0 ELSE C:=2;END{:69};Q:=P; IF C=0 THEN P:=LINK[Q]ELSE IF C=2 THEN P:=ILK[Q]ELSE GOTO 31;END;{68:} W:=NAME←PTR MOD 2;K:=BYTE←PTR[W]; IF K+L>MAX←BYTES THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','byte memory',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END; IF NAME←PTR>MAX←NAMES-2 THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','name',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;P:=NAME←PTR; IF C=0 THEN LINK[Q]:=P ELSE ILK[Q]:=P;LINK[P]:=0;ILK[P]:=0;XREF[P]:=0; C:=1;FOR J:=1 TO L DO BYTE←MEM[W,K+J-1]:=MOD←TEXT[J];BYTE←PTR[W]:=K+L; BYTE←START[NAME←PTR+2]:=K+L;NAME←PTR:=NAME←PTR+1;{:68}; 31:IF C<>1 THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT );WRITE(TERM←OUT,'! Incompatible section names');ERROR;END;END;P:=0;END; MOD←LOOKUP:=P;END;{:67}{70:} FUNCTION PREFIX←LOOKUP(L:SIXTEEN←BITS):NAME←POINTER;VAR C:0..4; COUNT:0..MAX←NAMES;J:0..LONGEST←NAME;K:0..MAX←BYTES;W:0..1; P:NAME←POINTER;Q:NAME←POINTER;R:NAME←POINTER;BEGIN Q:=0;P:=ILK[0]; COUNT:=0;R:=0;WHILE P<>0 DO BEGIN{69:}BEGIN K:=BYTE←START[P];W:=P MOD 2; C:=1;J:=1; WHILE(K<BYTE←START[P+2])AND(J<=L)AND(MOD←TEXT[J]=BYTE←MEM[W,K])DO BEGIN K:=K+1;J:=J+1;END; IF K=BYTE←START[P+2]THEN IF J>L THEN C:=1 ELSE C:=4 ELSE IF J>L THEN C:= 3 ELSE IF MOD←TEXT[J]<BYTE←MEM[W,K]THEN C:=0 ELSE C:=2;END{:69}; IF C=0 THEN P:=LINK[P]ELSE IF C=2 THEN P:=ILK[P]ELSE BEGIN R:=P; COUNT:=COUNT+1;Q:=ILK[P];P:=LINK[P];END;IF P=0 THEN BEGIN P:=Q;Q:=0;END; END;IF COUNT<>1 THEN IF COUNT=0 THEN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'! Name does not match');ERROR;END; END ELSE BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Ambiguous prefix');ERROR;END;END;PREFIX←LOOKUP:=R;END; {:70}{75:}FUNCTION LINES←DONT←MATCH:BOOLEAN;LABEL 10;VAR K:0..BUF←SIZE; BEGIN LINES←DONT←MATCH:=TRUE;IF CHANGE←LIMIT<>LIMIT THEN GOTO 10; IF LIMIT>0 THEN FOR K:=0 TO LIMIT-1 DO IF CHANGE←BUFFER[K]<>BUFFER[K] THEN GOTO 10;LINES←DONT←MATCH:=FALSE;10:END;{:75}{76:} PROCEDURE PRIME←THE←CHANGE←BUFFER;LABEL 22,30,10;VAR K:0..BUF←SIZE; BEGIN CHANGE←LIMIT:=0;{77:}WHILE TRUE DO BEGIN LINE:=LINE+1; IF NOT INPUT←LN(CHANGE←FILE)THEN GOTO 10;IF LIMIT<2 THEN GOTO 22; IF BUFFER[0]<>64 THEN GOTO 22; IF(BUFFER[1]>=88)AND(BUFFER[1]<=90)THEN BUFFER[1]:=BUFFER[1]+32; IF BUFFER[1]=120 THEN GOTO 30; IF(BUFFER[1]=121)OR(BUFFER[1]=122)THEN BEGIN LOC:=2; BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Where is the matching @x?');ERROR;END;END;END;22:END; 30:{:77};{78:}REPEAT LINE:=LINE+1; IF NOT INPUT←LN(CHANGE←FILE)THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'! Change file ended after @x');ERROR; END;END;GOTO 10;END;UNTIL LIMIT>0;{:78};{79:}BEGIN CHANGE←LIMIT:=LIMIT; FOR K:=0 TO LIMIT DO CHANGE←BUFFER[K]:=BUFFER[K];END{:79};10:END;{:76} {80:}PROCEDURE CHECK←CHANGE;LABEL 10;VAR N:INTEGER;K:0..BUF←SIZE; BEGIN IF LINES←DONT←MATCH THEN GOTO 10;N:=0; WHILE TRUE DO BEGIN CHANGING:=NOT CHANGING;TEMP←LINE:=OTHER←LINE; OTHER←LINE:=LINE;LINE:=TEMP←LINE;LINE:=LINE+1; IF NOT INPUT←LN(CHANGE←FILE)THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'! Change file ended before @y');ERROR; END;END;CHANGE←LIMIT:=0;CHANGING:=NOT CHANGING;TEMP←LINE:=OTHER←LINE; OTHER←LINE:=LINE;LINE:=TEMP←LINE;GOTO 10;END;{81:} IF LIMIT>1 THEN IF BUFFER[0]=64 THEN BEGIN IF(BUFFER[1]>=88)AND(BUFFER[1 ]<=90)THEN BUFFER[1]:=BUFFER[1]+32; IF(BUFFER[1]=120)OR(BUFFER[1]=122)THEN BEGIN LOC:=2; BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Where is the matching @y?');ERROR;END;END; END ELSE IF BUFFER[1]=121 THEN BEGIN IF N>0 THEN BEGIN LOC:=2; BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Hmm... ',N:1,' of the preceding lines failed to match' );ERROR;END;END;END;GOTO 10;END;END{:81};{79:}BEGIN CHANGE←LIMIT:=LIMIT; FOR K:=0 TO LIMIT DO CHANGE←BUFFER[K]:=BUFFER[K];END{:79}; CHANGING:=NOT CHANGING;TEMP←LINE:=OTHER←LINE;OTHER←LINE:=LINE; LINE:=TEMP←LINE;LINE:=LINE+1; IF NOT INPUT←LN(WEB←FILE)THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'! WEB file ended during a change'); ERROR;END;END;INPUT←HAS←ENDED:=TRUE;GOTO 10;END; IF LINES←DONT←MATCH THEN N:=N+1;END;10:END;{:80}{82:} PROCEDURE RESET←INPUT;BEGIN OPEN←INPUT;LINE:=0;OTHER←LINE:=0; CHANGING:=TRUE;PRIME←THE←CHANGE←BUFFER;CHANGING:=NOT CHANGING; TEMP←LINE:=OTHER←LINE;OTHER←LINE:=LINE;LINE:=TEMP←LINE;LIMIT:=0;LOC:=1; BUFFER[0]:=32;INPUT←HAS←ENDED:=FALSE;END;{:82}{83:}PROCEDURE GET←LINE; LABEL 20; BEGIN 20:IF CHANGING THEN CHANGED←MODULE[MODULE←COUNT]:=TRUE ELSE{84:} BEGIN LINE:=LINE+1; IF NOT INPUT←LN(WEB←FILE)THEN INPUT←HAS←ENDED:=TRUE ELSE IF LIMIT= CHANGE←LIMIT THEN IF BUFFER[0]=CHANGE←BUFFER[0]THEN IF CHANGE←LIMIT>0 THEN CHECK←CHANGE;END{:84};IF CHANGING THEN BEGIN{85:} BEGIN LINE:=LINE+1; IF NOT INPUT←LN(CHANGE←FILE)THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'! Change file ended without @z'); ERROR;END;END;BUFFER[0]:=64;BUFFER[1]:=122;LIMIT:=2;END; IF LIMIT>1 THEN IF BUFFER[0]=64 THEN BEGIN IF(BUFFER[1]>=88)AND(BUFFER[1 ]<=90)THEN BUFFER[1]:=BUFFER[1]+32; IF(BUFFER[1]=120)OR(BUFFER[1]=121)THEN BEGIN LOC:=2; BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Where is the matching @z?');ERROR;END;END; END ELSE IF BUFFER[1]=122 THEN BEGIN PRIME←THE←CHANGE←BUFFER; CHANGING:=NOT CHANGING;TEMP←LINE:=OTHER←LINE;OTHER←LINE:=LINE; LINE:=TEMP←LINE;END;END;END{:85}; IF NOT CHANGING THEN BEGIN CHANGED←MODULE[MODULE←COUNT]:=TRUE;GOTO 20; END;END;LOC:=0;BUFFER[LIMIT]:=32;END;{:83}{88:} FUNCTION CONTROL←CODE(C:ASCII←CODE):EIGHT←BITS; BEGIN CASE C OF 64:CONTROL←CODE:=64;39:CONTROL←CODE:=12; 34:CONTROL←CODE:=13;36:CONTROL←CODE:=135;32,9,42:CONTROL←CODE:=147; 61:CONTROL←CODE:=2;92:CONTROL←CODE:=3;68,100:CONTROL←CODE:=144; 70,102:CONTROL←CODE:=143;123:CONTROL←CODE:=9;125:CONTROL←CODE:=10; 80,112:CONTROL←CODE:=145;38:CONTROL←CODE:=136;60:CONTROL←CODE:=146; 62:BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Extra @>');ERROR;END;END;CONTROL←CODE:=0;END; 84,116:CONTROL←CODE:=134;33:CONTROL←CODE:=126;63:CONTROL←CODE:=125; 94:CONTROL←CODE:=131;58:CONTROL←CODE:=132;46:CONTROL←CODE:=133; 44:CONTROL←CODE:=137;124:CONTROL←CODE:=138;47:CONTROL←CODE:=139; 35:CONTROL←CODE:=140;43:CONTROL←CODE:=141;59:CONTROL←CODE:=142;{89:} {48,49,50:BEGIN TRACING:=C-48;CONTROL←CODE:=0;END;}{:89} OTHERS:BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Unknown control code');ERROR;END;END;CONTROL←CODE:=0; END END;END;{:88}{90:}PROCEDURE SKIP←LIMBO;LABEL 10;VAR C:ASCII←CODE; BEGIN WHILE TRUE DO IF LOC>LIMIT THEN BEGIN GET←LINE; IF INPUT←HAS←ENDED THEN GOTO 10;END ELSE BEGIN BUFFER[LIMIT+1]:=64; WHILE BUFFER[LOC]<>64 DO LOC:=LOC+1;IF LOC<=LIMIT THEN BEGIN LOC:=LOC+2; C:=BUFFER[LOC-1];IF(C=32)OR(C=9)OR(C=42)THEN GOTO 10;END;END;10:END; {:90}{91:}FUNCTION SKIP←TEX:EIGHT←BITS;LABEL 30;VAR C:EIGHT←BITS; BEGIN WHILE TRUE DO BEGIN IF LOC>LIMIT THEN BEGIN GET←LINE; IF INPUT←HAS←ENDED THEN BEGIN C:=147;GOTO 30;END;END; BUFFER[LIMIT+1]:=64;REPEAT C:=BUFFER[LOC];LOC:=LOC+1; IF C=124 THEN GOTO 30;UNTIL C=64; IF LOC<=LIMIT THEN BEGIN C:=CONTROL←CODE(BUFFER[LOC]);LOC:=LOC+1; GOTO 30;END;END;30:SKIP←TEX:=C;END;{:91}{92:} FUNCTION SKIP←COMMENT(BAL:EIGHT←BITS):EIGHT←BITS;LABEL 30; VAR C:ASCII←CODE; BEGIN WHILE TRUE DO BEGIN IF LOC>LIMIT THEN BEGIN GET←LINE; IF INPUT←HAS←ENDED THEN BEGIN BAL:=0;GOTO 30;END;END;C:=BUFFER[LOC]; LOC:=LOC+1;IF C=124 THEN GOTO 30;{93:}IF C=64 THEN BEGIN C:=BUFFER[LOC]; IF(C<>32)AND(C<>9)AND(C<>42)THEN LOC:=LOC+1 ELSE BEGIN LOC:=LOC-1; BAL:=0;GOTO 30; END END ELSE IF(C=92)AND(BUFFER[LOC]<>64)THEN LOC:=LOC+1 ELSE IF C=123 THEN BAL:=BAL+1 ELSE IF C=125 THEN BEGIN BAL:=BAL-1; IF BAL=0 THEN GOTO 30;END{:93};END;30:SKIP←COMMENT:=BAL;END;{:92}{96:} FUNCTION GET←NEXT:EIGHT←BITS;LABEL 20,30,31;VAR C:EIGHT←BITS; D:EIGHT←BITS;J,K:0..LONGEST←NAME; BEGIN 20:IF LOC>LIMIT THEN BEGIN GET←LINE; IF INPUT←HAS←ENDED THEN BEGIN C:=147;GOTO 31;END;END;C:=BUFFER[LOC]; LOC:=LOC+1;IF SCANNING←HEX THEN{97:} IF((C>=48)AND(C<=57))OR((C>=65)AND(C<=70))THEN GOTO 31 ELSE SCANNING←HEX :=FALSE{:97}; CASE C OF 65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85 ,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111 ,112,113,114,115,116,117,118,119,120,121,122:{99:} BEGIN IF((C=69)OR(C=101))AND(LOC>1)THEN IF(BUFFER[LOC-2]<=57)AND(BUFFER[ LOC-2]>=48)THEN C:=128;IF C<>128 THEN BEGIN LOC:=LOC-1;ID←FIRST:=LOC; REPEAT LOC:=LOC+1;D:=BUFFER[LOC]; UNTIL((D<48)OR((D>57)AND(D<65))OR((D>90)AND(D<97))OR(D>122))AND(D<>95); C:=130;ID←LOC:=LOC;END;END{:99};39,34:{100:}BEGIN ID←FIRST:=LOC-1; REPEAT D:=BUFFER[LOC];LOC:=LOC+1; IF LOC>LIMIT THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN( TERM←OUT);WRITE(TERM←OUT,'! String constant didn''t end');ERROR;END;END; LOC:=LIMIT;D:=C;END;UNTIL D=C;ID←LOC:=LOC;C:=129;END{:100};64:{101:} BEGIN C:=CONTROL←CODE(BUFFER[LOC]);LOC:=LOC+1; IF C=126 THEN BEGIN XREF←SWITCH:=10240;GOTO 20; END ELSE IF C=125 THEN BEGIN XREF←SWITCH:=0;GOTO 20; END ELSE IF(C<=134)AND(C>=131)THEN{107:}BEGIN ID←FIRST:=LOC; BUFFER[LIMIT+1]:=64;WHILE BUFFER[LOC]<>64 DO LOC:=LOC+1;ID←LOC:=LOC; IF LOC>LIMIT THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN( TERM←OUT);WRITE(TERM←OUT,'! Control text didn''t end');ERROR;END;END; LOC:=LIMIT;END ELSE BEGIN LOC:=LOC+2; IF BUFFER[LOC-1]<>62 THEN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN( TERM←OUT); WRITE(TERM←OUT,'! Control codes are forbidden in control text');ERROR; END;END;END;END{:107} ELSE IF C=13 THEN SCANNING←HEX:=TRUE ELSE IF C=146 THEN{102:}BEGIN{104:} K:=0;WHILE TRUE DO BEGIN IF LOC>LIMIT THEN BEGIN GET←LINE; IF INPUT←HAS←ENDED THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN( TERM←OUT);WRITE(TERM←OUT,'! Input ended in section name');ERROR;END;END; LOC:=1;GOTO 30;END;END;D:=BUFFER[LOC];{105:} IF D=64 THEN BEGIN D:=BUFFER[LOC+1];IF D=62 THEN BEGIN LOC:=LOC+2; GOTO 30;END; IF(D=32)OR(D=9)OR(D=42)THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'! Section name didn''t end');ERROR; END;END;GOTO 30;END;K:=K+1;MOD←TEXT[K]:=64;LOC:=LOC+1;END{:105}; LOC:=LOC+1;IF K<LONGEST←NAME-1 THEN K:=K+1; IF(D=32)OR(D=9)THEN BEGIN D:=32;IF MOD←TEXT[K-1]=32 THEN K:=K-1;END; MOD←TEXT[K]:=D;END;30:{106:} IF K>=LONGEST←NAME-2 THEN BEGIN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Section name too long: ');END; FOR J:=1 TO 25 DO WRITE(TERM←OUT,XCHR[MOD←TEXT[J]]); WRITE(TERM←OUT,'...');IF HISTORY=0 THEN HISTORY:=1;END{:106}; IF(MOD←TEXT[K]=32)AND(K>0)THEN K:=K-1{:104}; IF K>3 THEN BEGIN IF(MOD←TEXT[K]=46)AND(MOD←TEXT[K-1]=46)AND(MOD←TEXT[K -2]=46)THEN CUR←MODULE:=PREFIX←LOOKUP(K-3)ELSE CUR←MODULE:=MOD←LOOKUP(K) ;END ELSE CUR←MODULE:=MOD←LOOKUP(K);XREF←SWITCH:=0;END{:102} ELSE IF C=2 THEN{108:}BEGIN ID←FIRST:=LOC;LOC:=LOC+1; BUFFER[LIMIT+1]:=64;BUFFER[LIMIT+2]:=62; WHILE(BUFFER[LOC]<>64)OR(BUFFER[LOC+1]<>62)DO LOC:=LOC+1; IF LOC>=LIMIT THEN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Verbatim string didn''t end');ERROR;END;END; ID←LOC:=LOC;LOC:=LOC+2;END{:108};END{:101};{98:} 46:IF BUFFER[LOC]=46 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=32; LOC:=LOC+1;END; END ELSE IF BUFFER[LOC]=41 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=93; LOC:=LOC+1;END;END; 58:IF BUFFER[LOC]=61 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=24; LOC:=LOC+1;END;END; 61:IF BUFFER[LOC]=61 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=30; LOC:=LOC+1;END;END; 62:IF BUFFER[LOC]=61 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=29; LOC:=LOC+1;END;END; 60:IF BUFFER[LOC]=61 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=28; LOC:=LOC+1;END; END ELSE IF BUFFER[LOC]=62 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=26; LOC:=LOC+1;END;END; 40:IF BUFFER[LOC]=42 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=9; LOC:=LOC+1;END; END ELSE IF BUFFER[LOC]=46 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=91; LOC:=LOC+1;END;END; 42:IF BUFFER[LOC]=41 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=10; LOC:=LOC+1;END;END;{:98}32,9:GOTO 20;OTHERS:END; 31:{IF TROUBLE←SHOOTING THEN DEBUG←HELP;}GET←NEXT:=C;END;{:96}{112:} PROCEDURE PASCAL←XREF;LABEL 10;VAR P:NAME←POINTER; BEGIN WHILE NEXT←CONTROL<143 DO BEGIN IF(NEXT←CONTROL>=130)AND( NEXT←CONTROL<=133)THEN BEGIN P:=ID←LOOKUP(NEXT←CONTROL-130);NEW←XREF(P); IF(ILK[P]=17)OR(ILK[P]=22)THEN XREF←SWITCH:=10240;END; NEXT←CONTROL:=GET←NEXT; IF(NEXT←CONTROL=124)OR(NEXT←CONTROL=123)THEN GOTO 10;END;10:END;{:112} {113:}PROCEDURE OUTER←XREF;VAR BAL:EIGHT←BITS; BEGIN WHILE NEXT←CONTROL<143 DO IF NEXT←CONTROL<>123 THEN PASCAL←XREF ELSE BEGIN BAL:=SKIP←COMMENT(1);NEXT←CONTROL:=124; WHILE BAL>0 DO BEGIN PASCAL←XREF; IF NEXT←CONTROL=124 THEN BAL:=SKIP←COMMENT(BAL)ELSE BAL:=0;END;END;END; {:113}{120:}PROCEDURE MOD←CHECK(P:NAME←POINTER); BEGIN IF P>0 THEN BEGIN MOD←CHECK(LINK[P]);CUR←XREF:=XREF[P]; IF XMEM[CUR←XREF].NUM←FIELD<10240 THEN BEGIN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Never defined: <');END;PRINT←ID(P); WRITE(TERM←OUT,'>');IF HISTORY=0 THEN HISTORY:=1;END; WHILE XMEM[CUR←XREF].NUM←FIELD>=10240 DO CUR←XREF:=XMEM[CUR←XREF]. XLINK←FIELD;IF CUR←XREF=0 THEN BEGIN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Never used: <');END;PRINT←ID(P);WRITE(TERM←OUT,'>'); IF HISTORY=0 THEN HISTORY:=1;END;MOD←CHECK(ILK[P]);END;END;{:120}{123:} PROCEDURE FLUSH←BUFFER(B:EIGHT←BITS;PER←CENT:BOOLEAN);LABEL 30; VAR J,K:0..LINE←LENGTH;BEGIN J:=B; IF NOT PER←CENT THEN WHILE TRUE DO BEGIN IF J=0 THEN GOTO 30; IF OUT←BUF[J]<>32 THEN GOTO 30;J:=J-1;END; 30:FOR K:=1 TO J DO WRITE(TEX←FILE,XCHR[OUT←BUF[K]]); IF PER←CENT THEN WRITE(TEX←FILE,XCHR[37]);WRITELN(TEX←FILE); OUT←LINE:=OUT←LINE+1; IF B<OUT←PTR THEN FOR K:=B+1 TO OUT←PTR DO OUT←BUF[K-B]:=OUT←BUF[K]; OUT←PTR:=OUT←PTR-B;END;{:123}{124:}PROCEDURE FINISH←LINE;LABEL 10; VAR K:0..BUF←SIZE; BEGIN IF OUT←PTR>0 THEN FLUSH←BUFFER(OUT←PTR,FALSE)ELSE BEGIN FOR K:=0 TO LIMIT DO IF(BUFFER[K]<>32)AND(BUFFER[K]<>9)THEN GOTO 10; FLUSH←BUFFER(0,FALSE);END;10:END;{:124}{128:}PROCEDURE BREAK←OUT; LABEL 10;VAR K:0..LINE←LENGTH;D:ASCII←CODE;BEGIN K:=OUT←PTR; WHILE TRUE DO BEGIN IF K=0 THEN{129:}BEGIN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Line had to be broken (output l.',OUT←LINE:1);END; WRITELN(TERM←OUT,'):'); FOR K:=1 TO OUT←PTR-1 DO WRITE(TERM←OUT,XCHR[OUT←BUF[K]]); WRITELN(TERM←OUT);IF HISTORY=0 THEN HISTORY:=1; FLUSH←BUFFER(OUT←PTR-1,TRUE);GOTO 10;END{:129};D:=OUT←BUF[K]; IF D=32 THEN BEGIN FLUSH←BUFFER(K,FALSE);GOTO 10;END; IF(D=92)AND(OUT←BUF[K-1]<>92)THEN BEGIN FLUSH←BUFFER(K-1,TRUE);GOTO 10; END;K:=K-1;END;10:END;{:128}{131:}PROCEDURE OUT←MOD(M:INTEGER); VAR K:0..5;A:INTEGER;BEGIN K:=0;A:=M;REPEAT DIG[K]:=A MOD 10; A:=A DIV 10;K:=K+1;UNTIL A=0;REPEAT K:=K-1; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=DIG[K]+48;END;UNTIL K=0; IF CHANGED←MODULE[M]THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=92; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=42;END;END;{:131}{132:} PROCEDURE OUT←NAME(P:NAME←POINTER);VAR K:0..MAX←BYTES;W:0..1; BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=123;END;W:=P MOD 2; FOR K:=BYTE←START[P]TO BYTE←START[P+2]-1 DO BEGIN IF BYTE←MEM[W,K]=95 THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;END;BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=BYTE←MEM[W,K];END;END; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=125;END;END;{:132}{133:}PROCEDURE COPY←LIMBO;LABEL 10; VAR C:ASCII←CODE; BEGIN WHILE TRUE DO IF LOC>LIMIT THEN BEGIN FINISH←LINE;GET←LINE; IF INPUT←HAS←ENDED THEN GOTO 10;END ELSE BEGIN BUFFER[LIMIT+1]:=64; {134:}WHILE BUFFER[LOC]<>64 DO BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=BUFFER[LOC];END; LOC:=LOC+1;END;IF LOC<=LIMIT THEN BEGIN LOC:=LOC+2;C:=BUFFER[LOC-1]; IF(C=32)OR(C=9)OR(C=42)THEN GOTO 10; IF(C<>122)AND(C<>90)THEN BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=64;END; IF C<>64 THEN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Double @ required outside of sections');ERROR;END;END; END;END{:134};END;10:END;{:133}{135:}FUNCTION COPY←TEX:EIGHT←BITS; LABEL 30;VAR C:EIGHT←BITS; BEGIN WHILE TRUE DO BEGIN IF LOC>LIMIT THEN BEGIN FINISH←LINE;GET←LINE; IF INPUT←HAS←ENDED THEN BEGIN C:=147;GOTO 30;END;END; BUFFER[LIMIT+1]:=64;{136:}REPEAT C:=BUFFER[LOC];LOC:=LOC+1; IF C=124 THEN GOTO 30; IF C<>64 THEN BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=C;END; IF(OUT←PTR=1)AND((C=32)OR(C=9))THEN OUT←PTR:=OUT←PTR-1;END;UNTIL C=64; IF LOC<=LIMIT THEN BEGIN C:=CONTROL←CODE(BUFFER[LOC]);LOC:=LOC+1; GOTO 30;END{:136};END;30:COPY←TEX:=C;END;{:135}{137:} FUNCTION COPY←COMMENT(BAL:EIGHT←BITS):EIGHT←BITS;LABEL 30; VAR C:ASCII←CODE; BEGIN WHILE TRUE DO BEGIN IF LOC>LIMIT THEN BEGIN GET←LINE; IF INPUT←HAS←ENDED THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN( TERM←OUT);WRITE(TERM←OUT,'! Input ended in mid-comment');ERROR;END;END; LOC:=1;{139:}BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1;END; REPEAT BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1;END; BAL:=BAL-1;UNTIL BAL=0;GOTO 30;{:139};END;END;C:=BUFFER[LOC];LOC:=LOC+1; IF C=124 THEN GOTO 30; BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=C;TOK←PTR:=TOK←PTR+1;END; {138:}IF C=64 THEN BEGIN LOC:=LOC+1; IF BUFFER[LOC-1]<>64 THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'! Illegal use of @ in comment');ERROR; END;END;LOC:=LOC-2;TOK←PTR:=TOK←PTR-1;{139:} BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1;END; REPEAT BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1;END; BAL:=BAL-1;UNTIL BAL=0;GOTO 30;{:139};END; END ELSE IF(C=92)AND(BUFFER[LOC]<>64)THEN BEGIN BEGIN IF TOK←PTR+2> MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=BUFFER[LOC]; TOK←PTR:=TOK←PTR+1;END;LOC:=LOC+1; END ELSE IF C=123 THEN BAL:=BAL+1 ELSE IF C=125 THEN BEGIN BAL:=BAL-1; IF BAL=0 THEN GOTO 30;END{:138};END;30:COPY←COMMENT:=BAL;END;{:137} {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:}PROCEDURE RED(J:SIXTEEN←BITS;K:EIGHT←BITS; C:EIGHT←BITS;D:INTEGER);VAR I:0..MAX←SCRAPS;BEGIN CAT[J]:=C; TRANS[J]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR; IF K>1 THEN BEGIN FOR I:=J+K TO LO←PTR DO BEGIN CAT[I-K+1]:=CAT[I]; TRANS[I-K+1]:=TRANS[I];END;LO←PTR:=LO←PTR-K+1;END;{174:} IF PP+D>=SCRAP←BASE THEN PP:=PP+D ELSE PP:=SCRAP←BASE{:174};END;{:173} {175:}PROCEDURE SQ(J:SIXTEEN←BITS;K:EIGHT←BITS;C:EIGHT←BITS;D:INTEGER); VAR I:0..MAX←SCRAPS;BEGIN IF K=1 THEN BEGIN CAT[J]:=C;{174:} IF PP+D>=SCRAP←BASE THEN PP:=PP+D ELSE PP:=SCRAP←BASE{:174}; END ELSE BEGIN FOR I:=J TO J+K-1 DO BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[ I];TOK←PTR:=TOK←PTR+1;END;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:}PROCEDURE FIVE←CASES;LABEL 31;BEGIN CASE CAT[PP]OF 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 31;END; END ELSE IF CAT[PP+1]=11 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=140;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,5,-1); {PROD(6)};GOTO 31;END{:153};3:{160:} IF CAT[PP+1]=11 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=138;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=55; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,11,-2); {PROD(17)};GOTO 31;END{:160};2:{161:} IF CAT[PP+1]=6 THEN BEGIN TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1;RED(PP,1,11,-2);{PROD(18)}; GOTO 31;END ELSE IF CAT[PP+1]=14 THEN BEGIN TOK←MEM[TOK←PTR]:=141; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=139;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,3,-3); {PROD(19)};GOTO 31;END ELSE IF CAT[PP+1]=2 THEN BEGIN SQ(PP,2,2,-1); {PROD(20)};GOTO 31;END ELSE IF CAT[PP+1]=1 THEN BEGIN SQ(PP,2,2,-1); {PROD(21)};GOTO 31; END ELSE IF CAT[PP+1]=11 THEN BEGIN TOK←MEM[TOK←PTR]:=36; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=136; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=140;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=137; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; RED(PP,2,11,-2);{PROD(22)};GOTO 31; END ELSE IF CAT[PP+1]=10 THEN BEGIN TOK←MEM[TOK←PTR]:=36; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,11,-2); {PROD(23)};GOTO 31;END{:161};4:{163:} IF(CAT[PP+1]=17)AND(CAT[PP+2]=6)THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS [PP];TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=137; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1;RED(PP,3,2,-1); {PROD(26)};GOTO 31; END ELSE IF CAT[PP+1]=6 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=44;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,2,-1); {PROD(27)};GOTO 31;END ELSE IF CAT[PP+1]=2 THEN{164:} BEGIN IF(CAT[PP+2]=17)AND(CAT[PP+3]=6)THEN BEGIN TOK←MEM[TOK←PTR]:= 40960+TRANS[PP];TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=137; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+3];TOK←PTR:=TOK←PTR+1;RED(PP,4,2,-1); {PROD(28)};GOTO 31;END ELSE IF CAT[PP+2]=6 THEN BEGIN SQ(PP,3,2,-1); {PROD(29)};GOTO 31;END ELSE IF CAT[PP+2]=14 THEN BEGIN SQ(PP+1,2,2,0); {PROD(30)};GOTO 31; END ELSE IF CAT[PP+2]=16 THEN BEGIN IF CAT[PP+3]=3 THEN BEGIN TOK←MEM[ TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=133; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1;RED(PP+1,3,2,0);{PROD(31)}; GOTO 31;END; END ELSE IF CAT[PP+2]=9 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=44;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=138; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=53;TOK←PTR:=TOK←PTR+1; RED(PP+1,2,2,0);{PROD(32)};GOTO 31; END ELSE IF CAT[PP+2]=19 THEN BEGIN IF CAT[PP+3]=3 THEN BEGIN TOK←MEM[ TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=133; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1;RED(PP+1,3,2,0);{PROD(31)}; GOTO 31;END;END;END{:164} ELSE IF CAT[PP+1]=16 THEN BEGIN IF CAT[PP+2]=3 THEN BEGIN TOK←MEM[ TOK←PTR]:=133;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1; RED(PP+1,2,2,0);{PROD(34)};GOTO 31;END; END ELSE IF CAT[PP+1]=1 THEN BEGIN SQ(PP+1,1,2,0);{PROD(35)};GOTO 31; END ELSE IF(CAT[PP+1]=11)AND(CAT[PP+2]=6)THEN BEGIN TOK←MEM[TOK←PTR]:= 40960+TRANS[PP];TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=36; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=36; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2]; TOK←PTR:=TOK←PTR+1;RED(PP,3,2,-1);{PROD(36)};GOTO 31; END ELSE IF CAT[PP+1]=19 THEN BEGIN IF CAT[PP+2]=3 THEN BEGIN TOK←MEM[ TOK←PTR]:=133;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1; RED(PP+1,2,2,0);{PROD(37)};GOTO 31;END;END{:163};1:{168:} IF CAT[PP+1]=6 THEN BEGIN SQ(PP,1,11,-2);{PROD(43)};GOTO 31; END ELSE IF CAT[PP+1]=14 THEN BEGIN TOK←MEM[TOK←PTR]:=141; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=139;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,3,-3); {PROD(44)};GOTO 31;END ELSE IF CAT[PP+1]=2 THEN BEGIN SQ(PP,2,2,-1); {PROD(45)};GOTO 31;END ELSE IF CAT[PP+1]=22 THEN BEGIN SQ(PP,2,22,0); {PROD(46)};GOTO 31;END ELSE IF CAT[PP+1]=1 THEN BEGIN SQ(PP,2,1,-2); {PROD(47)};GOTO 31;END ELSE IF CAT[PP+1]=10 THEN BEGIN SQ(PP,2,11,-2); {PROD(48)};GOTO 31;END{:168};OTHERS:END;PP:=PP+1;31:END; PROCEDURE ALPHA←CASES;LABEL 31;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 31; END ELSE IF CAT[PP+2]=8 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=32; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=136;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1;RED(PP,3,13,-2); {PROD(2)};GOTO 31;END; END ELSE IF CAT[PP+1]=8 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=136;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,13,-2); {PROD(3)};GOTO 31;END ELSE IF CAT[PP+1]=1 THEN BEGIN SQ(PP+1,1,2,0); {PROD(4)};GOTO 31;END{:152};PP:=PP+1;31:END;{:151} FUNCTION TRANSLATE:TEXT←POINTER;LABEL 30,31;VAR I:1..MAX←SCRAPS; J:0..MAX←SCRAPS;BEGIN PP:=SCRAP←BASE;LO←PTR:=PP-1;HI←PTR:=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} ;{176:}WHILE TRUE DO BEGIN{177:} IF LO←PTR<PP+3 THEN BEGIN REPEAT IF HI←PTR<=SCRAP←PTR THEN BEGIN LO←PTR :=LO←PTR+1;CAT[LO←PTR]:=CAT[HI←PTR];TRANS[LO←PTR]:=TRANS[HI←PTR]; HI←PTR:=HI←PTR+1;END;UNTIL(HI←PTR>SCRAP←PTR)OR(LO←PTR=PP+3); FOR I:=LO←PTR+1 TO PP+3 DO CAT[I]:=0;END{:177}; IF(TOK←PTR+8>MAX←TOKS)OR(TEXT←PTR+4>MAX←TEXTS)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 WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token/text',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;END;IF PP>LO←PTR THEN GOTO 30;{150:} IF CAT[PP]<=7 THEN IF CAT[PP]<7 THEN FIVE←CASES ELSE ALPHA←CASES ELSE BEGIN CASE CAT[PP]OF 17:{154:} IF CAT[PP+1]=21 THEN BEGIN IF CAT[PP+2]=13 THEN BEGIN TOK←MEM[TOK←PTR]:= 40960+TRANS[PP];TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=137; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2]; TOK←PTR:=TOK←PTR+1;RED(PP,3,17,0);{PROD(7)};GOTO 31;END; END ELSE IF CAT[PP+1]=6 THEN BEGIN IF CAT[PP+2]=10 THEN BEGIN TOK←MEM[ TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=137;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1;RED(PP,3,11,-2); {PROD(8)};GOTO 31;END; END ELSE IF CAT[PP+1]=11 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,17,0); {PROD(9)};GOTO 31;END{:154};21:{155:} IF CAT[PP+1]=13 THEN BEGIN SQ(PP,2,17,0);{PROD(10)};GOTO 31;END{:155}; 13:{156:}IF CAT[PP+1]=11 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=140;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=137; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; RED(PP,2,11,-2);{PROD(11)};GOTO 31;END{:156};12:{157:} IF(CAT[PP+1]=13)AND(CAT[PP+2]=11)THEN IF CAT[PP+3]=20 THEN BEGIN TOK←MEM [TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=140;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+3];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135; TOK←PTR:=TOK←PTR+1;RED(PP,4,13,-2);{PROD(12)};GOTO 31; END ELSE BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=140;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=137; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; RED(PP,3,11,-2);{PROD(13)};GOTO 31;END{:157};20:{158:} BEGIN SQ(PP,1,3,-3);{PROD(14)};GOTO 31;END{:158};15:{159:} IF CAT[PP+1]=2 THEN BEGIN IF CAT[PP+2]=1 THEN IF CAT[PP+3]<>1 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1;RED(PP,3,2,-1);{PROD(15)}; GOTO 31;END; END ELSE IF CAT[PP+1]=1 THEN IF CAT[PP+2]<>1 THEN BEGIN TOK←MEM[TOK←PTR] :=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1;RED(PP,2,2,-1);{PROD(16)}; GOTO 31;END{:159};22:{162:} IF(CAT[PP+1]=10)OR(CAT[PP+1]=9)THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[ PP];TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; RED(PP,2,11,-2);{PROD(24)};GOTO 31;END ELSE BEGIN SQ(PP,1,1,-2); {PROD(25)};GOTO 31;END{:162};16:{165:} IF CAT[PP+1]=5 THEN BEGIN IF(CAT[PP+2]=6)AND(CAT[PP+3]=10)THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=137; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+3]; TOK←PTR:=TOK←PTR+1;RED(PP,4,11,-2);{PROD(38)};GOTO 31;END; END ELSE IF CAT[PP+1]=11 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=140;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,16,-2); {PROD(39)};GOTO 31;END{:165};18:{166:} IF(CAT[PP+1]=3)AND(CAT[PP+2]=21)THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS [PP];TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1;RED(PP,3,21,-2); {PROD(40)};GOTO 31;END ELSE BEGIN TOK←MEM[TOK←PTR]:=136; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP];TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1;RED(PP,1,17,0);{PROD(41)}; GOTO 31;END{:166};9:{167:}BEGIN SQ(PP,1,10,-3);{PROD(42)};GOTO 31; END{:167};11:{169:} IF CAT[PP+1]=11 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=140;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,11,-2); {PROD(49)};GOTO 31;END{:169};10:{170:}BEGIN SQ(PP,1,11,-2);{PROD(50)}; GOTO 31;END{:170};19:{171:}IF CAT[PP+1]=5 THEN BEGIN SQ(PP,1,11,-2); {PROD(51)};GOTO 31; END ELSE IF CAT[PP+1]=2 THEN BEGIN IF CAT[PP+2]=14 THEN BEGIN TOK←MEM[ TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+2];TOK←PTR:=TOK←PTR+1;RED(PP+1,2,3,+1); {PROD(52)};GOTO 31;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 31;END; END ELSE IF CAT[PP+1]=11 THEN BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[PP]; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=140;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=40960+TRANS[PP+1];TOK←PTR:=TOK←PTR+1;RED(PP,2,19,-2); {PROD(54)};GOTO 31;END{:171};OTHERS:END;PP:=PP+1;31:END{:150};END; 30:{:176}; IF(LO←PTR=SCRAP←BASE)AND(CAT[LO←PTR]<>2)THEN TRANSLATE:=TRANS[LO←PTR] 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 J:=SCRAP←BASE TO LO←PTR DO BEGIN IF J<>SCRAP←BASE THEN BEGIN TOK←MEM [TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1;END; IF CAT[J]=2 THEN BEGIN TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1;END; TOK←MEM[TOK←PTR]:=40960+TRANS[J];TOK←PTR:=TOK←PTR+1; IF CAT[J]=2 THEN BEGIN TOK←MEM[TOK←PTR]:=36;TOK←PTR:=TOK←PTR+1;END; IF TOK←PTR+6>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;END;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;TRANSLATE:=TEXT←PTR-1;END{:181};END;{:180} {184:}{196:}PROCEDURE APP←COMMENT;BEGIN TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR; IF(SCRAP←PTR<SCRAP←BASE)OR(CAT[SCRAP←PTR]<8)OR(CAT[SCRAP←PTR]>10)THEN BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=10;TRANS[SCRAP←PTR]:=0; END ELSE BEGIN TOK←MEM[TOK←PTR]:=40960+TRANS[SCRAP←PTR]; TOK←PTR:=TOK←PTR+1;END;TOK←MEM[TOK←PTR]:=TEXT←PTR+40959; TOK←PTR:=TOK←PTR+1;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;{:196}{197:}PROCEDURE APP←OCTAL; BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=79; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=123;TOK←PTR:=TOK←PTR+1; WHILE(BUFFER[LOC]>=48)AND(BUFFER[LOC]<=55)DO BEGIN BEGIN IF TOK←PTR+2> MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=BUFFER[LOC]; TOK←PTR:=TOK←PTR+1;END;LOC:=LOC+1;END;BEGIN TOK←MEM[TOK←PTR]:=125; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;END;PROCEDURE APP←HEX; BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=72; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=123;TOK←PTR:=TOK←PTR+1; WHILE((BUFFER[LOC]>=48)AND(BUFFER[LOC]<=57))OR((BUFFER[LOC]>=65)AND( BUFFER[LOC]<=70))DO BEGIN BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN (TERM←OUT);WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded'); ERROR;HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=BUFFER[LOC]; TOK←PTR:=TOK←PTR+1;END;LOC:=LOC+1;END;BEGIN TOK←MEM[TOK←PTR]:=125; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;END;{:197}{187:}PROCEDURE EASY←CASES; BEGIN CASE NEXT←CONTROL OF 6:BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=105;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=110;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;32:BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=116;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=111;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END; 35,36,37,94,95:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=NEXT←CONTROL;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 0,124,131,132,133:;40,91:BEGIN TOK←MEM[TOK←PTR]:=NEXT←CONTROL; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=4; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END; 41,93:BEGIN TOK←MEM[TOK←PTR]:=NEXT←CONTROL;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=6;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 42:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=97; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=115;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=116;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;44:BEGIN TOK←MEM[TOK←PTR]:=44; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=138;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=57;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END; 46,48,49,50,51,52,53,54,55,56,57:BEGIN TOK←MEM[TOK←PTR]:=NEXT←CONTROL; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;59:BEGIN TOK←MEM[TOK←PTR]:=59; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=9; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;58:BEGIN TOK←MEM[TOK←PTR]:=58; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=14; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;{189:}26:BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=73;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 28:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=76; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;29:BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=71;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 30:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=83; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;4:BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=87;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 31:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=86; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;5:BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=82;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 24:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=75; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;{:189}128:BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=69;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=123;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=15;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;9:BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=66;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 10:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=84; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;12:APP←OCTAL;13:APP←HEX; 135:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=41; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;3:BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=93;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 137:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=44; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;138:BEGIN TOK←MEM[TOK←PTR]:=138; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=48;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 139:BEGIN TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1;APP←COMMENT;END; 140:BEGIN TOK←MEM[TOK←PTR]:=142;TOK←PTR:=TOK←PTR+1;APP←COMMENT;END; 141:BEGIN TOK←MEM[TOK←PTR]:=134;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1; BEGIN TOK←MEM[TOK←PTR]:=134;TOK←PTR:=TOK←PTR+1;APP←COMMENT;END;END; 142:BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=9;TRANS[SCRAP←PTR]:=0; END;136:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=74;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END; OTHERS:BEGIN TOK←MEM[TOK←PTR]:=NEXT←CONTROL;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END END;END;{:187} {193:}PROCEDURE SUB←CASES(P:NAME←POINTER); BEGIN CASE ILK[P]OF 0:BEGIN TOK←MEM[TOK←PTR]:=10240+P; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;4:BEGIN TOK←MEM[TOK←PTR]:=20480+P; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=7; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;7:BEGIN TOK←MEM[TOK←PTR]:=141; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=139;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=3;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;8:BEGIN TOK←MEM[TOK←PTR]:=131; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;9:BEGIN TOK←MEM[TOK←PTR]:=20480+P; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=8; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;12:BEGIN TOK←MEM[TOK←PTR]:=141; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=7;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 13:BEGIN TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=3;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 16:BEGIN TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; 20:BEGIN TOK←MEM[TOK←PTR]:=132;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=125; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;END;END;{:193}PROCEDURE PASCAL←PARSE; LABEL 21,10;VAR J:0..LONG←BUF←SIZE;P:NAME←POINTER; BEGIN WHILE NEXT←CONTROL<143 DO BEGIN{186:}{188:} IF(SCRAP←PTR+4>MAX←SCRAPS)OR(TOK←PTR+6>MAX←TOKS)OR(TEXT←PTR+4>MAX←TEXTS) THEN BEGIN{IF SCRAP←PTR>MAX←SCR←PTR THEN MAX←SCR←PTR:=SCRAP←PTR; 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 WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','scrap/token/text',' capacity exceeded'); ERROR;HISTORY:=3;JUMP←OUT;END;END{:188}; 21:CASE NEXT←CONTROL OF 129,2:{190:}BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;IF NEXT←CONTROL=2 THEN BEGIN TOK←MEM[TOK←PTR]:=61; TOK←PTR:=TOK←PTR+1;END ELSE BEGIN TOK←MEM[TOK←PTR]:=46; TOK←PTR:=TOK←PTR+1;END;TOK←MEM[TOK←PTR]:=123;TOK←PTR:=TOK←PTR+1; J:=ID←FIRST; WHILE J<ID←LOC DO BEGIN CASE BUFFER[J]OF 32,92,35,37,36,94,39,96,123,125 ,126,38,95:BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;END; 64:IF BUFFER[J+1]=64 THEN J:=J+1 ELSE BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Double @ should be used in strings');ERROR;END;END; OTHERS:END;BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=BUFFER[J];TOK←PTR:=TOK←PTR+1; END;J:=J+1;END;BEGIN TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END;END{:190}; 130:{192:}BEGIN P:=ID←LOOKUP(0); CASE ILK[P]OF 0,4,7,8,9,12,13,16,20:SUB←CASES(P);{194:} 5:BEGIN BEGIN TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=5; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;BEGIN SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=3;TRANS[SCRAP←PTR]:=0;END;END; 6:BEGIN BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=21; TRANS[SCRAP←PTR]:=0;END;BEGIN TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=7;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;END;10:BEGIN{195:} IF(SCRAP←PTR<SCRAP←BASE)OR((CAT[SCRAP←PTR]<>10)AND(CAT[SCRAP←PTR]<>9)) THEN BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=10; TRANS[SCRAP←PTR]:=0;END{:195};BEGIN TOK←MEM[TOK←PTR]:=141; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=139;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=20;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;END;11:BEGIN{195:} IF(SCRAP←PTR<SCRAP←BASE)OR((CAT[SCRAP←PTR]<>10)AND(CAT[SCRAP←PTR]<>9)) THEN BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=10; TRANS[SCRAP←PTR]:=0;END{:195};BEGIN TOK←MEM[TOK←PTR]:=141; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=6;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END;END; 14:BEGIN BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=12; TRANS[SCRAP←PTR]:=0;END;BEGIN TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=7;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;END; 23:BEGIN BEGIN TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=126; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=7; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;BEGIN TOK←MEM[TOK←PTR]:=20480+P; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=8; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;END; 17:BEGIN BEGIN TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=139;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=20480+P; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=16;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; BEGIN TOK←MEM[TOK←PTR]:=136;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=32;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=3;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END;END; 18:BEGIN BEGIN TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=18;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=3;TRANS[SCRAP←PTR]:=0;END; END;19:BEGIN BEGIN TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=136;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=20480+P; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=5;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=3;TRANS[SCRAP←PTR]:=0;END; END;21:BEGIN{195:} IF(SCRAP←PTR<SCRAP←BASE)OR((CAT[SCRAP←PTR]<>10)AND(CAT[SCRAP←PTR]<>9)) THEN BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=10; TRANS[SCRAP←PTR]:=0;END{:195};BEGIN TOK←MEM[TOK←PTR]:=141; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=139;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=20480+P;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=6;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;BEGIN SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=13;TRANS[SCRAP←PTR]:=0;END;END; 22:BEGIN BEGIN TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=139;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=20480+P; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=19;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; BEGIN SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=3;TRANS[SCRAP←PTR]:=0;END; END;{:194}OTHERS:BEGIN NEXT←CONTROL:=ILK[P]-24;GOTO 21;END END;END{:192} ;134:{191:}BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=104;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=98; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=111;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=120;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=123; TOK←PTR:=TOK←PTR+1; FOR J:=ID←FIRST TO ID←LOC-1 DO BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=BUFFER[J];TOK←PTR:=TOK←PTR+1; END;BEGIN TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=1;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END;END{:191}; OTHERS:EASY←CASES END{:186};NEXT←CONTROL:=GET←NEXT; IF(NEXT←CONTROL=124)OR(NEXT←CONTROL=123)THEN GOTO 10;END;10:END;{:184} {198:}FUNCTION PASCAL←TRANSLATE:TEXT←POINTER;VAR P:TEXT←POINTER; SAVE←BASE:0..MAX←SCRAPS;BEGIN SAVE←BASE:=SCRAP←BASE; SCRAP←BASE:=SCRAP←PTR+1;PASCAL←PARSE; IF NEXT←CONTROL<>124 THEN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN( TERM←OUT);WRITE(TERM←OUT,'! Missing "|" after Pascal text');ERROR;END; END;BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=135;TOK←PTR:=TOK←PTR+1;END; APP←COMMENT;P:=TRANSLATE; {IF SCRAP←PTR>MAX←SCR←PTR THEN MAX←SCR←PTR:=SCRAP←PTR;} SCRAP←PTR:=SCRAP←BASE-1;SCRAP←BASE:=SAVE←BASE;PASCAL←TRANSLATE:=P;END; {:198}{199:}PROCEDURE OUTER←PARSE;VAR BAL:EIGHT←BITS;P,Q:TEXT←POINTER; BEGIN WHILE NEXT←CONTROL<143 DO IF NEXT←CONTROL<>123 THEN PASCAL←PARSE ELSE BEGIN{200:} IF(TOK←PTR+7>MAX←TOKS)OR(TEXT←PTR+3>MAX←TEXTS)OR(SCRAP←PTR>=MAX←SCRAPS) THEN BEGIN{IF SCRAP←PTR>MAX←SCR←PTR THEN MAX←SCR←PTR:=SCRAP←PTR; 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 WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token/text/scrap',' capacity exceeded'); ERROR;HISTORY:=3;JUMP←OUT;END;END{:200};TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=67;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=123;TOK←PTR:=TOK←PTR+1;BAL:=COPY←COMMENT(1); NEXT←CONTROL:=124;WHILE BAL>0 DO BEGIN P:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;Q:=PASCAL←TRANSLATE; TOK←MEM[TOK←PTR]:=40960+P;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=51200+Q; TOK←PTR:=TOK←PTR+1; IF NEXT←CONTROL=124 THEN BAL:=COPY←COMMENT(BAL)ELSE BAL:=0;END; TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1;APP←COMMENT;END;END;{:199} {205:}PROCEDURE PUSH←LEVEL(P:TEXT←POINTER); BEGIN IF STACK←PTR=STACK←SIZE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','stack',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT; END ELSE BEGIN IF STACK←PTR>0 THEN STACK[STACK←PTR]:=CUR←STATE; STACK←PTR:=STACK←PTR+1; {IF STACK←PTR>MAX←STACK←PTR THEN MAX←STACK←PTR:=STACK←PTR;} CUR←STATE.TOK←FIELD:=TOK←START[P];CUR←STATE.END←FIELD:=TOK←START[P+1]; END;END;{:205}{207:}FUNCTION GET←OUTPUT:EIGHT←BITS;LABEL 20; VAR A:SIXTEEN←BITS; BEGIN 20:WHILE CUR←STATE.TOK←FIELD=CUR←STATE.END←FIELD DO BEGIN STACK←PTR:=STACK←PTR-1;CUR←STATE:=STACK[STACK←PTR];END; A:=TOK←MEM[CUR←STATE.TOK←FIELD]; CUR←STATE.TOK←FIELD:=CUR←STATE.TOK←FIELD+1; IF A>=256 THEN BEGIN CUR←NAME:=A MOD 10240;CASE A DIV 10240 OF 2:A:=129; 3:A:=128;4:BEGIN PUSH←LEVEL(CUR←NAME);GOTO 20;END; 5:BEGIN PUSH←LEVEL(CUR←NAME);CUR←STATE.MODE←FIELD:=0;GOTO 20;END; OTHERS:A:=130 END;END;{IF TROUBLE←SHOOTING THEN DEBUG←HELP;} GET←OUTPUT:=A;END;{:207}{208:}PROCEDURE MAKE←OUTPUT;FORWARD; PROCEDURE OUTPUT←PASCAL; VAR SAVE←TOK←PTR,SAVE←TEXT←PTR,SAVE←NEXT←CONTROL:SIXTEEN←BITS; P:TEXT←POINTER;BEGIN SAVE←TOK←PTR:=TOK←PTR;SAVE←TEXT←PTR:=TEXT←PTR; SAVE←NEXT←CONTROL:=NEXT←CONTROL;NEXT←CONTROL:=124;P:=PASCAL←TRANSLATE; TOK←MEM[TOK←PTR]:=P+51200;TOK←PTR:=TOK←PTR+1;MAKE←OUTPUT; {IF TEXT←PTR>MAX←TXT←PTR THEN MAX←TXT←PTR:=TEXT←PTR; IF TOK←PTR>MAX←TOK←PTR THEN MAX←TOK←PTR:=TOK←PTR;} TEXT←PTR:=SAVE←TEXT←PTR;TOK←PTR:=SAVE←TOK←PTR; NEXT←CONTROL:=SAVE←NEXT←CONTROL;END;{:208}{209:}PROCEDURE MAKE←OUTPUT; LABEL 21,10,31;VAR A:EIGHT←BITS;B:EIGHT←BITS;K,K←LIMIT:0..MAX←BYTES; W:0..1;J:0..LONG←BUF←SIZE;STRING←DELIMITER:ASCII←CODE; SAVE←LOC,SAVE←LIMIT:0..LONG←BUF←SIZE;CUR←MOD←NAME:NAME←POINTER; SAVE←MODE:MODE;BEGIN TOK←MEM[TOK←PTR]:=143;TOK←PTR:=TOK←PTR+1; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR; PUSH←LEVEL(TEXT←PTR-1);WHILE TRUE DO BEGIN A:=GET←OUTPUT; 21:CASE A OF 143:GOTO 10;130,129:{210:} BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;END; IF A=130 THEN IF BYTE←START[CUR←NAME+2]-BYTE←START[CUR←NAME]=1 THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=124; END ELSE BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92; END ELSE BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=38;END; IF BYTE←START[CUR←NAME+2]-BYTE←START[CUR←NAME]=1 THEN BEGIN IF OUT←PTR= LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=BYTE←MEM[CUR←NAME MOD 2,BYTE←START[CUR←NAME]]; END ELSE OUT←NAME(CUR←NAME);END{:210};128:{214:} BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=88;END;CUR←XREF:=XREF[CUR←NAME]; IF XMEM[CUR←XREF].NUM←FIELD>=10240 THEN BEGIN OUT←MOD(XMEM[CUR←XREF]. NUM←FIELD-10240); IF PHASE←THREE THEN BEGIN CUR←XREF:=XMEM[CUR←XREF].XLINK←FIELD; WHILE XMEM[CUR←XREF].NUM←FIELD>=10240 DO BEGIN BEGIN IF OUT←PTR= LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=44; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=32;END;OUT←MOD(XMEM[CUR←XREF].NUM←FIELD-10240); CUR←XREF:=XMEM[CUR←XREF].XLINK←FIELD;END;END; END ELSE BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=48;END;BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=58;END;{215:} K:=BYTE←START[CUR←NAME];W:=CUR←NAME MOD 2; K←LIMIT:=BYTE←START[CUR←NAME+2];CUR←MOD←NAME:=CUR←NAME; WHILE K<K←LIMIT DO BEGIN B:=BYTE←MEM[W,K];K:=K+1;IF B=64 THEN{216:} BEGIN IF BYTE←MEM[W,K]<>64 THEN BEGIN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Illegal control code in section name:');END; BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'<');END;PRINT←ID(CUR←MOD←NAME); WRITE(TERM←OUT,'> ');HISTORY:=2;END;K:=K+1;END{:216}; IF B<>124 THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=B;END ELSE BEGIN{217:}J:=LIMIT+1; BUFFER[J]:=124;STRING←DELIMITER:=0; WHILE TRUE DO BEGIN IF K>=K←LIMIT THEN BEGIN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Pascal text in section name didn''t end:');END; BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'<');END;PRINT←ID(CUR←MOD←NAME); WRITE(TERM←OUT,'> ');HISTORY:=2;GOTO 31;END;B:=BYTE←MEM[W,K];K:=K+1; IF B=64 THEN{218:} BEGIN IF J>LONG←BUF←SIZE-4 THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','buffer',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;BUFFER[J+1]:=64;BUFFER[J+2]:=BYTE←MEM[W,K]; J:=J+2;K:=K+1;END{:218} ELSE BEGIN IF(B=34)OR(B=39)THEN IF STRING←DELIMITER=0 THEN STRING←DELIMITER:=B ELSE IF STRING←DELIMITER=B THEN STRING←DELIMITER:=0; IF(B<>124)OR(STRING←DELIMITER<>0)THEN BEGIN IF J>LONG←BUF←SIZE-3 THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','buffer',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;J:=J+1;BUFFER[J]:=B;END ELSE GOTO 31;END;END; 31:{:217};SAVE←LOC:=LOC;SAVE←LIMIT:=LIMIT;LOC:=LIMIT+2;LIMIT:=J+1; BUFFER[LIMIT]:=124;OUTPUT←PASCAL;LOC:=SAVE←LOC;LIMIT:=SAVE←LIMIT;END; END{:215};BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=92; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=88;END;END{:214};131,133,132:{211:} BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=109; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=97;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=116; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=104;END; IF A=131 THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=98; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=105;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=110; END ELSE IF A=132 THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=114; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=101;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=108; END ELSE BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=111;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=112;END; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=123;END;END{:211};135:BEGIN REPEAT A:=GET←OUTPUT; UNTIL(A<139)OR(A>142);GOTO 21;END;134:BEGIN REPEAT A:=GET←OUTPUT; UNTIL((A<139)AND(A<>32))OR(A>142);GOTO 21;END; 136,137,138,139,140,141,142:{212:} IF A<140 THEN BEGIN IF CUR←STATE.MODE←FIELD=1 THEN BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=A-87;END; IF A=138 THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=GET←OUTPUT; END END ELSE IF A=138 THEN B:=GET←OUTPUT END ELSE{213:}BEGIN B:=A; SAVE←MODE:=CUR←STATE.MODE←FIELD;WHILE TRUE DO BEGIN A:=GET←OUTPUT; IF(A=135)OR(A=134)THEN GOTO 21; IF((A<>32)AND(A<140))OR(A>142)THEN BEGIN IF SAVE←MODE=1 THEN BEGIN IF OUT←PTR>3 THEN IF(OUT←BUF[OUT←PTR]=80)AND(OUT←BUF[OUT←PTR-1]=92)AND( OUT←BUF[OUT←PTR-2]=89)AND(OUT←BUF[OUT←PTR-3]=92)THEN GOTO 21; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=B-87;END; IF A<>143 THEN FINISH←LINE; END ELSE IF(A<>143)AND(CUR←STATE.MODE←FIELD=0)THEN BEGIN IF OUT←PTR= LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=32;END; GOTO 21;END;IF A>B THEN B:=A;END;END{:213}{:212}; OTHERS:BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=A;END END;END;10:END;{:209}{227:} PROCEDURE FINISH←PASCAL;VAR P:TEXT←POINTER; BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=80;END; BEGIN IF TOK←PTR+2>MAX←TOKS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','token',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;TOK←MEM[TOK←PTR]:=141;TOK←PTR:=TOK←PTR+1;END; APP←COMMENT;P:=TRANSLATE;TOK←MEM[TOK←PTR]:=P+40960;TOK←PTR:=TOK←PTR+1; MAKE←OUTPUT; IF OUT←PTR>1 THEN IF OUT←BUF[OUT←PTR-1]=92 THEN IF OUT←BUF[OUT←PTR]=54 THEN OUT←PTR:=OUT←PTR-2 ELSE IF OUT←BUF[OUT←PTR]=55 THEN OUT←BUF[OUT←PTR ]:=89;BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=112; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=97;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=114;END;FINISH←LINE; {IF TEXT←PTR>MAX←TXT←PTR THEN MAX←TXT←PTR:=TEXT←PTR; IF TOK←PTR>MAX←TOK←PTR THEN MAX←TOK←PTR:=TOK←PTR; IF SCRAP←PTR>MAX←SCR←PTR THEN MAX←SCR←PTR:=SCRAP←PTR;}TOK←PTR:=1; TEXT←PTR:=1;SCRAP←PTR:=0;END;{:227}{237:} PROCEDURE FOOTNOTE(FLAG:SIXTEEN←BITS);LABEL 30,10;VAR Q:XREF←NUMBER; BEGIN IF XMEM[CUR←XREF].NUM←FIELD<=FLAG THEN GOTO 10;FINISH←LINE; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;END; IF FLAG=0 THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=85; END ELSE BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=65;END;BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=32; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=115;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=101; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=99;END;BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=116; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=105;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=111; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=110;END;{238:}Q:=CUR←XREF; IF XMEM[XMEM[Q].XLINK←FIELD].NUM←FIELD>FLAG THEN BEGIN IF OUT←PTR= LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=115;END; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=126;END; WHILE TRUE DO BEGIN OUT←MOD(XMEM[CUR←XREF].NUM←FIELD-FLAG); CUR←XREF:=XMEM[CUR←XREF].XLINK←FIELD; IF XMEM[CUR←XREF].NUM←FIELD<=FLAG THEN GOTO 30; IF(XMEM[XMEM[CUR←XREF].XLINK←FIELD].NUM←FIELD>FLAG)OR(CUR←XREF<>XMEM[Q]. XLINK←FIELD)THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=44;END; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=32;END; IF XMEM[XMEM[CUR←XREF].XLINK←FIELD].NUM←FIELD<=FLAG THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=97;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=110; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=100;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=126;END;END;30:{:238}; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=46;END;10:END;{:237}{250:} PROCEDURE UNBUCKET(D:EIGHT←BITS);VAR C:ASCII←CODE; BEGIN FOR C:=100 DOWNTO 0 DO IF BUCKET[COLLATE[C]]>0 THEN BEGIN IF SCRAP←PTR>MAX←SCRAPS THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','sorting',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;SCRAP←PTR:=SCRAP←PTR+1; {IF SCRAP←PTR>MAX←SORT←PTR THEN MAX←SORT←PTR:=SCRAP←PTR;} IF C=0 THEN CAT[SCRAP←PTR]:=255 ELSE CAT[SCRAP←PTR]:=D; TRANS[SCRAP←PTR]:=BUCKET[COLLATE[C]];BUCKET[COLLATE[C]]:=0;END;END; {:250}{257:}PROCEDURE MOD←PRINT(P:NAME←POINTER); BEGIN IF P>0 THEN BEGIN MOD←PRINT(LINK[P]); BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=58;END;TOK←PTR:=1;TEXT←PTR:=1; SCRAP←PTR:=0;STACK←PTR:=0;CUR←STATE.MODE←FIELD:=1; TOK←MEM[TOK←PTR]:=P+30720;TOK←PTR:=TOK←PTR+1;MAKE←OUTPUT;FOOTNOTE(0); FINISH←LINE;MOD←PRINT(ILK[P]);END;END;{:257}{261:}{PROCEDURE DEBUG←HELP; LABEL 888,10;VAR K:SIXTEEN←BITS;BEGIN DEBUG←SKIPPED:=DEBUG←SKIPPED+1; IF DEBUG←SKIPPED<DEBUG←CYCLE THEN GOTO 10;DEBUG←SKIPPED:=0; WHILE TRUE DO BEGIN WRITE(TERM←OUT,'#');BREAK(TERM←OUT); READ(TERM←IN,DDT); IF DDT<0 THEN GOTO 10 ELSE IF DDT=0 THEN BEGIN GOTO 888; 888:DDT:=0; END ELSE BEGIN READ(TERM←IN,DD);CASE DDT OF 1:PRINT←ID(DD); 2:PRINT←TEXT(DD);3:FOR K:=1 TO DD DO WRITE(TERM←OUT,XCHR[BUFFER[K]]); 4:FOR K:=1 TO DD DO WRITE(TERM←OUT,XCHR[MOD←TEXT[K]]); 5:FOR K:=1 TO OUT←PTR DO WRITE(TERM←OUT,XCHR[OUT←BUF[K]]); 6:FOR K:=1 TO DD DO BEGIN PRINT←CAT(CAT[K]);WRITE(TERM←OUT,' ');END; OTHERS:WRITE(TERM←OUT,'?')END;END;END;10:END;}{:261}{262:} PROCEDURE PHASE←I;BEGIN{110:}PHASE←ONE:=TRUE;PHASE←THREE:=FALSE; RESET←INPUT;MODULE←COUNT:=0;SKIP←LIMBO;CHANGE←EXISTS:=FALSE; WHILE NOT INPUT←HAS←ENDED DO{111:}BEGIN MODULE←COUNT:=MODULE←COUNT+1; IF MODULE←COUNT=MAX←MODULES THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Sorry, ','section number',' capacity exceeded');ERROR; HISTORY:=3;JUMP←OUT;END;CHANGED←MODULE[MODULE←COUNT]:=FALSE; IF BUFFER[LOC-1]=42 THEN BEGIN WRITE(TERM←OUT,'*',MODULE←COUNT:1); BREAK(TERM←OUT);END;{114:}REPEAT NEXT←CONTROL:=SKIP←TEX; CASE NEXT←CONTROL OF 126:XREF←SWITCH:=10240;125:XREF←SWITCH:=0; 124:PASCAL←XREF;131,132,133,146:BEGIN LOC:=LOC-2;NEXT←CONTROL:=GET←NEXT; IF NEXT←CONTROL<>146 THEN NEW←XREF(ID←LOOKUP(NEXT←CONTROL-130));END; OTHERS:END;UNTIL NEXT←CONTROL>=143{:114};{116:} WHILE NEXT←CONTROL<=144 DO BEGIN XREF←SWITCH:=10240; IF NEXT←CONTROL=144 THEN NEXT←CONTROL:=GET←NEXT ELSE{117:} BEGIN NEXT←CONTROL:=GET←NEXT; IF NEXT←CONTROL=130 THEN BEGIN LHS:=ID←LOOKUP(0);ILK[LHS]:=0; NEW←XREF(LHS);NEXT←CONTROL:=GET←NEXT; IF NEXT←CONTROL=30 THEN BEGIN NEXT←CONTROL:=GET←NEXT; IF NEXT←CONTROL=130 THEN BEGIN RHS:=ID←LOOKUP(0);ILK[LHS]:=ILK[RHS]; ILK[RHS]:=0;NEW←XREF(RHS);ILK[RHS]:=ILK[LHS];NEXT←CONTROL:=GET←NEXT;END; END;END;END{:117};OUTER←XREF;END{:116};{118:} IF NEXT←CONTROL<=146 THEN BEGIN IF NEXT←CONTROL=145 THEN MOD←XREF←SWITCH :=0 ELSE MOD←XREF←SWITCH:=10240; REPEAT IF NEXT←CONTROL=146 THEN NEW←MOD←XREF(CUR←MODULE); NEXT←CONTROL:=GET←NEXT;OUTER←XREF;UNTIL NEXT←CONTROL>146;END{:118}; IF CHANGED←MODULE[MODULE←COUNT]THEN CHANGE←EXISTS:=TRUE;END{:111}; CHANGED←MODULE[MODULE←COUNT]:=CHANGE←EXISTS;PHASE←ONE:=FALSE;{121:} MOD←CHECK(ILK[0]){:121};{:110};END;PROCEDURE PHASE←II; VAR MOD←COUNT←PLUS←DEF←FLAG:SIXTEEN←BITS;BEGIN{219:}RESET←INPUT; BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'Writing the output file...'); END;MODULE←COUNT:=0;COPY←LIMBO;FINISH←LINE;FLUSH←BUFFER(0,FALSE); WHILE NOT INPUT←HAS←ENDED DO{221:}BEGIN MODULE←COUNT:=MODULE←COUNT+1; {222:}BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;END; IF BUFFER[LOC-1]<>42 THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=77; END ELSE BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=78;END; WRITE(TERM←OUT,'*',MODULE←COUNT:1);BREAK(TERM←OUT);END; OUT←MOD(MODULE←COUNT);BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=46; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=32;END{:222};SAVE←LINE:=OUT←LINE;SAVE←PLACE:=OUT←PTR; {223:}REPEAT NEXT←CONTROL:=COPY←TEX; CASE NEXT←CONTROL OF 124:BEGIN STACK←PTR:=0;CUR←STATE.MODE←FIELD:=1; OUTPUT←PASCAL;END;64:BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=64;END;12:{224:} BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=79; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=123;END; WHILE(BUFFER[LOC]>=48)AND(BUFFER[LOC]<=55)DO BEGIN BEGIN IF OUT←PTR= LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=BUFFER[LOC];END;LOC:=LOC+1;END; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=125;END;END{:224};13:{225:} BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=72; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=123;END; WHILE((BUFFER[LOC]>=48)AND(BUFFER[LOC]<=57))OR((BUFFER[LOC]>=65)AND( BUFFER[LOC]<=70))DO BEGIN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=BUFFER[LOC];END;LOC:=LOC+1;END; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=125;END;END{:225}; 134,131,132,133,146:BEGIN LOC:=LOC-2;NEXT←CONTROL:=GET←NEXT; IF NEXT←CONTROL=134 THEN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN( TERM←OUT);WRITE(TERM←OUT,'! TeX string should be in Pascal text only'); ERROR;END;END;END; 9,10,135,137,138,139,140,141,136,142:BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT);WRITE(TERM←OUT,'! You can''t do that in TeX text'); ERROR;END;END;OTHERS:END;UNTIL NEXT←CONTROL>=143{:223};{226:} IF NEXT←CONTROL<=144 THEN BEGIN IF(SAVE←LINE<>OUT←LINE)OR(SAVE←PLACE<> OUT←PTR)THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=92; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=89;END;SAVE←LINE:=OUT←LINE;SAVE←PLACE:=OUT←PTR;END; WHILE NEXT←CONTROL<=144 DO BEGIN STACK←PTR:=0;CUR←STATE.MODE←FIELD:=1; IF NEXT←CONTROL=144 THEN{228:}BEGIN BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=68;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=3;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; NEXT←CONTROL:=GET←NEXT; IF NEXT←CONTROL<>130 THEN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN( TERM←OUT);WRITE(TERM←OUT,'! Improper macro definition');ERROR;END; END ELSE BEGIN TOK←MEM[TOK←PTR]:=10240+ID←LOOKUP(0);TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; NEXT←CONTROL:=GET←NEXT;END{:228}ELSE{229:} BEGIN BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1; TOK←MEM[TOK←PTR]:=70;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=3;TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;NEXT←CONTROL:=GET←NEXT; IF NEXT←CONTROL=130 THEN BEGIN BEGIN TOK←MEM[TOK←PTR]:=10240+ID←LOOKUP(0 );TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;NEXT←CONTROL:=GET←NEXT; IF NEXT←CONTROL=30 THEN BEGIN BEGIN TOK←MEM[TOK←PTR]:=92; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=83;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; NEXT←CONTROL:=GET←NEXT; IF NEXT←CONTROL=130 THEN BEGIN BEGIN TOK←MEM[TOK←PTR]:=10240+ID←LOOKUP(0 );TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;BEGIN SCRAP←PTR:=SCRAP←PTR+1; CAT[SCRAP←PTR]:=9;TRANS[SCRAP←PTR]:=0;END;NEXT←CONTROL:=GET←NEXT;END; END;END; IF SCRAP←PTR<>5 THEN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT) ;WRITE(TERM←OUT,'! Improper format definition');ERROR;END;END;END{:229}; OUTER←PARSE;FINISH←PASCAL;END{:226};{231:}THIS←MODULE:=0; IF NEXT←CONTROL<=146 THEN BEGIN IF(SAVE←LINE<>OUT←LINE)OR(SAVE←PLACE<> OUT←PTR)THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=92; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=89;END;STACK←PTR:=0;CUR←STATE.MODE←FIELD:=1; IF NEXT←CONTROL=145 THEN NEXT←CONTROL:=GET←NEXT ELSE BEGIN THIS←MODULE:= CUR←MODULE;{232:}REPEAT NEXT←CONTROL:=GET←NEXT;UNTIL NEXT←CONTROL<>43; IF(NEXT←CONTROL<>61)AND(NEXT←CONTROL<>30)THEN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! You need an = sign after the section name');ERROR;END; END ELSE NEXT←CONTROL:=GET←NEXT; IF OUT←PTR>1 THEN IF(OUT←BUF[OUT←PTR]=89)AND(OUT←BUF[OUT←PTR-1]=92)THEN BEGIN TOK←MEM[TOK←PTR]:=139;TOK←PTR:=TOK←PTR+1;END; BEGIN TOK←MEM[TOK←PTR]:=30720+THIS←MODULE;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=22;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END; CUR←XREF:=XREF[THIS←MODULE];MOD←COUNT←PLUS←DEF←FLAG:=MODULE←COUNT+10240; IF XMEM[CUR←XREF].NUM←FIELD<>MOD←COUNT←PLUS←DEF←FLAG THEN BEGIN BEGIN TOK←MEM[TOK←PTR]:=132;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=43; TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=125;TOK←PTR:=TOK←PTR+1; SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2;TRANS[SCRAP←PTR]:=TEXT←PTR; TEXT←PTR:=TEXT←PTR+1;TOK←START[TEXT←PTR]:=TOK←PTR;END;THIS←MODULE:=0; END;BEGIN TOK←MEM[TOK←PTR]:=92;TOK←PTR:=TOK←PTR+1;TOK←MEM[TOK←PTR]:=83; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=2; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;BEGIN TOK←MEM[TOK←PTR]:=141; TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=9; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;{:232};END; WHILE NEXT←CONTROL<=146 DO BEGIN OUTER←PARSE;{233:} IF NEXT←CONTROL<146 THEN BEGIN BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN (TERM←OUT);WRITE(TERM←OUT,'! You can''t do that in Pascal text');ERROR; END;END;NEXT←CONTROL:=GET←NEXT; END ELSE IF NEXT←CONTROL=146 THEN BEGIN BEGIN TOK←MEM[TOK←PTR]:=30720+ CUR←MODULE;TOK←PTR:=TOK←PTR+1;SCRAP←PTR:=SCRAP←PTR+1;CAT[SCRAP←PTR]:=22; TRANS[SCRAP←PTR]:=TEXT←PTR;TEXT←PTR:=TEXT←PTR+1; TOK←START[TEXT←PTR]:=TOK←PTR;END;NEXT←CONTROL:=GET←NEXT;END{:233};END; FINISH←PASCAL;END{:231};{234:}IF THIS←MODULE>0 THEN BEGIN{236:} FIRST←XREF:=XREF[THIS←MODULE];THIS←XREF:=XMEM[FIRST←XREF].XLINK←FIELD; IF XMEM[THIS←XREF].NUM←FIELD>10240 THEN BEGIN MID←XREF:=THIS←XREF; CUR←XREF:=0;REPEAT NEXT←XREF:=XMEM[THIS←XREF].XLINK←FIELD; XMEM[THIS←XREF].XLINK←FIELD:=CUR←XREF;CUR←XREF:=THIS←XREF; THIS←XREF:=NEXT←XREF;UNTIL XMEM[THIS←XREF].NUM←FIELD<=10240; XMEM[FIRST←XREF].XLINK←FIELD:=CUR←XREF;END ELSE MID←XREF:=0;CUR←XREF:=0; WHILE THIS←XREF<>0 DO BEGIN NEXT←XREF:=XMEM[THIS←XREF].XLINK←FIELD; XMEM[THIS←XREF].XLINK←FIELD:=CUR←XREF;CUR←XREF:=THIS←XREF; THIS←XREF:=NEXT←XREF;END; IF MID←XREF>0 THEN XMEM[MID←XREF].XLINK←FIELD:=CUR←XREF ELSE XMEM[ FIRST←XREF].XLINK←FIELD:=CUR←XREF; CUR←XREF:=XMEM[FIRST←XREF].XLINK←FIELD{:236};FOOTNOTE(10240); FOOTNOTE(0);END{:234};{239:}BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=92; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=102;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=105;END;FINISH←LINE; FLUSH←BUFFER(0,FALSE);{:239};END{:221}{:219};END;PROCEDURE PHASE←III; BEGIN{240:}PHASE←THREE:=TRUE;BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'Writing the index...');END; IF CHANGE←EXISTS THEN BEGIN FINISH←LINE;{242:}BEGIN K←MODULE:=1; WHILE NOT CHANGED←MODULE[K←MODULE]DO K←MODULE:=K←MODULE+1; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=99; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=104;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=32;END;OUT←MOD(K←MODULE); REPEAT REPEAT K←MODULE:=K←MODULE+1 UNTIL CHANGED←MODULE[K←MODULE]; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=44;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=32;END;OUT←MOD(K←MODULE); UNTIL K←MODULE=MODULE←COUNT;BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=46;END;END{:242};END;FINISH←LINE; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=105; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=110;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=120;END;FINISH←LINE;{244:} FOR C:=0 TO 127 DO BUCKET[C]:=0; FOR H:=0 TO HASH←SIZE-1 DO BEGIN NEXT←NAME:=HASH[H]; WHILE NEXT←NAME<>0 DO BEGIN CUR←NAME:=NEXT←NAME; NEXT←NAME:=LINK[CUR←NAME]; IF XREF[CUR←NAME]<>0 THEN BEGIN C:=BYTE←MEM[CUR←NAME MOD 2,BYTE←START[ CUR←NAME]];IF(C<=90)AND(C>=65)THEN C:=C+32;BLINK[CUR←NAME]:=BUCKET[C]; BUCKET[C]:=CUR←NAME;END;END;END{:244};{251:}SCRAP←PTR:=0;UNBUCKET(1); WHILE SCRAP←PTR>0 DO BEGIN CUR←DEPTH:=CAT[SCRAP←PTR]; IF(BLINK[TRANS[SCRAP←PTR]]=0)OR(CUR←DEPTH=255)THEN{253:} BEGIN CUR←NAME:=TRANS[SCRAP←PTR];{IF TROUBLE←SHOOTING THEN DEBUG←HELP;} REPEAT BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=58;END;{254:} CASE ILK[CUR←NAME]OF 0:IF BYTE←START[CUR←NAME+2]-BYTE←START[CUR←NAME]=1 THEN BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=124; END ELSE BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=92;END;1:; 2:BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=57;END; 3:BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=46;END; OTHERS:BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=38;END END;OUT←NAME(CUR←NAME){:254} ;{255:}{256:}THIS←XREF:=XREF[CUR←NAME];CUR←XREF:=0; REPEAT NEXT←XREF:=XMEM[THIS←XREF].XLINK←FIELD; XMEM[THIS←XREF].XLINK←FIELD:=CUR←XREF;CUR←XREF:=THIS←XREF; THIS←XREF:=NEXT←XREF;UNTIL THIS←XREF=0{:256}; REPEAT BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=44;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=32;END; CUR←VAL:=XMEM[CUR←XREF].NUM←FIELD; IF CUR←VAL<10240 THEN OUT←MOD(CUR←VAL)ELSE BEGIN BEGIN IF OUT←PTR= LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=92; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=91;END;OUT←MOD(CUR←VAL-10240); BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=93;END;END;CUR←XREF:=XMEM[CUR←XREF].XLINK←FIELD; UNTIL CUR←XREF=0;BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=46;END;FINISH←LINE{:255}; CUR←NAME:=BLINK[CUR←NAME];UNTIL CUR←NAME=0;SCRAP←PTR:=SCRAP←PTR-1; END{:253}ELSE{252:}BEGIN NEXT←NAME:=TRANS[SCRAP←PTR]; REPEAT CUR←NAME:=NEXT←NAME;NEXT←NAME:=BLINK[CUR←NAME]; CUR←BYTE:=BYTE←START[CUR←NAME]+CUR←DEPTH;CUR←BANK:=CUR←NAME MOD 2; IF CUR←BYTE=BYTE←START[CUR←NAME+2]THEN C:=0 ELSE BEGIN C:=BYTE←MEM[ CUR←BANK,CUR←BYTE];IF(C<=90)AND(C>=65)THEN C:=C+32;END; BLINK[CUR←NAME]:=BUCKET[C];BUCKET[C]:=CUR←NAME;UNTIL NEXT←NAME=0; SCRAP←PTR:=SCRAP←PTR-1;UNBUCKET(CUR←DEPTH+1);END{:252};END{:251}; BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=92;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=102; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=105;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=110;END;FINISH←LINE;{258:} MOD←PRINT(ILK[0]){:258};BEGIN IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=92; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=99;IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT; OUT←PTR:=OUT←PTR+1;OUT←BUF[OUT←PTR]:=111; IF OUT←PTR=LINE←LENGTH THEN BREAK←OUT;OUT←PTR:=OUT←PTR+1; OUT←BUF[OUT←PTR]:=110;END;FINISH←LINE;WRITE(TERM←OUT,'Done.');{:240}; END;BEGIN INITIALIZE; WRITELN(TERM←OUT,'This is Weave 2.7 for Cedar 6.0');{65:}ID←LOC:=10; ID←FIRST:=7;BUFFER[7]:=97;BUFFER[8]:=110;BUFFER[9]:=100; CUR←NAME:=ID←LOOKUP(28);ID←FIRST:=5;BUFFER[5]:=97;BUFFER[6]:=114; BUFFER[7]:=114;BUFFER[8]:=97;BUFFER[9]:=121;CUR←NAME:=ID←LOOKUP(4); ID←FIRST:=5;BUFFER[5]:=98;BUFFER[6]:=101;BUFFER[7]:=103;BUFFER[8]:=105; BUFFER[9]:=110;CUR←NAME:=ID←LOOKUP(5);ID←FIRST:=6;BUFFER[6]:=99; BUFFER[7]:=97;BUFFER[8]:=115;BUFFER[9]:=101;CUR←NAME:=ID←LOOKUP(6); ID←FIRST:=5;BUFFER[5]:=99;BUFFER[6]:=111;BUFFER[7]:=110;BUFFER[8]:=115; BUFFER[9]:=116;CUR←NAME:=ID←LOOKUP(7);ID←FIRST:=7;BUFFER[7]:=100; BUFFER[8]:=105;BUFFER[9]:=118;CUR←NAME:=ID←LOOKUP(8);ID←FIRST:=8; BUFFER[8]:=100;BUFFER[9]:=111;CUR←NAME:=ID←LOOKUP(9);ID←FIRST:=4; BUFFER[4]:=100;BUFFER[5]:=111;BUFFER[6]:=119;BUFFER[7]:=110; BUFFER[8]:=116;BUFFER[9]:=111;CUR←NAME:=ID←LOOKUP(20);ID←FIRST:=6; BUFFER[6]:=101;BUFFER[7]:=108;BUFFER[8]:=115;BUFFER[9]:=101; CUR←NAME:=ID←LOOKUP(10);ID←FIRST:=7;BUFFER[7]:=101;BUFFER[8]:=110; BUFFER[9]:=100;CUR←NAME:=ID←LOOKUP(11);ID←FIRST:=6;BUFFER[6]:=102; BUFFER[7]:=105;BUFFER[8]:=108;BUFFER[9]:=101;CUR←NAME:=ID←LOOKUP(4); ID←FIRST:=7;BUFFER[7]:=102;BUFFER[8]:=111;BUFFER[9]:=114; CUR←NAME:=ID←LOOKUP(12);ID←FIRST:=2;BUFFER[2]:=102;BUFFER[3]:=117; BUFFER[4]:=110;BUFFER[5]:=99;BUFFER[6]:=116;BUFFER[7]:=105; BUFFER[8]:=111;BUFFER[9]:=110;CUR←NAME:=ID←LOOKUP(17);ID←FIRST:=6; BUFFER[6]:=103;BUFFER[7]:=111;BUFFER[8]:=116;BUFFER[9]:=111; CUR←NAME:=ID←LOOKUP(13);ID←FIRST:=8;BUFFER[8]:=105;BUFFER[9]:=102; CUR←NAME:=ID←LOOKUP(14);ID←FIRST:=8;BUFFER[8]:=105;BUFFER[9]:=110; CUR←NAME:=ID←LOOKUP(30);ID←FIRST:=5;BUFFER[5]:=108;BUFFER[6]:=97; BUFFER[7]:=98;BUFFER[8]:=101;BUFFER[9]:=108;CUR←NAME:=ID←LOOKUP(7); ID←FIRST:=7;BUFFER[7]:=109;BUFFER[8]:=111;BUFFER[9]:=100; CUR←NAME:=ID←LOOKUP(8);ID←FIRST:=7;BUFFER[7]:=110;BUFFER[8]:=105; BUFFER[9]:=108;CUR←NAME:=ID←LOOKUP(16);ID←FIRST:=7;BUFFER[7]:=110; BUFFER[8]:=111;BUFFER[9]:=116;CUR←NAME:=ID←LOOKUP(29);ID←FIRST:=8; BUFFER[8]:=111;BUFFER[9]:=102;CUR←NAME:=ID←LOOKUP(9);ID←FIRST:=8; BUFFER[8]:=111;BUFFER[9]:=114;CUR←NAME:=ID←LOOKUP(55);ID←FIRST:=4; BUFFER[4]:=112;BUFFER[5]:=97;BUFFER[6]:=99;BUFFER[7]:=107; BUFFER[8]:=101;BUFFER[9]:=100;CUR←NAME:=ID←LOOKUP(13);ID←FIRST:=1; BUFFER[1]:=112;BUFFER[2]:=114;BUFFER[3]:=111;BUFFER[4]:=99; BUFFER[5]:=101;BUFFER[6]:=100;BUFFER[7]:=117;BUFFER[8]:=114; BUFFER[9]:=101;CUR←NAME:=ID←LOOKUP(17);ID←FIRST:=3;BUFFER[3]:=112; BUFFER[4]:=114;BUFFER[5]:=111;BUFFER[6]:=103;BUFFER[7]:=114; BUFFER[8]:=97;BUFFER[9]:=109;CUR←NAME:=ID←LOOKUP(17);ID←FIRST:=4; BUFFER[4]:=114;BUFFER[5]:=101;BUFFER[6]:=99;BUFFER[7]:=111; BUFFER[8]:=114;BUFFER[9]:=100;CUR←NAME:=ID←LOOKUP(18);ID←FIRST:=4; BUFFER[4]:=114;BUFFER[5]:=101;BUFFER[6]:=112;BUFFER[7]:=101; BUFFER[8]:=97;BUFFER[9]:=116;CUR←NAME:=ID←LOOKUP(19);ID←FIRST:=7; BUFFER[7]:=115;BUFFER[8]:=101;BUFFER[9]:=116;CUR←NAME:=ID←LOOKUP(4); ID←FIRST:=6;BUFFER[6]:=116;BUFFER[7]:=104;BUFFER[8]:=101;BUFFER[9]:=110; CUR←NAME:=ID←LOOKUP(9);ID←FIRST:=8;BUFFER[8]:=116;BUFFER[9]:=111; CUR←NAME:=ID←LOOKUP(20);ID←FIRST:=6;BUFFER[6]:=116;BUFFER[7]:=121; BUFFER[8]:=112;BUFFER[9]:=101;CUR←NAME:=ID←LOOKUP(7);ID←FIRST:=5; BUFFER[5]:=117;BUFFER[6]:=110;BUFFER[7]:=116;BUFFER[8]:=105; BUFFER[9]:=108;CUR←NAME:=ID←LOOKUP(21);ID←FIRST:=7;BUFFER[7]:=118; BUFFER[8]:=97;BUFFER[9]:=114;CUR←NAME:=ID←LOOKUP(22);ID←FIRST:=5; BUFFER[5]:=119;BUFFER[6]:=104;BUFFER[7]:=105;BUFFER[8]:=108; BUFFER[9]:=101;CUR←NAME:=ID←LOOKUP(12);ID←FIRST:=6;BUFFER[6]:=119; BUFFER[7]:=105;BUFFER[8]:=116;BUFFER[9]:=104;CUR←NAME:=ID←LOOKUP(12); ID←FIRST:=3;BUFFER[3]:=120;BUFFER[4]:=99;BUFFER[5]:=108;BUFFER[6]:=97; BUFFER[7]:=117;BUFFER[8]:=115;BUFFER[9]:=101;CUR←NAME:=ID←LOOKUP(23); {:65};PHASE←I;PHASE←II;PHASE←III;{86:} IF CHANGE←LIMIT<>0 THEN BEGIN FOR LOC:=0 TO CHANGE←LIMIT DO BUFFER[LOC] :=CHANGE←BUFFER[LOC];LIMIT:=CHANGE←LIMIT;CHANGING:=TRUE; LINE:=OTHER←LINE;LOC:=CHANGE←LIMIT; BEGIN IF NOT PHASE←ONE THEN BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'! Change file entry did not match');ERROR;END;END; END{:86};9999:{[263:]BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'Memory usage statistics: ',NAME←PTR:1,' names, ', XREF←PTR:1,' cross references, ',BYTE←PTR[0]:1);END; FOR CUR←BANK:=1 TO 1 DO WRITE(TERM←OUT,'+',BYTE←PTR[CUR←BANK]:1); WRITE(TERM←OUT,' bytes;');BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'parsing required ',MAX←SCR←PTR:1,' scraps, ',MAX←TXT←PTR :1,' texts, ',MAX←TOK←PTR:1,' tokens, ',MAX←STACK←PTR:1,' levels;');END; BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'sorting required ',MAX←SORT←PTR:1,' levels.');END[:263]; }FILE←CLOSE(WEB←FILE);FILE←CLOSE(CHANGE←FILE);FILE←CLOSE(TEX←FILE); {264:}CASE HISTORY OF 0:BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'(No errors were found.)');END;1:BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'(Did you see the warning message above?)');END; 2:BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'(Pardon me, but I think I spotted something wrong.)'); END;3:BEGIN WRITELN(TERM←OUT); WRITE(TERM←OUT,'(That was a fatal error, my friend.)');END;END{:264}; WRITELN(TERM←OUT);END.{:262}