Close

And a Very Merry (Blaise), Christmas to You Too.

A project log for Prometheus A.I.

One set of rings that will control all.

glgormanglgorman 11/28/2022 at 03:320 Comments

As previously discussed, the C++ port of the UCSD Pascal compiler now generates something that looks like a binary image, even though I don't have a p-machine to run it on, quite yet.  (Easy weekend project?) Yet that doesn't mean that these waters aren't swarming with types (hopefully) that wouldn't enjoy a core dump, or a hex dump or two., even if just for proof of concept.  Right now I think that simple assignments BEGIN-END, CASE,  FOR, GOTO, IF, REPEAT, and WHILE are working, but accessing members of RECORD types, and use of the WITH statement is still broken.  But in any case: here is a simple test program for proof of concept.

(* TEST PROGRAM *)
(*$T+*)
(*$U-*)

PROGRAM TEST;

 TYPE
    DATETIME = RECORD
        YEAR, MONTH, DATE: INTEGER;
        HOUR, MINUTE, SECOND: INTEGER;
    END;
 
 VAR HUEY, DEWEY, LOUIE: REAL;
    INKY, BLINKY, BASHFUL: INTEGER;
    LUKE, R2D2, C3PO, OBIWAN: BOOLEAN;
       
 PROCEDURE tree;
 
  BEGIN
    WRITELN(OUTPUT,'Where there are birds, there should be trees.');
    WRITELN(OUTPUT,'And hopefully, there should also be eggs!');
    WRITELN(OUTPUT,'A three egg omelette would be nice.');
    WRITELN(OUTPUT,'Ah, but what if there was a snake in the tree?');
  END;
 
 PROCEDURE stormy;
 
 VAR clouds, wind, rain: BOOLEAN;
 
 BEGIN
    (* In the "Big Inning" God createad Baseball! *)
    INKYY := 1;
    BLINKY := 2;
    BASHFUL := -3;
    
    WRITELN(OUTPUT,'So there I was ... ');
    WHILE INKY<5 DO
    BEGIN
      CASE INKY OF
        1: WRITELN(OUTPUT,'It was a dark and stormy night.');    
        2: WRITELN(OUTPUT,'And as the swamp thing staggered from');
        3: WRITELN(OUTPUT,'the crypt .... ');
        4: WRITELN(OUTPUT,'Suddenly there was a need for words.')
     END;
     rain := true;
     INKY:=INKY+1
   END; 
 END;
   
 PROCEDURE oasis;
 
    VAR    msg1, msg2, msg3, msg4,
    msg5, msg6: PACKED ARRAY [1..255] OF CHAR;

 BEGIN    
    msg1 := 'Even as the vultures circled overhead';
    msg2 := 'I pressed onward into the night';
    msg3 := 'Refusing to give up hope';
    msg4 := 'The birds had to have come from somewhere, right?';
    msg5 := 'Right!';
    msg6 := 'And then suddently ... an oasis!'; 
 
    WRITELN(OUTPUT,msg1);
    WRITELN(OUTPUT,msg2);
    WRITELN(OUTPUT,msg3);
    WRITELN(OUTPUT,msg4);
    WRITE(OUTPUT,msg5,' ');
    (* WRITE(OUTPUT,' '); *)
    WRITELN(OUTPUT,msg6);
 END;
 
 PROCEDURE loopy;
 
 VAR I, J, K:INTEGER;
 
  BEGIN
    I:=100;
    IF I=100 THEN
        WRITE(OUTPUT,I);
    FOR J:=0 TO 10 DO
    BEGIN
        WRITE (OUTPUT,'This is a test: ');
    WRITELN (OUTPUT,J)
    END;
    HUEY := HUEY+1;
    K := I+J;
    (* End of This is a test *)    
 END;
 
 BEGIN
    HUEY := 1;
    WRITELN(OUTPUT,'Stormy');
    stormy;
    WRITELN(OUTPUT,'Oasis');
    oasis;
    WRITELN(OUTPUT,'Tree');
    tree;
    WRITELN(OUTPUT,'Loopy --- loop: ',HUEY);
    REPEAT
        loopy;
    UNTIL HUEY=5;
    WRITELN(OUTPUT,'This is only a test');
 END.
 

 And here is a hex dump of the compiler output.   Warning - there are still LOTS of bugs.  Enjoy!

