2021-11-19 12:15:14 hi, i have two variables addr and len "containing" a string. how can i write a word, lets call it def, which will define word named like that string in addr and len variables? 2021-11-19 12:15:55 it seems that there are no non-parsing defining words 2021-11-19 12:17:26 have you read starting forth? 2021-11-19 12:18:52 joe9: not yet, i have bought and read a few books but have not found printed starting forth yet 2021-11-19 12:19:54 logand: there is no standard way to do that in an ans standard forth; forth 200x has execute-parsing which can support passing a string to the parsing defining words 2021-11-19 12:20:08 maybe if somebody could provide at least a hint where to start without having read starting forth 2021-11-19 12:20:48 crc: i see, i use gforth if that helps 2021-11-19 12:21:20 i see execute-parsing in the gforth manual 2021-11-19 12:21:41 it looks like the thing i need 2021-11-19 12:22:13 gforth supports forth200x words, so it should have execute-parsing 2021-11-19 12:22:20 i was hoping there is another (better?) way 2021-11-19 12:22:35 what is forth200x? 2021-11-19 12:25:00 crc: How often does the IRC log get updated? I can't see the previous discussion before I joined. 2021-11-19 12:25:02 forth200x is the successor standard (in progress) for ans 2021-11-19 12:25:32 neuro_sys_: should be every 15 minutes currently 2021-11-19 12:25:40 crc: great, thank you 2021-11-19 12:26:05 neuro_sys_: I can make it more frequent if it'd be helpful 2021-11-19 12:26:36 logand: I am curious, what is it you're trying to do? 2021-11-19 12:26:47 neuro_sys_: learning forth :-) 2021-11-19 12:27:02 crc: I don't know if other people use it to catch up with conversations before they joined. I sometimes do. 15 minutes is not too bad. 2021-11-19 12:27:28 logand: I was curious about "there is no standard way to do that in an ans standard forth". 2021-11-19 12:28:57 neuro_sys_: he's trying to define a word using a name from a string, not parsing 2021-11-19 12:30:05 I see 2021-11-19 12:30:27 First thing that comes to mind is to modify TIB (which is probably tricky and dangerous) and use CREATE. 2021-11-19 12:30:55 crc: that worked: s" foo" ' : execute-parsing 42 ; see foo great 2021-11-19 12:31:01 If you don't care about portability, and know the dictionary structure, you could write your own version of CREATE of course. 2021-11-19 12:31:34 neuro_sys_: i'm a beginner 2021-11-19 12:31:35 could you use evaluate? 2021-11-19 12:32:05 logand: Ah right, I think so. 2021-11-19 12:32:40 crc: is there a way to get the name of the current word inside the colon definition? 2021-11-19 12:33:21 or maybe i could just switch to interpreter mode and get it from the variables addr and len i suppose 2021-11-19 12:33:31 s" : foo 42 ; " evaluate ( this also works) 2021-11-19 12:33:33 couldyou build a string and EVALUATE it ? 2021-11-19 12:33:47 but is there something like literal but for s" " string? 2021-11-19 12:34:04 neuro_sys_: interesting, thanks! 2021-11-19 12:36:54 logand: ( Only for gForth, try this) : foo ['] recurse name>string type ; 2021-11-19 12:37:29 Normally the word being defined is invisible until it's termined (with ;). That's why I used RECURSE to get the xt, and name>string to get the name. 2021-11-19 12:38:31 Ah, NAME>STRING is Forth200x, so it is standard. 2021-11-19 12:45:35 logand: nothing standard for getting the current word name either 2021-11-19 13:01:45 neuro_sys_: thanks ill try that 2021-11-19 13:02:55 neuro_sys_: that doesnt work: s" foo" 2dup ' : execute-parsing ['] recurse name>string type ; >>:11: Cannot tick compile-only word (try COMP' ... DROP) 2021-11-19 13:03:36 this doesnt either: s" foo" 2dup ' : execute-parsing sliteral type ; :10: unstructured s" foo" 2dup ' : execute-parsing sliteral type >>>;<<< 2021-11-19 13:06:01 your suggestion doesnt work either: : foo ['] recurse name>string type ; >> :12: Cannot tick compile-only word (try COMP' ... DROP) 2021-11-19 13:25:56 hmm maybe the evaluate approach is the most reasonable 2021-11-19 13:26:09 dave0: thanks! 2021-11-19 13:59:00 Yep evaluate is only sane thing I can think of and it's not a great way of doing it 2021-11-19 13:59:08 logand: Why do you want this? 2021-11-19 13:59:13 Not that it's wrong to want it 2021-11-19 14:01:50 veltas: i am learning forth by writing kind of (meta?) compiler 2021-11-19 14:02:02 Writing a forth in forth? 2021-11-19 14:02:03 in forth 2021-11-19 14:02:05 yes 2021-11-19 14:02:08 Nice 2021-11-19 14:02:30 that way i will learn both the internals while actualy using forth 2021-11-19 14:02:33 Writing FORTH is definitely the best way to learn, if you start getting really stuck just write some easier programs first though 2021-11-19 14:02:47 Don't get bogged down with a big first project idea, writing FORTH is difficult 2021-11-19 14:03:23 It's not wrong to write a FORTH env yourself, it's how many of us learn FORTH properly 2021-11-19 14:04:01 If I was you I would implement this FORTH by allocating a large area in dictionary for everything, divide it between stack/dict/etc for your forth, write a sort of VM for it 2021-11-19 14:04:03 i want to get deep and wide idea how was it to write forth 2021-11-19 14:04:44 I do think that to be a good FORTH programmer you need to know how FORTH is written, or at least how to use the 'advanced' parsing/compiling stuff in FORTH 2021-11-19 14:05:07 i think meta compiler in forth is probably the one thing to exercise a lot of things 2021-11-19 14:06:23 If you haven't written some trivial FORTH programs yet I'd do that first 2021-11-19 14:06:30 veltas: writing vm is too advanced for me at the momemt 2021-11-19 14:07:03 i write out C 2021-11-19 14:07:08 Maybe I misunderstand what you're doing 2021-11-19 14:07:14 Okay writing it in C makes more sense :P 2021-11-19 14:07:50 i am writing it in forth, generating c 2021-11-19 14:08:15 instead of allocating a large area in dictionary... 2021-11-19 14:09:21 I'm lost again 2021-11-19 14:09:31 Don't worry 2021-11-19 14:09:45 64 bit abi uses 6 registers for args so i can write C funtion per word and C compiler will use registers 2021-11-19 14:10:49 i am writing a forth program which prints C program which is then compiled by gcc 2021-11-19 14:11:42 so instead of your suggestion to write sort of vm, i write to C file 2021-11-19 14:21:21 so its like a converter? 2021-11-19 14:21:54 MrMobius: what is a converter? 2021-11-19 14:22:16 i mean your program converts from forth to C 2021-11-19 14:26:28 maybe, i am not sure. doesnt meta compiler convert? 2021-11-19 14:26:48 mrmobius 2021-11-19 14:26:52 its a compiler 2021-11-19 14:26:54 from forth to C 2021-11-19 14:28:07 the primitives are kind of writen in C printed inside forth words 2021-11-19 14:28:08 a compiler takes in some language and converts it to another 2021-11-19 14:28:52 the high level words are C addresses of primitives or other high level words 2021-11-19 14:33:12 primitive + looks like this 2021-11-19 14:33:18 :{ + ." NEXT(ip+1, rsp, dsp-1, *(dsp-1) + tos);" } 2021-11-19 14:35:26 I would say the compiler usually produces a binary 2021-11-19 14:36:16 Here we go... 2021-11-19 14:36:17 gcc produced asm iirc 2021-11-19 14:36:32 mrmobius: pretty false 2021-11-19 14:37:01 a compiler is anything that turns one language into another 2021-11-19 14:37:14 Okay we've all aired our opinion now and we also know full well nobody will change their mind so let's just walk away... 2021-11-19 14:37:28 fair 2021-11-19 14:37:52 We've got plenty of time to argue about the metric system if we stop now 2021-11-19 14:40:11 the modern climate of development sadly has a lot of compilers 2021-11-19 14:40:19 that convert from language to not a binary 2021-11-19 14:40:47 I think people think that these terms are much more consistent or conventional than they are 2021-11-19 14:40:50 see typescript 2021-11-19 14:41:23 And it is just one of those things that causes endless arguments like "what's a scripting language?" 2021-11-19 14:41:37 oh, i have a strong, clear definition 2021-11-19 14:41:57 In your head yes you probably do, or you have a definition that's too general to be useful 2021-11-19 14:42:07 oh totally! 2021-11-19 14:42:14 but other people use it too :p 2021-11-19 14:42:16 so 2021-11-19 14:42:20 :akaneshrug: 2021-11-19 14:42:30 it's the one academia uses 2021-11-19 14:43:15 Academia is really low down on my list of sensible language authorities 2021-11-19 14:43:42 Especially given they diverged in every facet of CS years ago and enjoy being esoteric 2021-11-19 14:43:56 you're in a forth channel 2021-11-19 14:44:07 youre ignoring who academia actually is 2021-11-19 14:44:14 I don't go into ##c and call functions 'words' though 2021-11-19 14:44:18 do u think academia is agda and haskell 2021-11-19 14:44:31 bcos sure, part of it is 2021-11-19 14:44:34 but like 2021-11-19 14:44:38 its also llvm 2021-11-19 14:44:55 which is far from divergence and esoterity 2021-11-19 14:46:08 like llvm and compiler shit is one of the most relevant academic projects i think 2021-11-19 14:46:16 rust too 2021-11-19 14:46:22 Yeah a lot of people share this delusion :P 2021-11-19 14:46:41 No I am trolling a bit now, I don't care but that's just me 2021-11-19 14:46:41 much as people may dislike it(me too!), its very relevant 2021-11-19 14:46:51 thats fair 2021-11-19 14:46:54 It's relevant in the sense that it's hyped 2021-11-19 14:47:00 nah 2021-11-19 14:47:02 its used 2021-11-19 14:47:12 im not talking the crates people 2021-11-19 14:47:17 im talking about amazon 2021-11-19 14:47:33 There are no jobs in it where I live 2021-11-19 14:47:54 thats a fair criteria 2021-11-19 14:48:25 hi. I work at amazon. 2021-11-19 14:48:36 Yeah in the packaging section lol 2021-11-19 14:48:38 get back to work 2021-11-19 14:48:42 fuck you lmao. 2021-11-19 14:48:50 systems architect muthafucker. 2021-11-19 14:48:56 Get back to work wagey 2021-11-19 14:49:04 that word is hilarious. 2021-11-19 14:49:12 like everyone's a damn wagey. even business owners. 2021-11-19 14:49:35 I am kidding, I am also a slave 2021-11-19 14:49:46 I know lmao, just the word is funny. 2021-11-19 14:51:27 It's all signal processing! 2021-11-19 14:52:19 just came back from a digital logic course, eh. 2021-11-19 14:52:56 The 'systems' are cardboard boxes, and the 'architecting' is putting product and more cardboard into the box 2021-11-19 14:53:00 Just read the what is a compiler discussion 2021-11-19 14:53:19 The digital logic course is here is a digital logic: can I take sick days? No. End of course 2021-11-19 14:53:21 Yeah CS is lego for adults. 2021-11-19 14:53:34 veltas, lol wasnt going to argue that with eris[m] but thanks anyway :P 2021-11-19 14:53:49 MrMobius: I am just teasing! 2021-11-19 14:54:31 Implementing Forth for and in anything but assembly is more difficult in my short experience. 2021-11-19 14:54:41 Yeah I would tend to agree with that 2021-11-19 14:56:00 s/gre/rgu 2021-11-19 14:56:20 At the moment my only slight annoyance is that I don't particularly like the standard words. But I will keep implementing them and use them anyway. 2021-11-19 14:56:40 fuck the standard words. 2021-11-19 14:56:42 write your own. 2021-11-19 14:56:51 neuro_sys_: Yeah that's my situation too 2021-11-19 14:57:31 And I agree with imode a bit, what I prefer is writing a forth where you can bolt-on standard words where they diverge if that's needed to run standard programs 2021-11-19 14:57:35 Or for someone new 2021-11-19 14:57:36 POL book in that regard is very inspiring. But I am far too brainwashed to resist the urge of doing it the standard way. 2021-11-19 14:57:50 POL book? 2021-11-19 14:58:06 A Problem Oriented Language by Chuck. 2021-11-19 14:58:24 Essay, or notes rather than a book I guess. 2021-11-19 14:58:51 I think the standard is a good place to start if you want to figure out your own dialect, and look at some other people's forths and see the decisions they've made 2021-11-19 14:58:54 Including chuck's 2021-11-19 14:59:25 Yeah I like to grok what is out there first before jumping into "my brilliant ideas" 2021-11-19 15:01:39 I feel like fig-FORTH and ANS FORTH are better things to look at, the only good new features are exceptions (new I think?), base-prefixes, and parse-name 2021-11-19 15:01:49 Any other good forth200x things? I'm drawing a blank 2021-11-19 15:02:33 An old polyFORTH manual would be an interesting read probably 2021-11-19 15:05:26 neuro_sys_: http://www.forth.org/fig-forth/ 2021-11-19 15:05:47 I started with 79, then 83, and now at ANS. But also referring to fig guide, eforth etc. 2021-11-19 15:06:04 Nice 2021-11-19 15:07:02 Oh wow, didn't know about these listings. 2021-11-19 15:07:31 exceptions, parse-name, and $hex #decimal %binary are the only good new features 2021-11-19 16:47:46 The use of one's complement is interesting in color forth 2021-11-19 16:48:35 Because you can use one operator as not and minus 2021-11-19 17:07:01 libera-me-from-chat 2021-11-19 17:32:46 I have been running into one's complement being mentioned more recently. But the last time I heard it mentioned was in a talk about Apollo computer, and the presenter talked of it in a negative way (because of minus and plus zero). 2021-11-19 17:34:11 In one of the Fig forth talks someone asked Chuck about one's complement and they talked about some advantages. I need to look more into it at it some point. 2021-11-19 17:35:43 http://www.forth.org/fig-forth/fig-forth_PDP-11_Users_Guide.pdf page 74 has a fig-FORTH glossary 2021-11-19 17:36:59 The advantage is just that negate is invert 2021-11-19 17:37:22 And the range is symmetrical 2021-11-19 17:38:14 Disadvantage is that addition/subtract/multiply now work differently based on sign 2021-11-19 17:38:22 I prefer two's complement 2021-11-19 17:42:00 I see 2021-11-19 17:42:20 When you don't need signed numbers then it can be a simpler substitute. 2021-11-19 17:44:49 one's/two's complement is a signed number representation scheme 2021-11-19 17:45:09 So if you only use unsigned numbers it doesn't even make any difference 2021-11-19 18:06:42 Ah of course. Too sleepy. But I think I got confused by some dude in the fig chats on YT had mentioned some other property of it that I forgot to check later what it was. 2021-11-19 21:44:48 forth combined with tuple spaces == distributed forth. 2021-11-19 22:35:15 How do I learn arrayforth or colorforth etc? or what is the newest one?