š¾ Archived View for gemini.ctrl-c.club āŗ ~stack āŗ gemlog āŗ 2022-10-23.Octo.progress.gmi captured on 2023-01-29 at 03:16:30. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
I feel a bit burnt out. I had a good month of relatively clear thinking, but feel a bit brainfogged again. Things that were obvious a couple of weeks ago strain my abilities.
A lot of chores are piling up and I will have to travel shortly. So I am trying to wrap up the loose ends in order to avoid losing the thread of this project. I have a dozen (or more?) directories with projects like this sitting abandoned.
Octo is pretty solid. It has grown beyond a toy, and it's hardly a minimal system even though it's only 2500 bytes of dictionary. Well, to be fair, the table is the same size, and the symbol table is a hair bigger, with 237 symbols defined:
> WORDS decomp decomp1 deco.lit deco.deref deco.bytes tt2 tt1 bench WORDS THEN ELSE IF WHILE UNTIL AGAIN BEGIN branch, 0branch, STRLIT-KEY-HANDLER td regs sys _makepr hd.a16 hd.8 hd1 hd hex32sp hex32sp.2 hex32sp.4 dig2 dig4 dig8 hex32 hex16 hex8 dumpfile sys.slot sys.error.msg sys.msg sys.str ALLOT included MAIN REPL.prompt REPL.step REPL.out REPL.in REPL.debrace state.restore state.save compile.until compile.one 0c, ; : { ( [ ['] & lit, , w, c, ref, erase.range erase [char] HASH.PRIME HASH.BASIS PAD.size PAD LINENO BRACEDEPTH PARENDEPTH THELIT LATEST@ LATEST HEAD.ORIGIN REPL.ptr REPL.buf TRAMP.STRLIT.CHAR SRCBUF.FOFF SRC@ SRC TIB HERE@ HERE DICPTR RUNPTR HAN.SRC.LOG HAN.SRC HAN.OUT HAN.IN BASE XFP head.source see head.name srcfile.seek src.end.set src.end.get src.open ' IMMEDIATE head.new .art .src .flag heads.find.code heads.find.hash heads.scan parse word parse.num parse.neg hash ws SRCBUF.refill \ KEY keyp SRCBUF.reset SRCBUF.clr SRCBUF.get SRCBUF.put ACCEPT compile.dofixupU8 dot.out . digout digits HEXDIGITS emit cr spaces space 2spaces tell puts file.open file.open.ro os.ftruncate os.signal os.close os.seek os.open os.read os.write bye tabe.safemap tabe.wipeup tabe.end tabe.wipemap tabe.map TABEMAP tabe.deref tabe.intern tabe.find tabe tabe.mask 4dup D+ D- swap2 drop2 dup2 stamp wordlen i case loop do parse.digit <lambda> Z; NZ; mem.scan ascode regs.prim break 0< 0= < next for bit.reset bit.set bit.test lzcnt > = push <strU8> strlen lrol <branch> u/mod * _incf4 decf incf *2 /2 rpick DSP / <lit> <litS16> <litU16> <litS8> <litU8> DOVAR DOCONST one four zero RTOS RSP rfree <0branch> <nzbranch> xor or and nip - pop drop + CALLSTREAM execute ABORT PROTECT 2x neg c! w! ! 1- 4+ 1+ rot pick over swap dup w@ c@ dupc@ @ dup@ NOOP.IMM
I can compile code and load files (which can recursively load other files). Many faults are trapped; entering `0 @` actually recovers to the command prompt with an error message and shows where the error was. I can even decompile bytecodes into pretty readable listings:
> 30000911 hd 30000911 F8 F8 F7 FF FE FA FF 00 F6 F6 F5 F5 FD FF FF FD āāāāāāāāāāāāāāāā 30000921 00 EC C0 20 16 DF BF 7F 11 43 FF FE 2D E2 8B 86 āāā āāāāCāā-āāā > $3000911 8 decomp : hd.8 2x : hd.4 2x 2x dupc@ hex8 space 1+ ;
Look above. The first command is a hexdump of bytecodes at 911. Only the first 8 bytes matter here, up to the 00, which is <RETURN> or `;`.
The second command is a request to decompile 8 bytes, and the result is shown below. Several things are worth considering:
Just out of curiosity, do you want to see the table? Octo has a command `td` to dump the table for a particular address, so let's see:
$30000913 td 30000913 F7 FF FE FA FF 00 F6 F6 F5 F5 FD FF FF FD 00 EC āāāāāāāāāāāāāāāā 20000914.F7 300000A6 2x 00 300006B6 30000082 30000693 300006C3 300001EE 30000545 300002F0 300006B9 30000536 30000185 3000053A 30000822 300006F6 30000523 3000025C 300006C6 10 30000658 300006A2 00000000 00000000 00000000 00000000 3000026D 00000000 3000070A 30000705 300002BB 3000013E 300001FE 00000000 300000A1 30000590 20 30000755 00000000 00000000 00000000 00000000 00000000 00000000 30000310 00000000 00000000 00000000 00000000 300006CB 30000301 30000568 3000071F 30 3000023D 30000722 300000F5 300001B8 30000518 30000618 30000349 3000057B 00000000 300006E7 30000592 00000000 3000019C 300006DA 300006E4 300002DC 40 3000060A 3000007C 00000000 300006DF 3000061F 30000620 3000061E 00000000 30000139 00000000 00000000 00000000 300008B8 3000069D 00000000 00000000 50 00000000 300004A8 300004C3 00000000 300006FB 30000664 00000000 3000036C 300005D0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 60 00000000 00000000 00000000 00000000 00000000 00000000 00000000 300006B1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 70 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 30000335 3000052A 80 30000328 3000035A 300003F2 00000000 3000008E 00000000 300001F8 30000278 00000000 00000000 00000000 00000000 3000072F 30000728 00000000 00000000 90 30000406 300006F1 300006AC 00000000 00000000 300007C0 300001F3 00000000 00000000 300006EC 00000000 00000000 00000000 00000000 00000000 300007AE A0 00000000 00000000 00000000 00000000 00000000 30000622 00000000 00000000 00000000 00000000 00000000 300007B1 00000000 00000000 30000115 00000000 B0 00000000 00000000 00000000 30000421 30000032 3000065F 300006D0 3000017A 30000445 3000038D 30000467 30000086 30000801 300006D5 300008BF 300003D8 C0 30000808 30000810 300000FD 30000152 30000194 00000000 00000000 3000081A 3000041C 30000645 30000533 300007D2 00000000 30000510 300007E6 300008C2 D0 300004D4 300004E0 300004E5 00000000 00000000 00000000 00000000 00000000 00000000 3000010E 30000933 300000C9 30000254 300004C8 00000000 300008F1 E0 300004AD 300001DD 00000000 3000005B 00000000 300000E9 00000000 30000105 00000000 00000000 00000000 00000000 300001A4 300001E9 300006B6 30000047 F0 30000700 300004D6 30000143 300008F6 30000223 300008F5 300008F4 300000A6 3000017F 30000134 300004DC 30000911 30000901 30000919 300008E5 30000039
I hope you have a very wide screen to see all 256 entries. Slot $F7 is $300000A6, which is `2x`, as shown above. The table itself is at 20000914. 3000039 is dupc@.
As expected, there are lot's of zeros, because I was very conservative with the sliding table algorithm. It slides one slot for every 4 tokens. The system would work fine with one slot for every 8 tokens, and we would still have zeroes, because a lot of these slots are reused. Remember, all three 2x tokens refer to the same slot! And I'd be surprised if the slot is used in other places as well, as I am fond of 2x.
Ah, it's beautiful to look at.
Sometimes I wonder why I do this. But then I look at this amazing machine chugging away, constructing these tables and indirecting through them without missing a beat, and it makes me feel good.
I miss Lisp, however. I wish I could figure out a way to apply this tech to a Lisp interpreter, but that seems like a much larger project. Or is it? A simple Lisp metacircular interpreter is only a handful of functions, really. And function application is not that different, I suppose, than what I am doing. Hmm..