2023-11-11 02:09:52 Any of you guys ever heard of Peter Zeihan? Just watched a video or two of him; he talks a good show. In a little while I'm g oing to search up criticisms of him, which I have no doubt will be there - he's too outspoken on topics too controversial not to have critics. 2023-11-11 02:10:44 In this era of online lying, the only approach that seems sane to me is to try to consume information from as many sources as possible, and then just let it all percolate in my head for a while. 2023-11-11 02:11:21 Make the best gut call about who's shooting straight and who's manipulating I can. 2023-11-11 02:11:36 And maybe they're all manipulating, in which case maybe an "average of all of them" is closer to right. 2023-11-11 02:58:13 KipIngram: I'm working on a cross forth right now and the idea is to be able to write CODE/: words for whole system without trying to bootstrap the compiler/interpreter 2023-11-11 02:58:32 Which I find to be quite ugly and pointless whenever I try it 2023-11-11 03:22:31 Yeah, I'm wrestling with exactly how to approach that first bootstrap as well. 2023-11-11 04:25:46 KipIngram: The idea I have is (not original) try and have vectorised compilation words so I can replace what's necessary to compile to an *image* rather than the dictionary 2023-11-11 04:26:04 But also have a less smart cross forth setup so I can run this from gforth etc 2023-11-11 04:26:35 I'm playing with a visual VM idea at the moment similar to others in here so I will be using C for VM only hopefully 2023-11-11 04:27:09 I'm trying to make the VM 'realistic' too based on my understanding of CPU architecture etc 2023-11-11 04:27:56 I have three main stack ops: PICK / EX / LOSE. These take an immediate parameter within the byte. 2023-11-11 04:28:15 PICK is similar to standard PICK, it places a copy of the nth stack item at top 2023-11-11 04:28:29 EX swaps the n+1th stack item with the top 2023-11-11 04:28:36 LOSE drops n+1 stack items 2023-11-11 04:29:07 And so those three ops are capable of defining quite a few of the more efficient stack operations in one or two ops 2023-11-11 04:30:27 Initial sketch: https://termbin.com/17s6 2023-11-11 04:31:10 The 'INLINE' word is interesting, at that point it sets a field for the word to the number of bytes so far in this def 2023-11-11 04:31:18 Which is how much is inlined by compiler 2023-11-11 04:31:43 Which means I can then write more code after INLINE that's only run by interpreter or via the xt 2023-11-11 04:31:55 So I can get >R etc to work at interpreter 2023-11-11 04:43:21 One of the other advantages is I can build LOCATE references with readable forth code 2023-11-11 05:00:40 veltas: by "vectorised" you mean using vector units? 2023-11-11 05:01:18 It just occurred to me that if you keep the top few elements of the stack in a vector register, you can use register shuffles for many stack ops 2023-11-11 05:07:52 It's probably not a good idea though, you wouldn't be able to do memory ops on the elements in the vector register like fetch and store 2023-11-11 07:41:03 Hey, that's still some outside the box thinking there, though. 2023-11-11 08:24:29 So, I'm thinking to implement this "compiler vocabulary" alternative to immediacy just means having two PATH variables. PATH and CPATH, for example. And the last vocabulary in the CPATH list will just point to the first voabulary in the PATH list, so it still seaches like a single list. So, when were compiling, search CPATH; when not, search PATH. 2023-11-11 08:25:03 The syntax of manipulating vocabularies would need to make it possible to target either one of them. 2023-11-11 08:26:17 That would "work," but it does seem to me it would make things a little more clunky. Instead of just putting IMMEDIATE after a defined word, pre- and post- path manipulation would be required. 2023-11-11 08:27:21 I suppose one could still use the keyword IMMEDIATE, but what it would do would be to move the word. That probably also has clunky aspects. And would there be just one compiler vocabulary, or one for every normal vocabulary? 2023-11-11 08:28:16 Since I'm wanting to separate my vocabularies from one another, I couldn't use "just one" compiler voc across the board. 2023-11-11 08:28:36 Definitely some bookkeeping hoops to jump. 2023-11-11 08:31:16 Probably the thing to do is just give vocabulary words two fields, a path field and a cpath field. That way at least when you manipulate vocabularies you're handling them both at once and they go in pairs. 2023-11-11 08:31:49 And then yes; you could still use IMMEDIATE and have it just take the last word in the vocabulary and shift it to the cpath list. 2023-11-11 08:33:26 So a voc is a list with two entry points. 2023-11-11 08:34:32 Maybe. :-| 2023-11-11 08:37:57 If those fields come one after the other and link the way i mentioned above, then one could fetch the normal interpreter field from the voc word and then just say something like state @ cells + to get to the other pointer if we're compiiling. 2023-11-11 08:56:28 I saw somewhere something called :IMM short for :IMMEDIATE that marked the word being defined as such, there were no compile-only words per saydirectly supported by the system 2023-11-11 08:57:26 which meant that you could have words that were traditionally compile online act a bit different when interpreted 2023-11-11 09:18:52 Yeah, I've been known to shorten IMMEDIATE to IMMED. I think I like that IMM even better. :-) 2023-11-11 09:20:59 veltas: What I'm trying to work up, re: bootstrapping, is to have my C code first search the "word list so far" for each word it finds in the source. If the search succeeds, it will "emulate" the associated operations. If the search fails, then the C program will interpret the word itself (or throw an error if I'm compiling). 2023-11-11 09:21:32 The idea would be to grow the dictionary progressively, and the handling of things would gradually shift from the C code to emulation of defined stuff. 2023-11-11 09:22:20 Once I'm "done," it should no longer ever be falling through to C handling. At some point the compiled code would take over the whole job, including parsing out the next word, etc. 2023-11-11 09:23:31 The C would launch the QUIT loop, and control would just never come back. 2023-11-11 09:25:02 Well, control would never come back to the "high level C stuff" - the "vm instruction" stuff would still get called. 2023-11-11 09:27:34 On startup the whole RAM array will be initialized to zero, so it will be able to "search the word list" right from the start - it'll just see zero in the list pointer, interpret that as an empty list, and use the C interpretation. 2023-11-11 09:28:08 The first stuff I'll do is poke the data defining the Forth vocabulary into ram, etc. 2023-11-11 09:51:06 GeDaMo: The vectorisation I mean is the Starting FORTH sense of vectored execution where you store the xt in a cell so you can change its functionality if needed 2023-11-11 09:52:36 Ah 2023-11-11 10:29:26 :-) Yeah - I bet that was a little befuddling if you were trying ti interpret it as a physics vector. 2023-11-11 10:51:19 I tend to use IMM for the IMMEDIATE flag 2023-11-11 10:51:39 So the actual value stored in the flags or name length field is IMM 2023-11-11 10:51:46 And IMMEDIATE sets that 2023-11-11 10:58:09 2-ROT or -2ROT 2023-11-11 11:36:43 I generally keep my flags in my link cell. 2023-11-11 11:37:59 But I'm looking at getting rid of that cell this time, so it'll have to move. I may put it in the CFA cell this time, since this time it's not something that will ever be fetched at runtime. The need to mask it won't cause a runtime efficiency hit. 2023-11-11 11:39:49 In older days I kept the flag in the count byte, like "tradition.' 2023-11-11 11:40:17 But getting it out of there is nice because it makes the names "standard counted strings" that I can pass to an s= word. 2023-11-11 11:42:53 This time my headers are just going to be <32-bit CFA>. 2023-11-11 11:44:47 so I don't need a link field - if I have the address of a header, I can get to the next one via 4 + dup c@ + 4 + 3 not and 2023-11-11 11:46:38 though in my usual words that would become 4+ .c@ + 4+ 3 not and 2023-11-11 11:48:30 or maybe 4+ .c@ + 4+ 3 ~ & 2023-11-11 11:51:44 The two least significant bits of the CFA are good for flags since it's always going to point to a 32-bit aligned address. 2023-11-11 11:53:27 Those names will grow down from the top of a memory region. I'm thinking of using a cell at the low end of such a region to store the data field size - in this case 4. Then I can use such structures to store arbitrary key/value tables. A vocabulary would just be a special case. 2023-11-11 11:54:09 And such a table could be hash indexed with a separate hash table - if that exists its address would be stored down there in the low end as well. 2023-11-11 11:54:46 That will give me the basis of a general dictionary (in the python sense) facility. 2023-11-11 11:55:09 That I can work with at state-of-the-art speed. 2023-11-11 12:07:33 Ugh. My daughter's dog got attacked by another dog. Girl had just adopted the other dog earlier in the day, so I'm sure he was all stressed, and he slipped his collar. 2023-11-11 12:07:57 Sounds pretty bad; some of the injuries are around my daughter's dog's eye. :-( 2023-11-11 12:08:14 So I'm sitting here now waiting to hear more from her. 2023-11-11 12:08:43 I haven't met this dog, but I know how I feel about my animals som I'm kind of aching for my kid. 2023-11-11 12:09:00 s/som/so/ 2023-11-11 12:11:08 Re: the vocabulary stuff, I'm debating about whether or not to try for 16-bit CFAs on the MAX32655. It's not really ideal, since the thing has 128kB RAM rather than 64kB. But it might be workable to keep code in the low 64kB and have the top half be exclusively data. 2023-11-11 12:14:48 Pfft! Nobody needs more than 64K of code :P 2023-11-11 12:21:38 Well, you jest a little, but... exactly. 2023-11-11 12:22:31 64K is way more than most people realise 2023-11-11 12:22:43 But not enough for some real applications I can think normal people would want to do 2023-11-11 12:28:15 KipIngram: Wow that really sucks re dog, I hope they recover alright and your daughter's okay 2023-11-11 12:29:13 Yeah I think as soon as you want more than 2-3 flags you might as well make names a normal counting string 2023-11-11 12:40:35 If I go over two it will start to cut into my address space. 2023-11-11 12:43:14 I'd already decided to have a separate, normally empty vocabulary for .: / .wipe words, that is permanently at the start of the path list. That eliminated the need for a header bit to mark those words. 2023-11-11 12:43:29 Just define .: words there and then empty the whole thing on .wipe. 2023-11-11 12:44:29 And this compile vocabulary approach eliminates the need for an immediate bit. 2023-11-11 12:45:39 And I'm doing my looping words in a different way this time, that will eliminate the need to compile an offset after them - that gets rid of a bit too. 2023-11-11 12:49:30 So, in the low end of these vocabulary blocks I'll have a) the size of the block (so I know where the top is), b) the size of the "value" field of each entry, c) the offset of the last item I added (how far down into the block it's grown, and d) the (possibly null) address of the hash index block. 2023-11-11 12:49:57 With a separate compile vocab what does ' do? 2023-11-11 12:50:15 You ignore it when STATE=0 and search it firsT IF STATE=1. 2023-11-11 12:50:34 Oh, I see what you're asking. 2023-11-11 12:50:38 Misunderstood at first. 2023-11-11 12:50:44 That's a good question, isn't it? 2023-11-11 12:50:54 I'm not just a pretty nick 2023-11-11 12:51:12 I've never actually DONE this - there may be quirkS I discover if I try it. 2023-11-11 12:51:17 I'm not necessarily sold on it yet. 2023-11-11 12:51:31 earlier this morning I was seeing some of its rough edges. 2023-11-11 12:52:00 Started to get the feel that it's all well and good, but that actually USING it might be cumbersome. 2023-11-11 12:52:27 That's the thing, I've seen the alternatives, I just think IMM bit is simpler and well understood 2023-11-11 12:52:44 At compile time the system will know how to use it transparently, but at edit time you'd be having to muck around with those vocabularies all the time. 2023-11-11 12:52:59 And that feels clumsy compared to just slaping IMM after a definition. 2023-11-11 12:53:04 slapping 2023-11-11 12:53:11 If interpreter/compiler need different defs then just use different names 2023-11-11 12:53:24 This is approach standard took initially and they should have stuck with it 2023-11-11 12:53:29 Yeah. But it also comes up in meta-compiling. 2023-11-11 12:53:46 Interpreted words need to be host - compiled words need to be target, etc. 2023-11-11 12:54:16 And when you metacompile you do want to be able to create target names that are the same as the host names. 2023-11-11 12:54:38 It was metacompiling that got me interested in it to start with. 2023-11-11 12:54:56 Because I've bumped into some of those problems on earlier fumbling first steps on trying to meta-compile. 2023-11-11 13:06:28 Hmmm. Looks to me like you'd need three levels when meta-compiling. Interpreted words need to be found in the host dictionary. Compiled words need to be found in the target dictionary. And then you might have immediate words, that get interpreted in spite of STATE=1, which would also need to be found in the host dictionary. 2023-11-11 13:06:35 So that looks like three vocabularies to me. 2023-11-11 13:07:37 In that situation something like IF would need to get found in the host dictionary, but would need to compile a jump from the target system. 2023-11-11 13:38:13 I guess it's one of the nice features of Forth's vocabulary concept - it can accomodate a setup that nuanced. 2023-11-11 13:45:56 Maybe when you create a vocabulary you should be able to specify whether or not it's a "compile only" vocabulary. 2023-11-11 13:47:49 So you'd have your regular Forth vocabulary at the bottom of the list. Then your target vocabulary will go on top of that as a compile-only vocabulary, and when compiling you'd have it be CURRENT too. And then you have a vocabulary on top of THAT with "run on host / compile to target" immediate words that tell the host how to build the target system. 2023-11-11 14:49:41 So, what I figure I'll do here is lay out my address space, which will tell me where the Forth vocabulary will be, use ! to poke an empty vocabulary in there, and then use whatever words I design for inserting into dictionaries to put new words in. As soon as stuff shows up there it'll strt getting considered for emulation while processing further source.