2024-05-27 15:19:09 Yeah when you interpret a block the block's buffer is the input buffer, when you interpret at the 'interpreter' a line is the buffer 2024-05-27 15:20:09 So the next line isn't loaded when you parse with CREATE , it should just fail if there's nothing on same line 2024-05-27 15:21:40 why would't it just block inside of the "word" called from create until you enter the next line? 2024-05-27 15:22:36 There are forths that do that 2024-05-27 15:22:47 Probably only legacy reasons why it isn't that way in the standard 2024-05-27 15:23:06 Classic forths don't do this I think, probably because there was no grand unified 'REFILL' thing 2024-05-27 15:23:24 mine does, which is why i'm surprised they wouldn't all do it 2024-05-27 15:24:13 if your parsing is done at the callee level then it just happens naturally 2024-05-27 15:28:54 All you have to do with a standard-style forth is make e.g. PARSE use REFILL, and it makes QUIT simpler as well 2024-05-27 15:29:02 It's just not standard for some reason 2024-05-27 15:29:11 I think it's historical 2024-05-27 15:30:41 There's even exceptions for words like ( to make them parse more than one line in files 2024-05-27 15:31:30 that sounds kludgy 2024-05-27 15:31:50 The standard is full of kludge 2024-05-27 15:31:55 That's why I don't like it 2024-05-27 15:41:40 It is a monument of compromise 2024-05-27 16:25:33 I guess one reason is that e.g. 1 WORD is expected to parse the rest of the line 2024-05-27 16:25:59 Or CHAR ^ WORD for editor example 2024-05-27 16:35:25 Are there ways to indent forth code to get around the hard-to-read post-fix notation? 2024-05-27 16:36:29 The main way to visually group words like you would with e.g. brackets is using extra spaces 2024-05-27 16:36:46 e.g. 2 or 3 spaces to show some words are 'grouped' 2024-05-27 16:37:23 The other way is factoring, as usually any group of words can just be cut and pasted into a word def above the current def 2024-05-27 16:38:38 You'll see in Starting Forth there is a style to group words in IF..THEN or BEGIN..UNTIL etc constructs that might be a little unfamiliar 2024-05-27 16:38:51 Some people use groupings/indents more like C or other code 2024-05-27 16:39:26 And if you've got a quotation-heavy forth like retro I could imagine using quotations for visual grouping 2024-05-27 16:39:49 And KipIngram's forth has a balanced stack grouping feature that uses brackets or parens or something as well 2024-05-27 16:40:04 Brackets or braces (?) 2024-05-27 16:40:49 what about mathematical calculations? e.g. 100 1 "purchase_price" "selling_price" / - * 2 round 2024-05-27 16:40:59 that's margin of profit per article 2024-05-27 16:41:17 idk, maybe just new lines 2024-05-27 16:41:44 And indentation 2024-05-27 16:41:54 1 PURCHASE SELLING / - 100 * 2 ROUND 2024-05-27 16:42:05 :d 2024-05-27 16:42:15 Maybe maybe, not too bad :) 2024-05-27 16:42:25 So see I group PURCHASE SELLING / together and then combine ops where possible to make the postfix less difficult 2024-05-27 16:42:59 Well you can see what I've done anyway..... 2024-05-27 16:43:10 I explain the answer worse than the answer itself 2024-05-27 16:43:58 olle: I tend to use lines to track stack contents, if it's 'trivial' or 'mostly-algebra' I'll put it all on one line 2024-05-27 16:44:22 If the stack contents is ever different by the end of the line I'll comment it in a new stack comment 2024-05-27 16:44:45 Unless it's the 'end' of a construct / word because then it's implied by outer comment or the word's stack comment 2024-05-27 16:45:10 And I don't comment return stack if I can help it, that should mostly be used like a push/pop situation which should be easy to remember 2024-05-27 16:45:34 That's what I've settled on in my quite verbose forth style, in my less verbose style I use more variables/words if it gets too hard 2024-05-27 16:46:12 If you ever get stuck just post it here, there are people here who are happy to refactor and format what you've written and will do a 10x better job than me 2024-05-27 16:46:31 Oh this is just for my DSL project :) 2024-05-27 16:46:43 Wondered if Forth-like DSL can be made more readable or not 2024-05-27 16:46:51 Forth's postfix is more readable than other langs a lot of time 2024-05-27 16:47:47 e.g. what's more readable for specifying your TTY: cols 80 rows 40 baud 115200 or 80 COLS 40 ROWS 115200 BAUD 2024-05-27 16:48:40 You just have to lean into the postfix and understand its strengths 2024-05-27 16:49:26 This is why people bang on about Forth being a DSL-generator, because you can define any 'word' to do literally anything you want, and it's relatively easy to support all sorts of numbers and strings in the parsing too 2024-05-27 16:52:28 In some cases sure 2024-05-27 16:52:48 But my example above kills it :d 2024-05-27 16:54:14 S-expr is more like already existing notation 2024-05-27 16:57:21 Sad to say, I like my little Forth-inside-PHP engine ^^ 2024-05-27 16:58:02 S-expr isn't much better than postfix when you're used to it 2024-05-27 16:58:14 Both are way harder to work with for non-tech people that are used to normal algebra 2024-05-27 16:58:25 Sure, but I need semi-tech people to get used to it ;) 2024-05-27 16:58:28 So need a lower threshold 2024-05-27 16:59:25 "way" harder? Depends on which changes they are expected to make in a small script. 2024-05-27 17:00:28 Yeah 2024-05-27 17:00:45 I'm working on an example for you that you might like 2024-05-27 17:00:57 friendlier syntax closer to S-expr, simple to implement in forth 2024-05-27 17:08:56 Yea? :) 2024-05-27 17:11:34 : compliment 1 swap - ; : % 100 * 2 round ; purchase selling / compliment % 2024-05-27 17:12:14 olle: https://termbin.com/jyyq 2024-05-27 17:12:42 Use a separate stack if you want return stack free for other things 2024-05-27 17:12:46 Oh is this S-expr in forth? :D 2024-05-27 17:13:11 zelgomer: oh not bad 2024-05-27 17:13:45 Might need some stack juggling for order of args, but in else nice 2024-05-27 17:13:50 -in 2024-05-27 17:14:03 Oh you did swap 2024-05-27 17:14:05 Sorry 2024-05-27 17:16:30 Anyway so you can have essentially s-exprs in forth with 3 lines of code 2024-05-27 17:19:17 Kewl :) 2024-05-27 17:19:32 I would put them in a different stack tho 2024-05-27 17:19:39 To allow return stack usage 2024-05-27 17:19:51 But for your purposes that's unnecessary anyway 2024-05-27 17:20:12 Well actually maybe not, if they want do loops 2024-05-27 17:24:20 I don't want to waste your time, but I actually do not have access to a full forth system, only what I can write in ~50 lines of PHP 2024-05-27 17:27:18 Still, saved your notes :) 2024-05-27 17:35:06 https://termbin.com/cp8s 2024-05-27 17:35:11 With separate stack 2024-05-27 17:35:33 That's fine, I don't have any expectations 2024-05-27 17:35:57 The notes are useful outside of what you're doing, probably 2024-05-27 17:40:25 Okay one more https://termbin.com/foza 2024-05-27 17:40:28 Done 2024-05-27 17:40:42 I'm sure this has been done many times before now 2024-05-27 17:48:42 https://termbin.com/l56i 2024-05-27 17:49:22 There is a satisfaction to refining things in Forth 2024-05-27 19:30:50 olle: What veltas is referring to, I think, is my stack frae setup. I reserved a register I call the frae pointer. The word { saves FP on the return stack and copies SP to FP. The word } restores SP from FP, recovers old FP from the return stack, and additionall takes a parameter and drops that many additional stack items (that's kind of "extra" function - not strictly related to the frame system). 2024-05-27 19:30:53 So in between { and } you can use index off of FP in a fixed and immovable way. 2024-05-27 19:31:41 I don't use any sort of indentation with it, though - most of my definitions are one-liners. 2024-05-27 19:31:50 45-50 chars. 2024-05-27 19:45:08 The main purpose of the thing was to allow me to index into the stack on occasions where I just couldn't figure out a ood way to avoid it. But the bit where it restores the stack pointer turns out to be a really nice way to clean up the stack - even if I've got several return paths with different amounts of junk on the stack, it cleans it up properly regardless. 2024-05-27 19:45:26 I wasn't really "expecting" that perk, but I've quite enjoyed it. 2024-05-27 21:26:37 crc: Is it possible to get a zip of all the IRC logs? 2024-05-27 21:29:48 like every single day of ##forth logs? 2024-05-27 21:29:55 forth.chat/allctar 2024-05-27 21:30:42 forth.chat/all.tar.gz 2024-05-27 21:30:44 http://forth.chat/ 2024-05-27 21:31:10 compressed,amazingly 48 megs 2024-05-27 21:31:22 text is such a nice 'format' 2024-05-27 21:31:25 that has all the ##forth and #retro from liberav and the old #forth and #retro from freenode 2024-05-27 21:41:47 Thanks 2024-05-27 21:48:00 Was just looking at old logs with my wife, she was wondering when I joined this channel, she seems to remember it was from near when we got together 2024-05-27 21:48:05 And she's right 2024-05-27 21:48:26 Near start of lockdowns 2024-05-27 21:49:09 Was just remembering also there used to be a good ZX Spectrum IRC channel but there's no good ones now I think, lots of good Z80 assembly advice from them 2024-05-27 21:49:20 I also got good general assembly advice from 6502 people 2024-05-27 21:53:25 About half the regulars seem to have moved on since then 2024-05-27 21:59:58 veltas hope your ##forth love life is home plate. 2024-05-27 22:00:09 not 1st, 2nd or 3rd base. 2024-05-27 22:00:17 :) 2024-05-27 22:01:15 base 10, 16, or 8 are more common 2024-05-27 22:02:19 all bases are base 10 2024-05-27 22:03:14 Very true 2024-05-27 22:06:50 Started on my Z80 Forth with some help from here 2024-05-27 22:07:21 Less help than most get on here as I actually read Starting Forth :P 2024-05-27 22:28:06 veltas I also exposed myself to Forth on the ZX Spectrum but never understood the power of it back then.  Today I understand Forth to be the best language to expose the bare metal of on-chip peripherals!  Very close to the bare metal without the stupid compile link download cycle... 2024-05-27 22:30:51 I tried a Forth on the speccy and decided I wanted a newer one 2024-05-27 22:31:25 Although I'm sure the one I tried was better 2024-05-27 22:31:39 New for the sake of new 2024-05-27 22:32:44 veltas nice. 2024-05-27 22:33:22 link loaders are an interesting problem. 2024-05-27 22:33:36 prefer forth, or a runtime that is live. 2024-05-27 22:34:06 the whole 'shut door and key' for me is an unnecessary delineation. 2024-05-27 23:45:57 bad time to start taking interest in z80 2024-05-27 23:51:00 i say as i'm just in the beginning stages of targetting a mips powered pic32 2024-05-27 23:53:22 you can always emulate a z80 on the pic32 2024-05-27 23:53:30 it's probably faster than the original