2024-01-14 15:31:22 That sounds like how i felt about my gcc-based Forth by the time I got it really working. 2024-01-14 18:23:48 after sleeping on it, i think i have an idea about how i could make it clearer in version 2. instead of code words being plain forth, i should define a vocabulary of forth words that look sort of like assembler for a virtual machine. sort of the llvm ir concept, i guess, but the vm is specifically a forth machine 2024-01-14 18:27:11 i.e. instead of writing like code docol Mip @ M>r Mw @ >pfa Mip ! end-code i should be writing something more like code docol ip push, pfa (w) jmp, end-code not sure if that's exactly how i'd model it, but you the idea 2024-01-14 18:44:58 zelgomer: metaforth because youre writing your forth in gforth or some other existing forth? 2024-01-14 18:47:18 MrMobius: i'm writing it in my own forth that was written in assembler because i haven't done a very good job of seeing ahead. there's been a lot of discovery for me 2024-01-14 18:47:37 interesting 2024-01-14 18:48:06 i've considered going back to square one and rebuilding my assembler forth to be meta-capable, either another version in assembler or a new one in c, but i actually don't think that buys me much, so i've chosen instead to just keep trucking forward 2024-01-14 18:48:45 so in this version you have a small number of primitives in assembly and youre writing the rest of the primitives in forth from those? 2024-01-14 18:49:35 my end goal is to have a compiled binary which is a meta interpreter - meaning it can parse and compile words at runtime, like a scripting language. but it'll have some kind of hooks (details unclear to me atm) where you can say "now produce a program image using this word as the entry point" and it will walk the graph and spit out a compiled binary for whatever target you specify 2024-01-14 18:50:49 MrMobius: in my current version, i have a core word set which is an intermix of assembly primitives and high-level words; which are which wasn't given much thought, it was basically "what's easier to implement". in my meta layer forth, i'm trying to keep the number of primitives to a minimum so that the bar for retargetting is kept low, and most words are high level 2024-01-14 18:54:08 there is actually an elephant in the room that i'm neglecting until it becomes a problem (and it will), though 2024-01-14 18:55:17 because of the way i'm doing it, where i obscure what's compile-time versus what's cross-compiled runtime, you can manipulate variable values or data structures at compile time which will eventually end up in the target image. this is fine, that's actually what i want. the trouble is going to come when you try to write an address to a variable or data structure. 2024-01-14 18:55:47 i'm going to need some way of either tracking value types, or some way to give the compiler hints, "hey this value will need target address translation at compile time" 2024-01-14 18:55:53 not sure how to do that nicely yet 2024-01-14 18:56:25 you can see how i quickly find myself on a slippery slope of going way beyond KISS, which is why i kind of question the effort entirely 2024-01-14 18:58:58 crc and i were talking a few weeks ago about the classic way to do cross-compilation: you just have some words like { and } to switch between host and target. but i'm not satisfied with this because it means that if i write a library, and then include that library in the target just so that i can use a small part of it, the entire library gets copied into the target image, including parts i'll never use. 2024-01-14 18:59:05 i want my compiler to be able to bring in only the used parts of libraries so that i can, for example, write a common math library that i use for several projects 2024-01-14 18:59:48 i don't see how i can achieve something like that without going into the more abstract 2024-01-14 19:02:38 ive thought about that since some forth system just copy everything possible into the binary by default so it's enormous 2024-01-14 19:03:07 yeah, in which case: what's the point? i might as well use c :) 2024-01-14 19:03:17 I suppose you could keep track of which symbols are referenced and leave everything else out. youd need source for the libraries or at least symbol names 2024-01-14 19:03:24 hehe, say it aint so 2024-01-14 19:13:04 somehow the words "Forth" and "enormous" just don't go together for me. 2024-01-14 19:13:21 But I guess I see your point - in a really small embedded system you'd like to have only the code you needed. 2024-01-14 19:13:32 teraFORTH? :P 2024-01-14 19:17:53 Or mecrisp across - it does a good job with that. 2024-01-14 19:28:04 ya mecrisp across is good 2024-01-14 19:29:05 there was a forth for the HP-100LX that did that for example. it has 640K ram so not a tiny microcontroller but you have to really fit a lot in there so I lost interest 2024-01-14 19:29:28 even if it's only 20K or something, that's too big in my opinion