2021-10-16 03:34:32 wonder what stopped them before. 2021-10-16 06:11:18 he was DUPed into learning it 2021-10-16 12:21:45 Want to try *again* to learn Forth. Who can teach me? It seems to me a bit like functional programming -chaining functions/words together. 2021-10-16 12:23:51 welcome back again dukester 2021-10-16 12:24:08 f-a, thx 2021-10-16 12:24:11 I started w/ Learning Forth by L.Brodie 2021-10-16 12:24:30 and then wrote a half baked crosscompiler for the CHIP-8 2021-10-16 12:24:33 f-a, got it! 2021-10-16 12:26:51 I unfortunately have never the pleasure to use it for something useful 2021-10-16 12:26:53 f-a, Brodie book is good. building a crosscompiler is way down the road for me. 2021-10-16 12:26:59 I suspect you would need to take- no! 2021-10-16 12:27:03 wait, dukester 2021-10-16 12:27:59 https://www.bradrodriguez.com/papers/tcjassem.txt there 2021-10-16 12:28:16 if you do understand a bit of forth, this article is simple and very instructive 2021-10-16 12:28:25 ok I'll check it out 2021-10-16 12:28:48 what I mean is that forth is really graceful in such jobs 2021-10-16 12:29:28 f-a, I'm trying to understand which jobs Forth is graceful in!! 2021-10-16 12:30:36 yeah I I am far from a proficient user 2021-10-16 12:31:18 but many people here debble with SOCs and similar 2021-10-16 12:31:32 I guess forth shines in very tight memory spaces 2021-10-16 12:31:47 So embedded systems? 2021-10-16 12:32:08 I cannot think of another languages giving you so much (compiler, interpreter, possibly an editor, disassembler, etc.) for solittle 2021-10-16 12:32:29 yup. But again, I am not a forth pro, hold tight and listen to other opinions 2021-10-16 12:33:30 ok. I hear about C and C++ for embedded systems, but never hear Forth spoken of in that regard. 2021-10-16 12:36:57 Forth is more of a hobby language nowadays other than a few very niche things 2021-10-16 12:37:05 it doesnt stop us from using it though :) 2021-10-16 12:37:29 so yes basically everything embedded is C/C++ or similar 2021-10-16 12:37:34 MrMobius, I see. What do use it for? 2021-10-16 12:38:13 im working on building a graphing calculator with a 6507 processor from the 70s with 2k of RAM 2021-10-16 12:38:16 MrMobius, but why not Forth for embedded? 2021-10-16 12:38:47 ie also something thats just for fun and not practical 2021-10-16 12:39:21 I get it! It's more of a toy language these days? 2021-10-16 12:39:23 im working on building a graphing calculator with a 6507 processor from the 70s with 2k of RAM ← you wouldn’t be *able* to do that with C 2021-10-16 12:39:51 https://collapseos.org/forth.html collapseos is using forth too 2021-10-16 12:40:19 also learning it clarified immensely what a compiler/interpreter is 2021-10-16 12:40:22 and memory etc. 2021-10-16 12:40:28 dukester, depends on who you ask. a lot of people think it's just because it never caught on and would have replaced C if it had enough exposure. i think it's more so the huge loss of performance in using Forth and the difficulty of reading and maintaining source code 2021-10-16 12:41:30 nah, you could make a much faster calculator in C even with 2k ram. the only thing you might gain in Forth is smaller firmware size. also Forth is the language built into the calculator which works well when you only have a few K ram 2021-10-16 12:41:38 MrMobius, thanks for your candor! 2021-10-16 12:41:54 MrMobius: would you get an interpreter for free? 2021-10-16 12:42:02 and being able to program *on the machine* itself? 2021-10-16 12:43:09 f-a, you wouldnt get an interpretter for free but youd get a much faster one and certainly be able to program on the machine itself which has been the case for 30 years or so 2021-10-16 12:43:23 but in BASIC or Lua or something not running a C compiler on the machine itself 2021-10-16 12:43:45 basic in 2k? lua in 2k? 2021-10-16 12:43:56 2k ram, not 2k firmware 2021-10-16 12:44:12 basic in 2k ram? lua in 2k ram? :P 2021-10-16 12:44:12 you couldnt make a nice calculator in 2k of forth firmware for that matter 2021-10-16 12:44:51 of course :) 2021-10-16 12:45:42 although you can run a C compiler on a 20 year old calculator just fine 2021-10-16 12:46:05 dukester, anyway, dont be dissuaded! Forth is really fun for all kinds of hobby things 2021-10-16 12:47:06 MrMobius, I'll give it another try. I was hoping to see it shining still for embedded systems. Oh well ... 2021-10-16 12:48:59 So IS programming in Forth a bit like functional programming? One function feeds another etc? Or word feeds another word? 2021-10-16 12:49:29 until your stack explodes 2021-10-16 12:49:42 then it is like putting a turd in a fan 2021-10-16 12:49:50 LOL 2021-10-16 12:52:07 dukester: more like function level programming 2021-10-16 12:52:17 kinda 2021-10-16 12:52:47 jedb, what do you mean by function level? 2021-10-16 12:53:43 programming by way of composing functions with little to no direct reference to parameters of those functions 2021-10-16 12:54:47 jedb, I see - sort of. So the parameters are taken off the stack then? 2021-10-16 12:55:07 yup 2021-10-16 12:56:22 OK - I've always struggled with HOW a Forth program is conceived. Start with a word and build from it? 2021-10-16 12:57:13 yup usually Forthers go from bottom up. word/test/word etc. 2021-10-16 12:58:53 f-a, ok seems simple enough. It's all the swap-ing and dup-ing etc etc that boggles my mind as well. :/ 2021-10-16 12:59:41 stack manipulation I guess. Like GC in other languages? 2021-10-16 13:00:09 dukester, dup, swap, etc is a good place to start. if you can get a forth installed, entering numbers and playing with those will elucidate a lot 2021-10-16 13:01:29 MrMobius, done that? BUT when do I use it or need to it in a program? That's my issue. I don't get when I need to use it. 2021-10-16 13:03:16 of course you will need it dukester 2021-10-16 13:03:29 arithmetic is what most programs are about :P 2021-10-16 13:04:13 dukester, do you know any other programming languages? 2021-10-16 13:04:37 f-a, I'm used Perl to build web back-ends with very little math required. :-) 2021-10-16 13:05:24 MrMobius, I a fair hand in C, Perl some LISP (newLisp) some Ruby 2021-10-16 13:06:56 ok great. so imagine in C if you had "printf("%d",X*X+3*X-5);" 2021-10-16 13:07:15 OK 2021-10-16 13:07:19 how would you rewrite it in Forth? 2021-10-16 13:07:32 ?? 2021-10-16 13:07:50 could you rewrite that one line of C code in Forth? 2021-10-16 13:08:23 I'll have to review Bridie's book first! LOL 2021-10-16 13:08:28 hehe 2021-10-16 13:09:02 one way you could do it is X @ DUP DUP * SWAP 3 * 5 - . 2021-10-16 13:09:10 Seriously! It's been a while since I looked at Forth. I wanted to give it another try 2021-10-16 13:10:15 OK - let's stop there! I now have something to work and compare to something I know. Let me hit the books! 2021-10-16 13:10:57 good idea. also, the X @ part is a literal translation. you likely wouldn't need to assign the value to X the way you do in C. just something to keep in mind 2021-10-16 13:11:46 MrMobius, thx for the coaching. 2021-10-16 13:12:37 BTW - using gforth! 2021-10-16 16:35:46 The advantages of FORTH mostly seem to be controlling and understanding the whole thing, down to the bits. No compiler dragons required 2021-10-16 16:36:05 I guess it is also quite powerful in terms of reflection, controlling compilation etc 2021-10-16 16:36:14 And succinct 2021-10-16 16:36:51 It's the number one programming language that people would probably learn a lot from but don't know about, whether they'd actually use it in their day-to-day is another thing. 2021-10-16 16:39:50 excellent explanation veltas 2021-10-16 17:07:37 He's not here now but I just thought I'd share anyway lol 2021-10-16 17:07:47 He/she