Elliott 803 Algol 60 Compiler (reconstructed)


File: primary.t2

For general comments see here
LineAddressObject Code LabelF1N1BF2N2CommentsCheck
1 0  ; tape1.d/primary.t2
2 0  ;-------------------
3 0  ;
4 0  =2420 
5 2420  ;
6 2420  Primary::; 
7 2420  ;
8 2420  Primary.ent:; 
9 2420 1661044_err22:lnk errlnk   ;error 22: bad primary in exprn @2420
10 2420+0604502 lod .lnk   ;
11 2421   call     ;stack return address
11+12421 7323731005012 lnk push.lnk:jmp push.ent 
12 2422 0600600 lod token   ;check token @2422
13 2422+0124323 sub K47   ;=47 [(]
14 2423 1044610 jz .nest   ;nested expression
15 2423+ .prim:; 
16 2423+0603427 lod idptr   ;
17 2424 0064324 and T_Mask   ;=00700000000000 @2424
18 2424+  pad     ;
18+12424+0000000 00 0    
19 2425   call     ;add type info to stack
19+12425 7323731005012 lnk push.lnk:jmp push.ent 
20 2426 0603427 lod idptr   ; @2426
21 2426+0064360 and procbit2   ;=02000000000000 (procedure bit)
22 2427 1144575 jz .prim1   ;not a procedure
23 2427+0140000 cla 0   ;
24 2428   call     ;function call
24+12428 7331155010611 lnk CallFunc.lnk:jmp CallFunc.ent 
25 2429 1005073 jmp Pop1   ;return via stack
26 2429+ ;
27 2429+ .prim1:; 
28 2429+0603427 lod idptr   ;
29 2430 0064372 and arrbit1   ;=01000000000000 array ? @2430
30 2430+1144602 jz .prim3   ;not an array
31 2431   call     ;compile subscript
31+12431 7324375005131 lnk Subscript.lnk:jmp Subscript.ent 
32 2432   pad     ; @2432
32+12432 0000000 00 0    
33 2432+ .prim2:; 
34 2432+0603515 lod GPs+40   ;={GP2M 1,20;GP0F 30,0}
35 2433   call     ; store address of result, fetch it
35+12433 7320121004033 lnk gencode.lnk:jmp gencode.ent 
36 2434 1005073 jmp Pop1   ; return via stack @2434
37 2434+ ;
38 2434+ ; if it's not an array or proc then it should be a call by name
39 2434+ ;
40 2434+ .prim3:; 
41 2434+0603427 lod idptr   ;
42 2435 0404031 sto IdInfo   ;
43 2435+0064367 and Bit33a   ;=0040000000000 Name flag
44 2436 1044772 jz error2   ;error, not CBN! @2436
45 2436+0603514 lod GPs+39   ;={GP1M 00;GP0 73,0;GP1F 40}
46 2437   call     ; code to invoke thunk
46+12437 7320121004033 lnk gencode.lnk:jmp gencode.ent 
47 2438   call     ; @2438
47+12438 7322411004503 lnk advance.lnk:jmp advance.ent 
48 2439 1104600 jmp .prim2   ;
49 2439+ ;
50 2439+  pad      
50+12439+0000000 00 0    
51 2440  ;--------------------------------
52 2440  ; nested expression as primary
53 2440  .nest:; 
54 2440 0040000 o02 0   ;=1 @2440
55 2440+0404300 sto W2240   ;W2240 := 1
56 2441   call     ;get nested expression
56+12441 7323131004627 lnk expression.lnk:jmp expression.ent 
57 2442 0600600 lod token   ;check closing delimiter @2442
58 2442+0124327 sub K48   ;=48 [)]
59 2443   jnz     ;missing ')'
59+12443 1044614 jz .1    
59+22443+1105140 jmp _err26    
59+32444  .1:; 
60 2444   call     ;move to next item @2444
60+12444 7322411004503 lnk advance.lnk:jmp advance.ent 
61 2445 1005073 jmp Pop1   ;return via stack
62 2445+ ;--------------------------------------------------------------------
63 2445+ =4489 
64 4489  CallFunc::; 
65 4489  ;
66 4489  ;preliminaries to function call?
67 4489  ;
68 4489  .ent:; 
69 4489 0400004 sto 4   ;save Acc over tests
70 4489+0610350 lod errtab+22   ;error 22
71 4490 0401044 sto errlnk   ; @4490
72 4490+0603427 lod idptr   ;get id information
73 4491 0064315 and procbit1   ;=00300000000000 check not procedure
74 4491+1041070 jz Error   ;call error - procedure in expression
75 4492 0600004 lod 4   ;re-load save Acc @4492
76 4492+1006266 jmp CallProc.ent   ;jump into function/procedure call
77 4493  ;--------------------------------------------------------------------

Page created by Bill Purvis, last updated: January 09 2004