From 4d5e7408cd0584d8772eac882cf7f8a9ca4570e9 Mon Sep 17 00:00:00 2001 From: Jacques Comeaux Date: Fri, 16 Dec 2022 09:44:40 -0600 Subject: Add something like a garbage collector Split heap into temporary "little heap" and permanent "big heap". Defined symbols get copied into big heap, and little heap is reset after each REPL iteration. --- layout.s | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 layout.s (limited to 'layout.s') diff --git a/layout.s b/layout.s new file mode 100644 index 0000000..04a768c --- /dev/null +++ b/layout.s @@ -0,0 +1,89 @@ +^- stack +1000: + init +2000: + read +3000: + eval +4000: + print + 4400: + cons + 4500: + assoc + 4600: + eq +5000: + atom "NIL\0" + 005000 005003 + 005002 044516 ; "NI" + 005004 000114 ; "L\0" + atom "T\0" + 005006 005011 + 005010 000124 ; "T\0" + atom "F\0" + 005012 005015 + 005014 000106 ; "F\0" + atom "QUOTE\0" + 005016 005021 + 005020 052521 ; "QU" + 005022 052117 ; "OT" + 005024 000105 ; "E\0" + atom "ATOM\0" + 005026 005031 + 005030 052101 ; "AT" + 005032 046517 ; "OM" + 005034 000000 ; "\0" + atom "EQ\0" + 005036 005041 + 005040 050505 ; "EQ" + 005042 000000 ; "\0" + atom "COND\0" + 005044 005047 + 005046 047503 ; "CO" + 005050 042116 ; "ND" + 005052 000000 ; "\0" + atom "CAR\0" + 005054 005057 + 005056 040503 ; "CA" + 005060 000122 ; "R\0" + atom "CDR\0" + 005062 005065 + 005064 042103 ; "CD" + 005066 000122 ; "R\0" + atom "CONS\0" + 005070 005073 + 005072 047503 ; "CO" + 005074 051516 ; "NS" + 005076 000000 ; "\0" + atom "LABEL\0" + 005100 005103 + 005102 040514 ; "LA" + 005104 042502 ; "BE" + 005106 000114 ; "L\0" + atom "LAMBDA\0" + 005110 005113 + 005112 040514 ; "LA" + 005114 041115 ; "MB" + 005116 040504 ; "DA" + 005120 000000 ; "\0" + atom "DEFINE\0" + 005122 005125 + 005124 042504 ; "DE" + 005126 044506 ; "FI" + 005130 042516 ; "NE" + 005132 000000 ; "\0" + 5400: + copy + 5600: + big_cons +6000: + symbol table +7000: + print buffer +10000: + little_heap + 010000 010002 ; free pointer +11000: + big_heap + 011000 011002 ; free pointer -- cgit v1.2.3