2025-04-14 02:07:06 yeah, I feel like the Forth outer interpreter is pretty closely analogous to the Unix shell in a lot of ways 2025-04-14 02:08:31 it's a unified user interface for all kinds of different domain-specific utility programs which may be written in the same interpreter or may be written in a lower-level language for efficiency 2025-04-14 02:08:47 so cal seems like a perfectly reasonable thing to do 2025-04-14 02:10:52 also, maybe sort of by coincidence, both of them are mostly "point-free programming", which is to say, you don't name inputs and outputs to functions, but just compose them together 2025-04-14 07:21:26 so I been trying to make a forth and I've ended up making more of a register machine https://github.com/memesmith0/calculator/blob/main/smallcalculator.c 2025-04-14 07:21:32 Is there a pattern matching example like functional langs in Forth? that would be interesting 2025-04-14 07:21:53 forth can be used to bootstrap a pattern matching interface 2025-04-14 07:22:07 most forth programers don't work with lots of text they are usually working with microcontrollers that control machines 2025-04-14 07:22:23 right 2025-04-14 13:14:08 ACTION it's trying a jupiter ace emulator 2025-04-14 13:14:35 lisbeths: hmm 2025-04-14 13:15:46 lisbeths: I'm tempted to read 'n' and 'p' as 'car' and 'cdr' 2025-04-14 13:16:12 n is for number and p is for pointer 2025-04-14 13:18:50 deadmarshal_: though Forth was inspired by Lisp I don't remember ever seeing anyone do that kind of symbolic computation in it. the closest I've seen is that vdupras wrote a sort of Lisp interpreter 2025-04-14 13:19:53 xentrac: Lisp compiler! 2025-04-14 13:20:02 apologies, yes! 2025-04-14 13:20:06 Lisp compiler 2025-04-14 13:20:08 :) 2025-04-14 13:20:58 there isn't maybe an inherent reason that you need garbage collection for pattern-matching 2025-04-14 13:23:07 in Dusk, the text parsing part of the work is mostly done in a scratchpad, a buffer of a fixed size that rolls over. But I do use my implementation of Lisp's cons, which are garbage collected, for AST storage. pretty handy 2025-04-14 13:23:41 but I feel like you do at least need dynamic scoping for pattern matching. which is doable. recursive static scoping is maybe better 2025-04-14 13:24:28 ASTs work pretty well with arena/pool allocation, FWIW 2025-04-14 13:25:31 it's almost as convenient as GC and easier to implement efficiently 2025-04-14 13:26:10 yes, it would too. I use arenas a lot in dusk, but my cons API is more convenient for ASTs and they happen to be GCed 2025-04-14 13:26:56 I didn't realize that; I probably should dig into DuskOS more 2025-04-14 13:27:24 I've often wondered how far you can get with symbolic computation using the Zork Z-Machine tree structure 2025-04-14 13:29:05 where each object has a parent pointer, a next-sibling pointer, and a first-child pointer, as well as some properties, and the fundamental structural operation is to reparent an object elsewhere in the (single) tree 2025-04-14 13:29:42 just on the basis that I like things that can't fail, and that reparenting operation can't fail 2025-04-14 13:32:30 but the obvious ways to use it for that involve having a "free list" parent whose children you steal, and it can run out of children 2025-04-14 13:37:58 Got to love a 700 line program with 17 lines of code 2025-04-14 13:38:10 heh 2025-04-14 13:38:18 I do respect GPL though 2025-04-14 13:38:45 I was tempted to say "this program is just the GPL" but then I finally scrolled down to the program itself 2025-04-14 13:39:39 but then it still wasn't very clear what it was expressing 2025-04-14 13:40:16 I agree that it's like car and cdr, that's what I thought too, and I have written very little Lisp 2025-04-14 13:41:33 I approve of using printable opcodes 2025-04-14 13:42:38 I feel like an example session would probably make the program a lot more comprehensible 2025-04-14 13:52:00 I'm tempted to mention `dc` 2025-04-14 14:32:20 Lisp compiler in Forth is great :D 2025-04-14 14:33:03 If you put all the stuff in the dictionary I think it'll get freed when program exits, so It acts like an arena 2025-04-14 14:34:44 One thing I don't understand about Forth is that if dictionary holds both words definitions and data, it probably means they are interspered in between each other. doesn't the memory gets fragmented? 2025-04-14 14:38:49 The allocation model is pretty much a stack, so you do indeed end up with wasted memory sometimes 2025-04-14 14:39:28 When you 'forget' a word or call a MARKER, you remove everything that was allocated since the thing you're removing 2025-04-14 14:49:56 right 2025-04-14 14:52:14 You can save memory anyway with creativity, but it's tradeoffs all the way down 2025-04-14 14:53:32 it's of course possible to design a dictionary API that doesn't fundamentally leak memory, but that API will be specific to each forth 2025-04-14 14:54:11 deadmarshal_: while in theory you could allocate space for your AST nodes using :noname or equivalent, it's probably better to use a separate heap for them 2025-04-14 14:55:28 yes heap would be easier 2025-04-14 14:57:48 I don't think you understood what I said 2025-04-14 14:59:40 the dictionary is a sort of a heap. an arena is another sort of a heap, or maybe the same sort. a malloc/free free list that permits reuse of deallocated memory is another sort of a heap. it's probably better to use a *separate* heap for AST nodes, i.e., a heap that isn't the dictionary 2025-04-14 15:01:17 is that clearer? 2025-04-14 15:08:44 I don't personally consider the dictionary to be a 'heap', I would just say it's another stack 2025-04-14 15:09:26 And I think if you call it a 'heap' you will probably confuse people 2025-04-14 15:13:22 can we call it a heap that is used like a stack then? :| 2025-04-14 15:14:32 looks like a pile to me 2025-04-14 15:41:51 veltas: I think I did 2025-04-14 16:03:35 mforth: CREDIT 2025-04-14 16:03:35 Brought to you by Cleobuline https://github.com/cleobuline/forth-bot-gmp-irc-threaded-multi-users/tree/main Site https://labynet.fr 2025-04-14 16:14:58 mforth: CRÉDIT 2025-04-14 16:14:58 Unknown word: CRÉDIT 2025-04-14 16:20:11 xentrac: you need to LOAD "test.fth" 2025-04-14 16:20:54 mforth: LOAD "test.fth" CRÉDIT 2025-04-14 16:21:09 lol 2025-04-14 16:24:12 mforth: HELLO 2025-04-14 16:24:12 Hello cleobuline How are uou ? 2025-04-14 16:24:46 mforth: LOAD "test.fth" CRÉDIT 2025-04-14 16:25:28 it does not interpret words after LOAD , yet it's CREDIT 2025-04-14 16:26:12 mforth: CRÉDIT 2025-04-14 16:26:12 Unknown word: CRÉDIT 2025-04-14 16:26:29 lol 2025-04-14 16:26:36 mforth: CREDIT 2025-04-14 16:26:36 Brought to you by Cleobuline https://github.com/cleobuline/forth-bot-gmp-irc-threaded-multi-users/tree/main Site https://labynet.fr 2025-04-14 16:27:15 does it still have the bug where one line of input can produce many lines of output? 2025-04-14 16:27:32 this is not a bug 2025-04-14 16:27:43 mforth: 1 dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . dup . 2025-04-14 16:27:44 Unknown word: dup 2025-04-14 16:27:58 that DUP 2025-04-14 16:28:05 hmm, I think it's a bug in the sense that it causes the bot to have undesirable behavior 2025-04-14 16:28:16 mforth: 1 DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . DUP . 2025-04-14 16:28:16 1 2025-04-14 16:28:16 1 2025-04-14 16:28:16 1 2025-04-14 16:28:17 1 2025-04-14 16:28:17 1 2025-04-14 16:28:18 1 2025-04-14 16:28:18 1 2025-04-14 16:28:19 1 2025-04-14 16:28:38 this not a bug 2025-04-14 16:29:58 if you do : test 1000000 DO I . LOOP ; it will spam , that the responsability of the user 2025-04-14 16:31:04 why trying to spam with the bot ? 2025-04-14 16:31:58 I think it's important for the bot to not do that because sometimes people will do it by accident 2025-04-14 16:32:21 mforth: EXIT 2025-04-14 16:32:21 Bot shutting down... 2025-04-14 16:32:37 that's the remède 2025-04-14 16:33:11 the great soluce 2025-04-14 16:34:53 xentrac: type LOAD "test.fh" then type HELLO please 2025-04-14 16:34:59 i mean, it's /your/ bot, so it's also /your/ responsibility to make sure it doesn't flood the channel, isn't it? 2025-04-14 16:35:43 i can't control the use of the bot , but anyone can type EXIT 2025-04-14 16:36:10 mforth: LOAD "test.fth" 2025-04-14 16:36:21 mforth: WORDS 2025-04-14 16:36:32 lol 2025-04-14 16:36:34 you can't control the use of the bot, but you can put safeguards in place so obvious bad things don't happen 2025-04-14 16:36:45 The fact you can do it by accident easily is a reason to change it 2025-04-14 16:36:52 mforth: EXIT 2025-04-14 16:37:12 it's dead 2025-04-14 16:37:40 :-( 2025-04-14 16:37:50 ACTION leaves flowers 2025-04-14 16:38:20 mforth: LOAD "test.fth" 2025-04-14 16:38:29 mforth: WORDS 2025-04-14 16:38:43 there is a bug some where :( 2025-04-14 16:40:05 mforth: WORDS 2025-04-14 16:40:11 it's dead 2025-04-14 16:42:55 mforth: WORDS 2025-04-14 16:43:14 it doe not want to wrk here 2025-04-14 16:43:26 mforth: 1 DUP .S 2025-04-14 16:43:43 did someone mute it ? 2025-04-14 16:44:05 nope 2025-04-14 16:44:07 anyway 2025-04-14 16:44:31 /mode ##forth +q shows nobody is quieted 2025-04-14 16:46:02 it works on my irc server not there 2025-04-14 16:48:31 It's stuck in the shadow realm 2025-04-14 16:50:52 maybe 2025-04-14 16:53:16 xentrac: you kill my bot with your experimentations :( 2025-04-14 16:53:43 you must use it en "Bon père de famille" 2025-04-14 16:56:46 now i thing it is shadowban 2025-04-14 16:56:48 aw :-( 2025-04-14 16:56:53 oh no! 2025-04-14 16:57:03 yes 2025-04-14 16:59:38 it's yout fault xentrac 2025-04-14 17:00:14 with your diabolics experiments 2025-04-14 17:01:25 i don't care it works on labynet.fr where is not any contraints 2025-04-14 17:03:56 I hope it recovers soon 2025-04-14 17:04:52 i will work to enqueue the bot response with a irc thread so it will have best response time 2025-04-14 17:05:51 may be add the username to response too 2025-04-14 17:08:32 now there is still a risk of inter-locking if many users send request in the same time 2025-04-14 19:04:15 mforth: WORDS 2025-04-14 19:04:33 il est toujours shadowban le pauvre 2025-04-14 19:18:03 mforth: WORDS 2025-04-14 19:18:04 USERNAME .S . + - * / MOD DUP DROP SWAP OVER ROT >R R> R@ = < > AND OR NOT XOR & | ^ ~ << >> CR EMIT VARIABLE @ ! +! DO LOOP I WORDS LOAD CREATE ALLOT ." CLOCK BEGIN WHILE REPEAT AGAIN SQRT UNLOOP +LOOP PICK CLEAR-STACK PRINT NUM-TO-BIN PRIME? FORGET STRING " 2DROP IMAGE TEMP-IMAGE CLEAR-STRINGS DELAY EXIT MICRO MILLI 2025-04-14 19:18:12 it's back ! 2025-04-14 19:19:26 labynet.fr :) 2025-04-14 19:19:38 the best web radio in the world 2025-04-14 19:20:01 with many experimentals IA bots 2025-04-14 19:21:25 mforth: MICRO 10000 DELAY MICRO SWAP - . 2025-04-14 19:21:35 10000115 2025-04-14 19:43:43 <[bot]konilo > Konilo via IRC 2025-04-14 21:28:43 mforth: 2 SQRT .s 2025-04-14 21:28:43 Unknown word: .s 2025-04-14 21:28:51 mforth: 2 SQRT .S 2025-04-14 21:28:52 <2> 1 1 2025-04-14 21:29:32 mforth: 2drop 2025-04-14 21:29:32 Unknown word: 2drop 2025-04-14 21:29:36 mforth: 2DROP 2025-04-14 21:37:22 mforth: 1 SQRT .S 2025-04-14 21:37:23 <1> 1 2025-04-14 21:38:11 mforth: LOAD "test.fth" 2025-04-14 21:39:54 mforth: 1 2 3 5 7 11 13 17 23 31 * * * * * * * * PRIME-FACTORS .S 2025-04-14 21:39:54 Unknown word: PRIME-FACTORS 2025-04-14 21:39:54 <2> 1 363993630 2025-04-14 21:41:47 mforth: LOAD "test22.fth" 2025-04-14 21:41:47 Error: Error: LOAD: Cannot open file 'test22.fth' 2025-04-14 21:41:54 mforth: LOAD "test2.fth" 2025-04-14 21:41:58 mforth: 1 2 3 5 7 11 13 17 23 31 * * * * * * * * PRIME-FACTORS .S 2025-04-14 21:41:58 2 3 5 7 11 13 17 23 31 2025-04-14 21:42:31 mforth: CLEAR-STACK 2025-04-14 21:50:55 mforth: 1234567 PRIME-FACTORS 2025-04-14 21:50:55 127 9721 2025-04-14 23:34:07 anthk_: try out https://codeberg.org/pgimeno/JAForth if you aim at coding for the Juppy :) 2025-04-14 23:53:13 ah, thanks, zesarux ran too slow on my netbook 2025-04-14 23:53:56 well, is not interactive 2025-04-14 23:54:45 uh, Pedro Gimeno, where did I see that name 2025-04-14 23:54:48 ZX Spectrum maybe? 2025-04-14 23:55:38 ah, indeed 2025-04-14 23:58:14 on zesarux, it emulates the ACE in my netbook at glacial speeds 2025-04-14 23:59:55 there are xace and so on but they fail to build with odd cmake errors. Still, everything but graphics and I/O might run nearly as is on 8-16 bit forths