2021-11-08 05:02:26 Hello 2021-11-08 05:03:27 Do you guys implement/prefer the newer words like SOURCE, REFILL, or the QUERY, EXPECT, TIB, #TIB? 2021-11-08 05:04:11 (guys and gals and those who feel neither*) 2021-11-08 06:05:59 On another note, does the following make sense to you? For a subroutine threaded x86 Forth, after implementing some number of primitive words, I will write a throw-away text-interpreter and compiler that will load and parse Forth source code in a limited way. The said Forth source will gradually implement the complete text-interpreter and compiler. This throw-away text interpreter and compiler is also called "meta compiler" it seems if 2021-11-08 06:05:59 I'm not mistaken. I am thinking it will only be able to compile colon definitions, execute immediate words, and compile numeric literals. I am doing this to avoid writing the entire text interpreter and compiler in "hardcoded forth". 2021-11-08 06:08:57 i've been implementing forth for years and not up to that yet lol 2021-11-08 06:09:48 Good point, maybe I should just do hardcoded forth way first. And later look into this. 2021-11-08 06:13:19 last week i did a simple EXPECT and INTERPRET and managed to interpret 3 5 + . 2021-11-08 06:14:12 neuro_sys_: have you seen https://github.com/cesarblum/sectorforth 2021-11-08 06:14:21 it is incredibly small :-) 2021-11-08 06:48:16 I had seen, but didn't read the code much, let me check again. 2021-11-08 06:50:33 Indeed, this is pretty much it. 2021-11-08 06:53:12 dave0: I would be happy to see your EXPECT and INTERPRET definitions. 2021-11-08 06:53:33 oh 2021-11-08 06:53:43 hang on 2021-11-08 06:54:42 i wrote it in forth and then "hand compiled" it (like you said) 2021-11-08 06:57:07 No worries. BTW do you adhere to any particular standard at all? 2021-11-08 06:58:16 https://termbin.com/wqn1 2021-11-08 06:58:25 Thanks 2021-11-08 06:58:36 i don't think it is easy to read 2021-11-08 07:00:27 also it doesn't support compiling 2021-11-08 07:00:29 It looks great! How many primitives are there? 2021-11-08 07:00:38 I see compile, there, so it's a primitive I suppose 2021-11-08 07:01:06 the interpet that i posted is not what i've actually compiled 2021-11-08 07:01:49 it only has interpreting 2021-11-08 07:02:05 so everywhere there is state @ is cut out 2021-11-08 07:02:30 yeah interpret does not match the real code at all 2021-11-08 07:03:22 primitives hang on 2021-11-08 07:04:21 49 primitives 2021-11-08 07:05:25 73 things written in forth 2021-11-08 07:06:20 oh wait 2021-11-08 07:07:25 49 primitives and 22 forthy things that is very simple code like dup over swap rot true false bl cr 2021-11-08 07:07:44 the 51 forthy things comes from the file i pasted 2021-11-08 07:07:59 it's a WIP 2021-11-08 07:25:18 neuro_sys_: at first, i used to juggle the stack a lot and use almost no variables 2021-11-08 07:25:42 this code uses a lot more variables to keep the stack simple 2021-11-08 07:26:43 someone here posted a link to a page from chuck moore which said you shouldn't have more than 3 things on the stack, and to stick to dup and over (and chuck said swap is very useful :-) 2021-11-08 07:31:36 it is very far from standard 2021-11-08 07:35:09 once i get compiling working, i can write the rest in real forth 2021-11-08 07:35:49 i can include the forth sourcecode in the assembly, and just interpret it 2021-11-08 07:37:12 also i want a much more featureful expect 2021-11-08 07:37:34 all it has is backspace 2021-11-08 07:37:39 i want arrow keys 2021-11-08 07:38:20 dave0: you got an input line buffer? 2021-11-08 07:38:38 Zarutian_HTC: yes.. tib 2021-11-08 07:38:47 right at the top 2021-11-08 07:39:20 it is actually a 32 bit realmode forth 2021-11-08 07:40:17 and the stacks and terminal buffer and pad are hardcoded to segment $1000 2021-11-08 07:40:35 but i managed to make it work with flat address space 2021-11-08 07:40:39 right, you could make it a gap buffer while it is being edited 2021-11-08 07:40:56 Zarutian_HTC: ah yes like emacs? 2021-11-08 07:41:19 imagine x86 realmode without segments! 2021-11-08 07:41:20 no, I mean gap buffer the data structure kind 2021-11-08 07:41:33 Zarutian_HTC: oh i don't know it 2021-11-08 07:42:19 basically you have an gap that you move around with the left and right arrow keys 2021-11-08 07:43:18 what is a gap? 2021-11-08 07:43:24 not a cursor? 2021-11-08 07:45:00 when you move it to left say, it moves every character, one per left arrow keypress, in front of the gap to the back behind the gap 2021-11-08 07:45:50 ah okay 2021-11-08 07:46:18 as you write/type into that gap, as the cursor is its front, it gets smaller 2021-11-08 07:46:48 have you got a picture of it? 2021-11-08 07:48:08 no, only a wikipedia link https://en.m.wikipedia.org/wiki/Gap_buffer 2021-11-08 07:48:26 clicking! 2021-11-08 07:49:34 and when you press enter you move the gap to the end of the buffer and forth outer interpreter is none the wiser 2021-11-08 07:50:04 ah i see 2021-11-08 07:51:15 i clicked on one of the see-also links 2021-11-08 07:51:20 it mentioned undo 2021-11-08 07:51:29 undo would be a nice feature :-) 2021-11-08 07:52:02 you could also do history buffer if you are so inclined 2021-11-08 07:52:14 yep yep with up and down arrows 2021-11-08 07:53:41 simplest, if you have enough memory, is to set aside say 25 times max tib length and just use that circularly 2021-11-08 07:54:07 nice 2021-11-08 07:54:48 and when up/down arrowing through that, just jump max tib length in that 2021-11-08 07:55:29 yep i set aside a 64k segment for the stacks and 64k low memory i don't touch, which leaves 512k left for everything else 2021-11-08 07:55:48 and i've been testing in dosbox 2021-11-08 07:56:20 eventually i want to make a bootable version 2021-11-08 07:57:13 btw, I have ported eForth to a ?fantasy computer? called dcpu-16. Turned quite interactively usable even in an web based emulator 2021-11-08 07:57:35 cool! 2021-11-08 07:57:45 been years though 2021-11-08 07:58:43 that thing only had 64kibicells where each cell is 16 bits 2021-11-08 07:58:57 web browser surprised me because someone wrote a CoCo emulator in javascript (coco was my first computer :-) and it ran faster than my original computer haha 2021-11-08 08:00:17 Zarutian_HTC: there is https://github.com/scotws/TaliForth2 which runs on a c64 2021-11-08 08:00:52 been looking into, halfheartedly (time constrained), into arduino compatible bootloader for forths for the atmega328p chip 2021-11-08 08:02:17 the usual arduino bootloader lacks user usable program memory write routines 2021-11-08 08:02:45 all bloody inlined as far as I can discern 2021-11-08 08:04:59 and because peeps always ask why atmega328p but not something like stm or whatever? because arduino uno boards are readily available for sale in surprising places 2021-11-08 08:06:33 SOURCE just assumes less about how you're keeping track of input 2021-11-08 08:06:48 Most normal forths will have TIB et al under the hood 2021-11-08 08:08:30 Yes, I have learned to love and embrace variables. 2021-11-08 08:14:51 I've seen it recommended to not use variables but I think really chosing what state needs to be global is a normal tradeoff writing FORTH to avoid the code being unnecessarily complicated 2021-11-08 08:15:17 i.e. I have code parsing a file, might as well make the file a var/constant 2021-11-08 08:21:07 Coming from modern languages I was aversive to using variables initially, but now considering how dictionary works, and word-lists, it seems to be not much of a problem if they're used in a way to simulate local variables for a word, and used as such. 2021-11-08 08:24:37 Ah right, what I'm saying is irrelevant to the main point. To reduce number of elements in stack, yes you need global variables to pass data, such as file descriptor. 2021-11-08 08:28:42 *such as for things like file handle. 2021-11-08 08:46:28 nite all 2021-11-08 08:47:31 Night 2021-11-08 08:47:47 The dream is a modern OS with drivers, GUI and such built entirely on Forth. 2021-11-08 08:47:59 Another dream is an Emacs-like editor written on Forth 2021-11-08 09:01:53 neuro_sys_: Yeah I'm working on a UEFI FORTH thing, I think some other FORTHs can do that already, that's the starting point 2021-11-08 09:02:14 dave0, are you sure TaliForth2 works on c64? iirc it requires a 65C02 2021-11-08 09:02:27 I think it's totally doable and practical to write an OS in FORTH, it should be written with a good understanding of common FORTH multi-tasking primatives though 2021-11-08 09:02:58 It does go against the grain of FORTH in having a very large scope, but at the same time a FORTH system could be a lot smaller than a normal OS, so it would still be FORTHy I think 2021-11-08 09:13:25 Yes. It was the "multiprogramming environment" section in the standards that inkled my fantasy of a Forth OS. And I'm still more enthusiastic about writing high level applications in Forth than writing Forth itself or embedded environment per se (which seems to be majority of interest). 2021-11-08 09:14:01 But still I need to satisfy the mandatory roll your own Forth impulse. 2021-11-08 09:17:52 Also, I guess this is possibly looked down on a bit, but I was thinking of a compile time type checking system for Forth that is similar to C type system. So, not only checking that each word leaves behind a balanced stack (according to their stack signature definition) but also checking that the types match. 2021-11-08 09:23:35 veltas: Is UEFI any more work than BIOS? 2021-11-08 09:24:08 And if so, I'm curious if BIOS (or whatever came before UEFI) is still supported on modern PCs today. 2021-11-08 09:36:00 neuro_sys_, have you looked at RPL on HP calculators? 2021-11-08 09:36:13 type based, "safe" forth-type language 2021-11-08 09:36:44 HP-48G ROM image is free to download from company so you can emulate it and play around if interested 2021-11-08 09:40:25 MrMobius: I haven't, sounds interesting. I will check. 2021-11-08 16:07:49 neuro_sys_: UEFI is easier than BIOS in some ways 2021-11-08 16:08:41 You don't really have a choice though, BIOS being phased out and all that 2021-11-08 16:08:56 Ideally you'd support both