2022-11-02 05:44:58 hi 2022-11-02 05:45:26 I still try to make a concatenative transpiler, but it sucks so much 2022-11-02 05:45:34 ACTION cries 2022-11-02 05:46:18 the only way I knew to make a transpiler for a stack based concatenative language is to put the stack on the target language 2022-11-02 05:47:05 I dislike that as it's annoying for me since it's a transpiler it should be able to avoid the stack on the target language 2022-11-02 05:47:44 I mean 1 2 + translates to: stack.push(1); stack.push(2); stack.pop() + stack.pop(); 2022-11-02 05:48:04 which is quite ugly and surely affects a lot the performance 2022-11-02 05:49:16 now I try to put the stack on the "compiler" which puts the translated code on the stack and once it finishes loading all the code joins the elements of the stack with a semicolon xD 2022-11-02 05:49:37 but it sucks so much and I have multiple issues 2022-11-02 05:50:16 for example now 1 2 + is translated to 1 + 2 directly, but in the "compiler" this is a literal string 2022-11-02 05:50:35 which makes it difficult to concatenate several operations 2022-11-02 05:51:16 and for example 1 2 3 + - is wrong 2022-11-02 05:51:40 you can translate any stack set (using no dups) into infix 2022-11-02 05:51:42 it outputs 1 - 2 + 3 2022-11-02 05:51:59 if I do 1 2 + 3 - then it works fine 2022-11-02 05:52:03 Infix notation is usually parsed with things like the shunting yard algorithm, so you'll go forwards, and then back to a similar representation, no? 2022-11-02 05:52:23 yea, it is, but this is a transpiler to ....python? 2022-11-02 05:52:28 to js 2022-11-02 05:52:31 ah 2022-11-02 05:52:32 to js 2022-11-02 05:52:57 still the language is from the "C family" so it could apply to almost all of them 2022-11-02 05:53:29 I have no idea on how I should be doing it 2022-11-02 05:53:50 atm the words just generate code and push it to the stack 2022-11-02 05:54:00 translate simple arithmetic postfixes to simple arithmetic infixes first 2022-11-02 05:54:03 words taking arguments will take literal translated code as argument 2022-11-02 05:55:35 I'll try to do it that way eris[m] 2022-11-02 05:55:36 ty 2022-11-02 05:56:03 it's kind of what I was doing, but in a different way 2022-11-02 05:56:23 + just takes two elements and writes one + two 2022-11-02 05:56:40 you can then translate stack combinators to assignments 2022-11-02 05:56:56 but, thats getting a bit whiffy 2022-11-02 05:56:58 but the elements are literal code so they mess with some stuff 2022-11-02 05:57:43 but if I translate them to infix notation I can take them as a unit and forget about having words like + - * and / 2022-11-02 05:58:45 looks like a worth thing to try 2022-11-02 06:01:24 and maybe you're disappointed with the fact that is going to be js, but C is actually a very good target I'll like to have too 2022-11-02 06:02:16 the thing is js will let me make web applications, still having one that transpiles to C avoiding putting a stack on the C side seems a good idea 2022-11-02 06:04:20 I'll try to find a way to change all postfix arithmetic to infix before "interpreting" any word 2022-11-02 06:04:32 ty for the hints 2022-11-02 06:04:51 👍️ 2022-11-02 06:05:08 what 2022-11-02 06:05:22 thumbs up 2022-11-02 06:05:46 ah, emacs client shows "???" instead xD 2022-11-02 06:05:58 `1 1 + dup func` might be translated as `x = 1+1; func(x,x)` 2022-11-02 06:06:05 Emojis were a mistake. 2022-11-02 06:06:06 you wont be able to have variadic stack effects 2022-11-02 06:06:33 I'd like to avoid those assignments 2022-11-02 06:07:23 what I want to try is to somehow find all arithmetic operations and translate them to infix, making them a "single unit" 2022-11-02 06:07:47 you wont be able to avoid the assignments if you want stack effects, idk 2022-11-02 06:08:21 like 1 2 3 + + would be translated to '1 + 2 + 3' which will be taken as a single argument (or element in the stack) 2022-11-02 06:08:51 yea, you can do the first pretty easy 2022-11-02 06:08:58 but 'which will be taken as a single argument'? 2022-11-02 06:09:07 the whole '1 + 2 + 3' 2022-11-02 06:09:54 to... what 2022-11-02 06:10:14 would be a string, the words will take that string 2022-11-02 06:10:58 so 1 2 3 + + will end being a string with "1 + 2 + 3" and the words using them like . will end like "print(1 + 2 + 3)" 2022-11-02 06:11:36 I don't know if I'm missing something important there btw 2022-11-02 06:14:26 how will dup translate 2022-11-02 06:14:52 no idea 2022-11-02 06:15:13 asssssssignmentsssss 2022-11-02 06:15:25 or destructuring 2022-11-02 06:18:07 Couldn't you just use a bunch of numbered variables like SSA in compiler optimization? 2022-11-02 06:18:19 the stack is only present at compile time, so dup would duplicate code 2022-11-02 06:19:02 the elements on the stack will be literal target code as a string 2022-11-02 06:19:26 dup would just duplicate that string 2022-11-02 06:20:47 not sure if I'll be able to make a transpiler without putting the stack on the target language 2022-11-02 06:20:55 "1 2 + dup +" becomes "x0=1;x1=2;x2=x0+x1;x3=x2;x4=x2+x3;" 2022-11-02 06:21:38 Then let the JS optimizer figure out that it doesn't need very much memory despite the high number of variables 2022-11-02 06:23:56 I dislike that :/ 2022-11-02 06:24:12 but maybe is the most correct idea 2022-11-02 06:26:11 with what I have now '1 2 + dup +' translates to '1 + 2 + 1 + 2' 2022-11-02 06:26:25 3? 2022-11-02 06:28:18 6 2022-11-02 06:29:03 which could seem to work fine, but arithmetic is broken in that way 2022-11-02 06:29:12 I can't 1 2 3 + + 2022-11-02 06:29:42 Why implement a new system instead of using one that exists? For fun? 2022-11-02 06:29:52 will work but if it's + - instead the - will go to 1 - 2 which is not what I want 2022-11-02 06:30:07 olle: I suppose the only real answer to that is that I'm an asshole 2022-11-02 06:30:20 To yourself? xD 2022-11-02 06:31:04 I have several shitty concatenative interpreters and could end being "useful" 2022-11-02 06:31:24 but I want to make a transpiler instead, so words have 0 cost 2022-11-02 06:31:44 I can abuse colon definitions and the target language won't notice it 2022-11-02 06:32:09 also to avoid the overhead of an interpreter and the stack pushing/popping 2022-11-02 06:32:49 but yes, I could be writing js code directly instead 2022-11-02 06:33:09 not as fun as that, but much more productive 2022-11-02 06:34:12 also using my own interpreters ended being hard when I wanted to do more than a hello word 2022-11-02 06:40:03 olle: also the reason is I like forth, but I can't do a lot of stuff with it 2022-11-02 06:40:15 like db, sockets, gui, etc 2022-11-02 06:41:00 I didn't find a forth that works in my machine and does this kind of stuff, so I try to make my own 2022-11-02 06:42:16 if I had a forth able to do such stuff I would just use that, like if I were able to make gforth use ffi in my system 2022-11-02 06:42:54 any forth implementation will be much better than my own shit 2022-11-02 06:43:48 but I can only use pforth and alike, to do gui, db, sockets or alike, I should use files or pipes 2022-11-02 06:45:04 Factor is not good enough? 2022-11-02 06:45:17 there's no binary for NetBSD 2022-11-02 06:45:25 It's not open source? 2022-11-02 06:47:33 seems there's a build for openbsd 2022-11-02 06:47:54 https://concatenative.org/wiki/view/Factor/Requirements 2022-11-02 06:49:14 :0 also for netbsd 2022-11-02 06:49:19 clean-netbsd-x86-32 2022-11-02 06:49:32 Neat 2022-11-02 06:49:50 vms14: Why can't you do GUI and DB in gforth tho? 2022-11-02 06:50:07 Or at least DB, GUI is not needed since it's interactive... :d 2022-11-02 06:52:34 olle: gforth has a nice ffi, you can do some stuff with that, but I wasn't able to configure it properly in order to let it find the libraries 2022-11-02 06:52:57 also for some reason the netbsd devs removed the gforth binary 2022-11-02 06:54:01 Interesting 2022-11-02 06:54:11 vms14: Which machine are you on really? 2022-11-02 06:54:34 NetBSD localhost 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug 4 15:30:37 UTC 2022 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64 2022-11-02 06:54:41 it's a gpd micro pc 2022-11-02 06:55:11 https://gpd.hk/gpdmicropc 2022-11-02 06:57:30 Cute, like a 3DS :D 2022-11-02 07:01:13 always wanted a umpc, I wanted something like a jornada or zaurus, but I think this is the best thing I could have 2022-11-02 07:01:35 it has 8G of ram and 128G of disk, so I can actually do something 2022-11-02 07:02:15 the only complaint I have is I'd like the battery to last more time 2022-11-02 07:02:15 Kewl 2022-11-02 07:07:55 gtg, see you guys, ty for the hints 2022-11-02 07:09:49 \o 2022-11-02 09:29:03 https://www.youtube.com/watch?v=--IJEl6HV2k 2022-11-02 09:29:07 LEO BRODIE FORTH 2020 ZOOM-7-2021