2024-07-01 00:00:54 crc: it's MIPS which is really cool on a little micro. the big selling point to me is huge ram/flash/speed compared to anything else in DIP. if you're ok with SMD, it has an external address bus but so do a lot of the ARM chips 2024-07-01 00:02:00 also PMP engine to do memory transfers in the background with flexible bus arrangement. can't execute code that way but could be awesome for graphics 2024-07-01 01:02:21 did forth ever had some relation with artificial intelligence? 2024-07-01 01:02:31 how it could be? 2024-07-01 01:05:14 good old fashioned AI (as they call it now) was mostly lisp 2024-07-01 14:48:41 Old AI was very different from today's AI. Sometimes I think what they do today shouldn't even really be called AI. Back in the day that were explicitly trying to make systems that could reason like humans. Kind of silly, since no one knew how humans reason, but that was the game. What they do these days is more like "advanced probabilitsic algorithms." Usually applying Bayes Theorem and similar things 2024-07-01 14:48:44 to mountains of data of some sort. 2024-07-01 14:49:15 Take a large language model for example. It's not like it has any idea "what it's saying." It just strings words together based on words strings it's seen during its training. 2024-07-01 14:49:33 If the result makes you think it "understands," that's an illusion. 2024-07-01 15:01:57 ACTION awaits the next "ai" winter 2024-07-01 15:03:18 what they do today isn't AI, it's automated plagiarism 2024-07-01 15:34:04 KipIngram: Yeah it is more like smarter regression than reasoning per-se 2024-07-01 15:38:14 I don't believe general AI is going to appear out of current tech because it's already far more powerful than the human brain in terms of context, specificity etc; but totally incapable of serious/stable constructive reasoning 2024-07-01 15:38:21 some have argued (via termite mounds) for competence without comprehension 2024-07-01 15:38:43 Yeah it's obviously useful and disruptive 2024-07-01 15:38:50 And questionably legal 2024-07-01 15:38:59 Questionably lawful anyway 2024-07-01 15:39:44 I, for one, welcome our termite overlords :P 2024-07-01 15:41:16 Can I complain about robot framework 2024-07-01 15:42:52 It's dogshit, I'd rather write my tests in COBOL 2024-07-01 15:50:20 their website wants me to enable javascript in w3m, so that's not a promising sign 2024-07-01 15:53:45 Their log output doesn't work without a full JS enabled browser 2024-07-01 15:54:18 I've actually run into this issue at work because it doesn't display a log of what's happening in the terminal, and I have to send it to another machine to view the HTML log because I don't have a graphical env 2024-07-01 15:56:07 sounds pretty terrible 2024-07-01 15:56:15 i have to improve my stack manipulation skills 2024-07-01 15:56:25 any suggestion for exercises or alike? 2024-07-01 15:56:49 just do it 2024-07-01 15:57:20 better yet, design your code to minimize it. and let me know when you figure out how to do that. 2024-07-01 15:58:06 yes, i want to make a simple translation of a lisp code, but since i'm lacking a lot of knowledge i'm doing things in a wrong way and using the stack much than i would like 2024-07-01 15:58:42 http://www.sovietov.com/app/forthwiz.html 2024-07-01 15:58:43 still since i'm having troubles with managing those elements i should focus first on stack manipulation and feel comfortable with it 2024-07-01 15:59:12 GeDaMo seems exactly what i need? 2024-07-01 16:01:47 the number at first is the number of operations allowed? 2024-07-01 16:02:11 If you do a simple translation of any other language you'll grate against Forth 2024-07-01 16:02:35 I would just use a lot of variables if I absolutely had to translate something this way 2024-07-01 16:02:49 well my problem is with strings 2024-07-01 16:03:25 i want to mimic the lisp ' quote operator and make some kind of word that when executed prints it's name, or just save strings in memory 2024-07-01 16:03:52 i was using s" to save the strings but then i get all the strings and their count on the stack 2024-07-01 16:04:21 http://www.pasteshit.xyz/ad.html 2024-07-01 16:05:08 it's just a sentence generator that picks a random word for articles nouns and verbs 2024-07-01 16:05:42 this is one of the first examples of the PAIP book (paradigms of artificial intelligence) 2024-07-01 16:06:15 i was yesterday trying to implement 2pick in order to give it a random number to choose one of those strings, but i failed 2024-07-01 16:07:05 actually i would like some sort of create does> type and to store the string and just get it printed when executed 2024-07-01 16:07:57 vms14: lisp is a LISt Processor. don't mistake forth's stack for a list. 2024-07-01 16:08:03 i didn't want to ask because i have to learn the basics anyway 2024-07-01 16:08:28 zelgomer forth is able to do anything you can imagine, yet i know it lacks the stuff and we have to implement it 2024-07-01 16:08:53 also i don't know if i can find a translation better suited to forth 2024-07-01 16:09:35 i didn't say it was /incapable/ of anything 2024-07-01 16:09:38 i was thinking on making all those articles verbs and nouns as words that print themselves and i could use something like random pick execute 2024-07-01 16:09:47 but feels wrong anyways 2024-07-01 16:09:56 what i said was that the stack is not a list 2024-07-01 16:10:41 yes, this is why i should be using memory or create words 2024-07-01 16:10:55 the dictionary, however, IS a list 2024-07-01 16:11:24 i will just keep reading forth books until i feel more comfortable and learn the basics so i can make simple things 2024-07-01 16:12:40 that paip exercise is quite simple, it's just forth is missing symbols and i should try to implement them or find a more forthy way 2024-07-01 16:12:58 anyway, the thing about lisp is that the code is made of lists, not that it only has lists 2024-07-01 16:13:07 i was even thinking about using case so i can convert words to numbers, but meh 2024-07-01 16:13:42 yeah, but what i need is just some sort of quoted symbol that will print it's name when executed 2024-07-01 16:13:43 Do you know about DOES> and IMMEDIATE stuff? 2024-07-01 16:14:01 veltas i want something like does> type 2024-07-01 16:14:24 but i don't even know how to save a string after create somename 100 allot 2024-07-01 16:15:20 vms14: in lisp, a symbol is a memory location with a name, and creating one makes sure that a given name returns the same memory location 2024-07-01 16:15:37 dlowe: dictionary will also work as a stack 2024-07-01 16:15:43 i was thinkin about making some word named quote that performs this create does> thing 2024-07-01 16:15:57 dave0: sure, stacks and singly-linked lists go well together 2024-07-01 16:16:21 like quote someword now someword exists and when executed will print itself 2024-07-01 16:16:28 dlowe: i dont mind a good singly linked list :-) 2024-07-01 16:16:40 vms14: you could fiddle with >IN 2024-07-01 16:16:52 so : someword ." someword ; 2024-07-01 16:16:59 with that i would just push the execution tokens on the stack and make something like random pick execute 2024-07-01 16:18:13 never seen that word dave0 2024-07-01 16:18:14 https://forth-standard.org/standard/core/toIN 2024-07-01 16:18:28 vms14: it's playing with the parse buffer 2024-07-01 16:18:30 i suppose i have to wait until i have a proper base knowledge 2024-07-01 16:18:56 vms14: save >IN then CREATE the word then restore >IN then PARSE a string 2024-07-01 16:19:15 for some reason i thought there was a comma-quote word that pushed a string on HERE 2024-07-01 16:19:55 vms14: you are allowed to play with the parse area 2024-07-01 16:20:18 i was thinking also to make a simple loop and go storing c! 2024-07-01 16:20:37 you probably want cmove 2024-07-01 16:20:39 but i will just wait and keep reading books 2024-07-01 16:20:44 or i think is what i want 2024-07-01 16:21:17 : STR, ( a u -- ) DUP , 0 ?DO COUNT C, LOOP DROP ; 2024-07-01 16:21:20 Something like that 2024-07-01 16:21:31 CMOVE would be more efficient 2024-07-01 16:21:34 so i can ." sometext" and move it to some location 2024-07-01 16:21:41 s" sometext" * 2024-07-01 16:21:46 vms14: http://forth.works/share/pRexm27pf2.txt would be a quick port of your code to my system (just throwing strings into arrays, and fetching from them) 2024-07-01 16:21:54 : ," [CHAR] " PARSE STR, ; 2024-07-01 16:23:17 crc that's cool 2024-07-01 16:23:45 i will try to learn more and come back to this exercise later 2024-07-01 16:24:08 this is in part why i did not want to bother you with this yesterday 2024-07-01 16:24:27 but i kept wondering if there was a more "forthy" way to translate that 2024-07-01 16:24:36 my `s:keep` in the " sigil would be basically the same as the STR, veltas showed 2024-07-01 16:25:56 thanks everyone for the help, i do appreciate it and it's really being helpful 2024-07-01 16:26:46 i will learn a bit more the basics, because it's too soon to do anything yet 2024-07-01 16:31:22 It's no problem 2024-07-01 16:31:45 forth feels to me like a very hard language to learn 2024-07-01 16:32:10 this pushes me forward anyways xd 2024-07-01 16:32:38 i'm amused by the elegance of colon words 2024-07-01 16:33:06 specially with examples like the breakfast or washer 2024-07-01 16:33:36 imo those are not good faith examples 2024-07-01 16:34:00 yeah, they're kind of biased and do not demonstrate that your code will be like that 2024-07-01 16:34:01 It's not 'very hard' but it definitely requires practice with; more so than most 2024-07-01 16:34:06 because it's so different in style 2024-07-01 16:34:15 but it could end resembling english, at least the top words 2024-07-01 16:34:22 The examples are very contrived but still not totally unfair 2024-07-01 16:34:36 Examples are always contrived, to be fair 2024-07-01 16:35:22 i could just as easily write a series of c macros so that i can go "look at how easy C is: BEGIN WASH RINSE DRY END" 2024-07-01 16:35:55 yes but forth encourages better that style 2024-07-01 16:36:12 while in c abusing macros is not nice 2024-07-01 16:36:13 It's less contrived than that 2024-07-01 16:36:22 it isn't representative of 99% of the c code you'll be writing. likewise with forth imo. 2024-07-01 16:36:25 mainly i dislike using C because i always end abusing macros 2024-07-01 16:36:31 and feels dirty and wrong 2024-07-01 16:37:25 here is a line that i think is more representative of forth, at least in the forth that i've written: r8 r8 :noname >r swap r> 8* assemble, ; when 2024-07-01 16:38:09 It's not like Forth hides Forth code that well, go SEE what your Forth does 2024-07-01 16:38:26 And yet in my experience even stuff like gforth is quite readable 2024-07-01 16:38:33 i haven't implemented see :) 2024-07-01 16:38:34 most code in forth is very hard to read for a novice 2024-07-01 16:38:43 zelgomer: Have you got DUMP? 2024-07-01 16:38:58 sure, i know what it compiles to. i wrote the compiler. 2024-07-01 16:39:01 vms14: If you've written much Forth it's easier 2024-07-01 16:39:04 when i see your code ir usually don't get a thing, but i envy you in secret 2024-07-01 16:39:11 i* 2024-07-01 16:39:42 i think forth has something that i want 2024-07-01 16:39:52 vms14: that's the thing: nobody here does. what i pasted doesn't mean anything to anybody outside of the context i pulled it from. that's forth's weakness, imo. 2024-07-01 16:39:54 and i will keep going until i find it 2024-07-01 16:40:51 zelgomer: If I saw a little more of your code I'd understand it maybe, that's totally out of context 2024-07-01 16:41:03 How often do you need to understand one line without any of the surrounding code 2024-07-01 16:41:27 and that's my point about : washer wash rinse dry ; 2024-07-01 16:41:30 Even if you've got no SEE I'm assuming you've got the source 2024-07-01 16:41:44 : washer is self-documenting though and it's clear nothing's put on stack 2024-07-01 16:41:57 So it's manipulating global state 2024-07-01 16:42:02 As an embedded controller would 2024-07-01 16:42:26 i have no idea whether wash pushed anything or rinse popped anything 2024-07-01 16:43:33 One might argue it doesn't matter at all 2024-07-01 16:43:42 But to me it reads plainly like they don't 2024-07-01 16:43:56 And they don't 2024-07-01 16:44:03 The 'fuller' washer example has stack comments too 2024-07-01 16:44:11 In Thinking Forth or wherever it was 2024-07-01 16:44:13 it matters if i want to add a second rinse cycle 2024-07-01 16:45:19 Well that's what stack comments are for; if I see : WASHER ( -- ) and : WASH ( -- ) I already know we're safe to add another rinse 2024-07-01 16:47:37 which means it isn't self documenting 2024-07-01 16:49:30 I know it's subjective but I really disagree, the WASHER example makes perfect sense and doesn't need them, because by any normal convention (including those in Starting Forth and Thinking Forth) you wouldn't be passing around state in a weird way there 2024-07-01 16:49:40 The only question is how much mileage that style gives, which isn't that muh 2024-07-01 16:49:42 much* 2024-07-01 16:49:51 In practice it's not that simple, yes 2024-07-01 16:52:26 in my Forth i've an info struct that incorporates all info about a word, including a little descr string that tells what that word does, but also 2 parameters, stack_in and stack_out, e.g. dup has stack_in=1 stack_out=2, because it wants 1 arg in the stack, and it leave the stack with 2 args, makes sense to you? 2024-07-01 16:53:55 What about ?DUP 2024-07-01 16:56:20 :-) 2024-07-01 16:56:54 Yes, ?DUP and any other word with variable stack effects throw a wrench into all kinds of "smart compilation" things. 2024-07-01 16:57:33 indeed 2024-07-01 16:57:45 for all those words i've stack_in/out of -1 2024-07-01 16:57:51 In some older Forths FIND also had variant output - if the word is in the dictionary, it would retrun several items related to it. If the word wasn't in the dicitonary, it just returned zero. 2024-07-01 16:58:00 rendar: Otherwise sounds reasonable 2024-07-01 16:58:05 When I write FIND it returns just a CFA if the word is found, and zero if it's not. 2024-07-01 16:58:22 also i have some words which leave in the stack N args, with a final integer which represent N 2024-07-01 16:58:27 like `'hello' 'world' 2` 2024-07-01 16:58:32 i have 2 strings into the stack 2024-07-01 17:00:07 do you think it's a good idea to rely on this system of stack i/o when i have composite words? so i can sum up all those stack_in and stack_out, and see what the composite words leaves the stack 2024-07-01 17:01:20 Sounds fine it's just not conventional and a headache to implement in standard forth 2024-07-01 17:01:28 In your own forth go for it 2024-07-01 17:01:35 A normal forth has quite a shallow stack 2024-07-01 17:04:32 yeah 2024-07-01 17:05:15 All these N-stack-item operations are quite weird for a classical forth, but some people enjoy this 2024-07-01 17:05:24 I'm sure there's some nice ways to manipulate with that 2024-07-01 17:13:05 well they are _very_ useful in my use case 2024-07-01 17:13:15 rendar why do you have that metadata for stack in and stack out in your forth? you pretend to use it for some kind of reflection feature? 2024-07-01 17:14:10 vms14, yes 2024-07-01 17:14:21 vms14, in particular, in composite words 2024-07-01 17:14:45 one of the problems with forth is that you usually don't give a fuck about what do the words with the stack so you have 0 control about it, with this metadata you can have that control 2024-07-01 17:16:15 in my case it interests me a bit because it could give the ability to translate or bind words to another languages and alike 2024-07-01 17:16:43 but gforth uses the stack notation for ffi to C, which is also a cool idea 2024-07-01 17:17:56 rendar are your composite words going to provide some similar feature like the method of an object? 2024-07-01 17:18:22 or better said, why you wanted composite words 2024-07-01 17:18:48 well no, i don't have an object oriented language 2024-07-01 17:19:04 i like nested definitions and lexical scope instead 2024-07-01 17:19:06 composite words are `: hello dup drop + 1 ;` 2024-07-01 17:19:51 what is different from a normal colon word? 2024-07-01 17:20:05 or what means a composite word in your forth 2024-07-01 17:20:32 composite word = colon word 2024-07-01 17:20:39 i just call it composite 2024-07-01 17:21:01 in my Forth they are called Phrases actually 2024-07-01 17:21:27 Nested definitions add a lot of complexity. 2024-07-01 17:21:39 what are nested definitions? 2024-07-01 17:21:41 oh, i thought you wanted to use that metadata to provide some kind of words that are composed by two words or alike 2024-07-01 17:21:51 oh : hello .. : world ... ; ; ? 2024-07-01 17:21:52 : oh : meh 1 2 3 ; meh ; 2024-07-01 17:22:07 i see yeah, they are forbidden in my Forth 2024-07-01 17:22:17 I can type this, vms14: 2024-07-01 17:22:18 meh only exists inside of oh and is only accessible there, in my case 2024-07-01 17:22:22 due to lexical scope 2024-07-01 17:22:31 KipIngram i like your temp words idea 2024-07-01 17:22:31 : oh : meh 1 2 3 meh ; 2024-07-01 17:22:38 Note the missing interior ; 2024-07-01 17:22:56 I can handle an extra : in the def - it just makes a new header. But ; ends compilation. 2024-07-01 17:23:03 So it's not really "nesting." 2024-07-01 17:23:38 The reason it adds complexity is that there you are in the middle of compiling a definition, which you can just tack onto the end of the dictionary. 2024-07-01 17:23:47 rendar: What do you think about something like words to check stack depth that are only enabled sometimes, so not built for 'release' or when not testing something anymore? 2024-07-01 17:23:48 If you then open a "nested" definition, where do you put its code? 2024-07-01 17:23:59 You can put it right inline, but then you have to jump around it. 2024-07-01 17:24:04 you told me time ago that you could define temp words as auxiliar words for a definition and once compiled the word will have the code of those temp words, but those temp words will cease to exist elsewhere 2024-07-01 17:24:15 Yes, that's done with .: in my system instead of : 2024-07-01 17:24:33 veltas, isn't that just like an 'assert' ? 2024-07-01 17:24:40 The ONLY difference between : and .: is that .: sets a flag in the header, which lets me go through the header list later and remove all the words that have that flag set. 2024-07-01 17:24:48 I do that with .wipe 2024-07-01 17:25:44 KipIngram your words had some kind of call stack or you where giving like some kind of scope with a stack? 2024-07-01 17:26:00 i remember something like a stack frame 2024-07-01 17:28:27 rendar: Yeah a bit 2024-07-01 17:32:30 rendar didn't you want to make a multiuser remote forth? with sessions 2024-07-01 17:34:27 i think is a cool idea for an irc bot that evaluates forth 2024-07-01 17:34:49 and this channel is missing a bot to evaluate forth code, is quite cool to have that 2024-07-01 17:35:18 you can show what you mean by getting code evaluated in front of our faces 2024-07-01 17:36:02 yet it will get abused 2024-07-01 17:39:31 vms14, yes 2024-07-01 17:40:04 vms14, that would be cool buy my Forth is too different from the original one 2024-07-01 17:40:06 did you keep with that plan or pretend to do it in some future? 2024-07-01 17:41:41 btw, my reflection data is to fix this issue: callbacks! in my system if i define a word which starts with __, i'm defining a callback, let's say __on_data and that callback is called every time some data arrives on some socket, so when the user redefine that word, the system will check if the new redefined callbacks leaves the stack in a known and consistent way 2024-07-01 17:42:27 I think a few months ago somebody did make a Forth IRC but it just self-destructed 2024-07-01 17:42:42 with some weird message about how you learn a lot more making your own bot 2024-07-01 17:43:31 must have had some 'mission impossible' code in there 2024-07-01 18:06:38 vms14: I have a normal standard Forth return stack, which is what I think of when you say "call stack." My "stack frame" system is just an extra register that I can copy the stack pointer into at any time, and which I can then index off of to access particular addresses that are within the stack's scope. 2024-07-01 18:07:03 It's not very different from indexing off the stack pointer itself, except that the frame pointer remains fixed unless I explicitly change it. 2024-07-01 18:07:43 So, for example, inside a stack frame the cell at offset 3 from the frame pointer is always the same piece of data, whereas the cell offset 3 from the stack pointer wanders around as the stack changes. 2024-07-01 18:07:56 All it is is a way to access a portion of the stack like an array. 2024-07-01 18:08:10 Which is officially frowned upon, of course. 2024-07-01 18:08:38 KipIngram what are the coolest features in your forth 2024-07-01 18:08:54 yes, if you get caught you could go to forth jail 2024-07-01 18:09:13 :0 2024-07-01 18:12:20 My favoriate bits of it that are non-standard are the conditional return and recurse features. 2024-07-01 18:12:53 I'm absolutely convinced that those have cause me to evolve toward writing shorter defs and more compact code. 2024-07-01 18:13:50 the "me" word? 2024-07-01 18:13:53 I also quite like the temporary defs (the .: .wipe stuff), but that seems a bit more straightforward to me. 2024-07-01 18:14:05 Oh, well, the me word is really just a shortcut for tail recursion. 2024-07-01 18:14:07 Instead of 2024-07-01 18:14:14 : foo ... ... foo ; 2024-07-01 18:14:17 I can say 2024-07-01 18:14:40 : foo ... ... me ; 2024-07-01 18:14:56 And what actually makes that useful is that it then lets me have conditional version of me. 2024-07-01 18:15:03 0=me and so on. 2024-07-01 18:15:27 i don't remember the names of your conditional returns 2024-07-01 18:15:43 They follow a pattern. 2024-07-01 18:16:00 Choose one of < <= = != >= > 2024-07-01 18:16:08 To get a conditional return, suffix that with ; 2024-07-01 18:16:19 If you want an implicit 0 argument, prefix it with 0. 2024-07-01 18:16:29 And finally if you want it to be unsighed, prefix all that with u 2024-07-01 18:16:40 i remember something with numbers that was kind of a jump 2024-07-01 18:16:45 The ; part can be ; or ;; or me 2024-07-01 18:17:07 m0 or alike? 2024-07-01 18:17:17 No, I don't think so. 2024-07-01 18:17:27 the me words just jump back to the start of the definition. 2024-07-01 18:17:40 Or rather to the last header's target. 2024-07-01 18:17:56 The code that gets compiled has an offset back, of course. 2024-07-01 18:18:04 But that doesn't actually appear in the source in any way. 2024-07-01 18:19:11 The only place I use embedded numbers like that is in the stack frame "accessors." 2024-07-01 18:19:32 f gives me an address that's cells away from the frame pointer. 2024-07-01 18:19:43 i might be confusing them with a jump 2024-07-01 18:20:38 I don't have any source-level jumps; they're all hidden behind the me stuff. 2024-07-01 18:20:38 or with other things, nvm 2024-07-01 18:21:06 it's cool to see anyone's own features 2024-07-01 18:21:20 you have a lot of cool stuff in your forth 2024-07-01 18:33:16 It's all really simple, though. 2024-07-01 23:20:01 So, in this new system I'd planned to use a byte code to jump through a table of 64-bit addresses, like so: 2024-07-01 23:20:18 jmp qword ptr [rdi+8*rbx] 2024-07-01 23:20:23 The byte code is in rbx. 2024-07-01 23:20:50 According to the online assembler side I use, that instruction is still valid even if I use dword instead of qword. 2024-07-01 23:20:59 But that makes the table entries 32 bits instead of 64 bits. 2024-07-01 23:21:23 What happens in that case? I feel like the table entries in that latter case would be treated as offsets. But offsets from what? 2024-07-01 23:21:47 word ptr is valid too, which would mean 16-bit table entries. 2024-07-01 23:23:06 Total guess, but maybe they're just absolute addresses, and spilling over from earlier and smaller architectures? 2024-07-01 23:23:33 (The 16-bit addresses, maybe modified by the 16-bit segment registers?) 2024-07-01 23:26:48 Oh, I found another online source that said that 32-bit jumps of that sort aren't supported in 64-bit mode. 2024-07-01 23:27:16 So maybe the online assembler SHOULD have thrown an error, since I did specify 64-bit mode. 2024-07-01 23:27:41 I was interested in it because it would cut the size of my table in half. 2024-07-01 23:28:20 256 64-bit pointers - a 2kB table. Not problematically huge or anything, but I get greedy sometimes. 2024-07-01 23:28:38 The idea here is for NEXT to look like this: 2024-07-01 23:29:01 mov bl, al ; sar rax, 8 ; jmp [reg+8*rbx] 2024-07-01 23:29:12 That will pick off the bytes of rax one at a time and use them as jump tokens. 2024-07-01 23:29:51 Eventually I'll get either all 0 bits or all 1 bits, and those to table entries will point to code that does LODSQ to reload rax. 2024-07-01 23:30:45 2kB? How profligate! :) 2024-07-01 23:30:45 rbx will always have top seven bytes zero. 2024-07-01 23:32:09 I'm very much not an x86 assembly person. I learned early ARM and some z80.