00000000: b60103a62d5768657265207468657265 --> "?!#ª-Where there"
00000010: 206172652062697264732c2074686572 --> " are birds, ther"
00000020: 652073686f756c642062652074726565 --> "e should be tree"
00000030: 732e00cd0013b60103cd0016b60103a6 --> "s. ? 3?!#? 6?!#ª"
00000040: 29416e6420686f706566756c6c792c20 --> ")And hopefully, "
00000050: 74686572652073686f756c6420616c73 --> "there should als"
00000060: 6f20626520656767732100cd0013b601 --> "o be eggs! ? 3?!"
00000070: 03cd0016b60103a62341207468726565 --> "#? 6?!#ª#A three"
00000080: 20656767206f6d656c6574746520776f --> " egg omelette wo"
00000090: 756c64206265206e6963652e00cd0013 --> "uld be nice. ? 3"
000000a0: b60103cd0016b60103a62e41682c2062 --> "?!#? 6?!#ª.Ah, b"
000000b0: 75742077686174206966207468657265 --> "ut what if there"
000000c0: 20776173206120736e616b6520696e20 --> " was a snake in "
000000d0: 74686520747265653f00cd0013b60103 --> "the tree? ? 3?!#"
000000e0: cd0016c100ff0200feff0700ec000200 --> "? 6?  " ? ' ? " "
000000f0: 01b8010b02b8010a039103b80109b601 --> "!?!+"?!*#æ#?!)?!"
00000100: 03a613536f2074686572652049207761 --> "#ª3So there I wa"
00000110: 73202e2e2e2000cd0013b60103cd0016 --> "s ...  ? 3?!#? 6"
00000120: b6010b05c9a15eb6010bb95eb60103a6 --> "?!+%?í^?!+?^?!#ª"
00000130: 1f4974207761732061206461726b2061 --> "?It was a dark a"
00000140: 6e642073746f726d79206e696768742e --> "nd stormy night."
00000150: 00cd0013b60103cd0016b95eb60103a6 --> " ? 3?!#? 6?^?!#ª"
00000160: 25416e6420617320746865207377616d --> "%And as the swam"
00000170: 70207468696e67207374616767657265 --> "p thing staggere"
00000180: 642066726f6d00cd0013b60103cd0016 --> "d from ? 3?!#? 6"
00000190: b95eb60103a60f746865206372797074 --> "?^?!#ª/the crypt"
000001a0: 202e2e2e2e2000cd0013b60103cd0016 --> " ....  ? 3?!#? 6"
000001b0: b95eb60103a62453756464656e6c7920 --> "?^?!#ª$Suddenly "
000001c0: 7468657265207761732061206e656564 --> "there was a need"
000001d0: 20666f7220776f7264732e00cd0013b6 --> " for words. ? 3?"
000001e0: 0103cd0016b95eac01000400b95ec200 --> "!#? 6?^¼! $ ?^? "
000001f0: 94006000420001ab01b6010b018201b8 --> "ö ` B !½!?!+!é!?"
00000200: 010bb9f6c100e6000800feff08001e01 --> "!+?÷? µ ( ? ( >!"
00000210: 0300a6254576656e2061732074686520 --> "# ª%Even as the "
00000220: 76756c747572657320636972636c6564 --> "vultures circled"
00000230: 206f76657268656164a61f4920707265 --> " overheadª?I pre"
00000240: 73736564206f6e7761726420696e746f --> "ssed onward into"
00000250: 20746865206e69676874a61852656675 --> " the nightª8Refu"
00000260: 73696e6720746f206769766520757020 --> "sing to give up "
00000270: 686f7065a63154686520626972647320 --> "hopeª1The birds "
00000280: 68616420746f206861766520636f6d65 --> "had to have come"
00000290: 2066726f6d20736f6d6577686572652c --> " from somewhere,"
000002a0: 2072696768743fa606526967687421a6 --> " right?ª&Right!ª"
000002b0: 20416e64207468656e2073756464656e --> " And then sudden"
000002c0: 746c79202e2e2e20616e206f61736973 --> "tly ... an oasis"
000002d0: 21b6010300cf05b60103cd0016b60103 --> "!?!# ?%?!#? 6?!#"
000002e0: 00cf05b60103cd0016b6010300cf05b6 --> " ?%?!#? 6?!# ?%?"
000002f0: 0103cd0016b6010300cf05b60103cd00 --> "!#? 6?!# ?%?!#? "
00000300: 16b6010300cf05b601032000cd0011b6 --> "6?!# ?%?!#  ? 1?"
00000310: 010300cf05b60103cd0016c1000b0e00 --> "!# ?%?!#? 6? +. "
00000320: feff07001201040064ab03ea64c3a15e --> "? ' 2!$ d½#?d?í^"
00000330: b60103ea00cd000d00ab020acc04e9db --> "?!#? ? - ½"*?$#?"
00000340: c8a15eb60103a6105468697320697320 --> "?í^?!#ª0This is "
00000350: 6120746573743a2000cd0013b60103e9 --> "a test:  ? 3?!##"
00000360: 00cd000db60103cd0016e90182ab02b9 --> " ? -?!#? 6#!é½"?"
00000370: f6b20107b20107bc02018a83b3bd02ea --> "÷?!'?!'?"!èâ??"?"
00000380: e982e9ab01c1006f4a000a00feff0900 --> "#é#½!? oJ * ? ) "
00000390: 68000600c607018abd02daa60653746f --> "h & ?'!è?"?ª&Sto"
000003a0: 726d7900cd0013dacd0016c203daa605 --> "rmy ? 3?? 6?#?ª%"
000003b0: 4f6173697300cd0013dacd0016c204da --> "Oasis ? 3?? 6?$?"
000003c0: a6045472656500cd0013dacd0016c202 --> "ª$Tree ? 3?? 6?""
000003d0: daa6104c6f6f7079202d2d2d206c6f6f --> "?ª0Loopy --- loo"
000003e0: 703a2000cd0013dac607bc020000cf07 --> "p:  ? 3??'?"  ?'"
000003f0: dacd0016c206c607bc02058aaf02a1f6 --> "?? 6?&?'?"%è»"í÷"
00000400: daa61354686973206973206f6e6c7920 --> "?ª3This is only "
00000410: 61207465737400cd0013dacd0016c100 --> "a test ? 3?? 6? "
00000420: 2c001e0000000800940001ff00009c00 --> ", >   ( ö !   £ "
00000430: 00000c01240248030e00000723232323 --> "  ,!$"H#.  '####"
00000440: 23232323232323232323232323232323 --> "################"
00000450: 23232323232323232323232323232323 --> "################"
00000460: 23232323232323232323232323232323 --> "################"
00000470: 23232323232323232323232323232323 --> "################"
00000480: 23232323232323232323232323232323 --> "################"
00000490: 23232323232323232323232323232323 --> "################"
000004a0: 23232323232323232323232323232323 --> "################"
000004b0: 23232323232323232323232323232323 --> "################"
000004c0: 23232323232323232323232323232323 --> "################"
000004d0: 23232323232323232323232323232323 --> "################"
000004e0: 23232323232323232323232323232323 --> "################"
000004f0: 23232323232323232323232323232323 --> "################"
00000500: 23232323232323232323232323232323 --> "################"
00000510: 23232323232323232323232323232323 --> "################"
00000520: 23232323232323232323232323232323 --> "################"
00000530: 23232323232323232323232323232323 --> "################"
00000540: 23232323232323232323232323232323 --> "################"
00000550: 23232323232323232323232323232323 --> "################"
00000560: 23232323232323232323232323232323 --> "################"
00000570: 23232323232323232323232323232323 --> "################"
00000580: 23232323232323232323232323232323 --> "################"
00000590: 23232323232323232323232323232323 --> "################"
000005a0: 23232323232323232323232323232323 --> "################"
000005b0: 23232323232323232323232323232323 --> "################"
000005c0: 23232323232323232323232323232323 --> "################"
000005d0: 23232323232323232323232323232323 --> "################"
000005e0: 23232323232323232323232323232323 --> "################"
000005f0: 23232323232323232323232323232323 --> "################"
00000600: 4900fdfdfdfdfdfd0700030000000000 --> "I ²²²²²²' #     "
00000610: 4a00fdfdfdfdfdfd0700020000000000 --> "J ²²²²²²' "     "
00000620: 4b00fdfdfdfdfdfd0700010000000000 --> "K ²²²²²²' !     "
00000630: 4b00fdfdfdfdfdfd0900000001cd0000 --> "K ²²²²²²)   !?  "
00000640: 4b00fdfdfdfdfdfd0900000001cd0000 --> "K ²²²²²²)   !?  "
00000650: 46575249544552450900070005000000 --> "FWRITERE) ' %   "
00000660: 46575249544552450900000005000000 --> "FWRITERE)   %   "
00000670: 4657524954454445090005000a000000 --> "FWRITEDE) % *   "
00000680: 4657524954454445090000000a000000 --> "FWRITEDE)   *   "
00000690: 20202020202020200000100000000000 --> "          0     "
000006a0: 23232323232323232323232323232323 --> "################"
000006b0: 23232323232323232323232323232323 --> "################"
000006c0: 23232323232323232323232323232323 --> "################"
000006d0: 23232323232323232323232323232323 --> "################"
000006e0: 23232323232323232323232323232323 --> "################"
000006f0: 23232323232323232323232323232323 --> "################"
00000700: 23232323232323232323232323232323 --> "################"
00000710: 23232323232323232323232323232323 --> "################"
00000720: 23232323232323232323232323232323 --> "################"
00000730: 23232323232323232323232323232323 --> "################"
00000740: 23232323232323232323232323232323 --> "################"
00000750: 23232323232323232323232323232323 --> "################"
00000760: 23232323232323232323232323232323 --> "################"
00000770: 23232323232323232323232323232323 --> "################"
00000780: 23232323232323232323232323232323 --> "################"
00000790: 23232323232323232323232323232323 --> "################"
000007a0: 23232323232323232323232323232323 --> "################"
000007b0: 23232323232323232323232323232323 --> "################"
000007c0: 23232323232323232323232323232323 --> "################"
000007d0: 23232323232323232323232323232323 --> "################"
000007e0: 23232323232323232323232323232323 --> "################"
000007f0: 23232323232323232323232323232323 --> "################"
00000800: 01003c04000000000000000000000000 --> "! <$            "
00000810: 00000000000000000000000000000000 --> "                "
00000820: 00000000000000000000000000000000 --> "                "
00000830: 00000000000000000000000000000000 --> "                "
00000840: 5445535400fdfdfd2020202020202020 --> "TEST ²²²        "
00000850: 20202020202020202020202020202020 --> "                "
00000860: 20202020202020202020202020202020 --> "                "
00000870: 20202020202020202020202020202020 --> "                "
00000880: 20202020202020202020202020202020 --> "                "
00000890: 20202020202020202020202020202020 --> "                "
000008a0: 20202020202020202020202020202020 --> "                "
000008b0: 20202020202020202020202020202020 --> "                "
000008c0: 01000000000000000000000000000000 --> "!               "
000008d0: 00000000000000000000000000000000 --> "                "
000008e0: 00000000000000000000000000000000 --> "                "
000008f0: 00000000000000000000000000000000 --> "                "
00000900: 00000000000000000000000000000000 --> "                "
00000910: 00000000000000000000000000000000 --> "                "
00000920: 00000000000000000000000000000000 --> "                "
00000930: 00000000000000000000000000000000 --> "                "
00000940: 00000000000000000000000000000000 --> "                "
00000950: 00000000000000000000000000000000 --> "                "
00000960: 00000000000000000000000000000000 --> "                "
00000970: 00000000000000000000000000000000 --> "                "
00000980: 00000000000000000000000000000000 --> "                "
00000990: 00000000000000000000000000000000 --> "                "
000009a0: 00000000000000000000000000000000 --> "                "
000009b0: 00000000000000000000000000000000 --> "                "
000009c0: 00000000000000000000000000000000 --> "                "
000009d0: 00000000000000000000000000000000 --> "                "
000009e0: 00000000000000000000000000000000 --> "                "
000009f0: 00000000000000000000000000000000 --> "                "

Discussions