00:00:00 --- log: started forth/14.11.11 00:09:54 --- join: impomatic (~chatzilla@235.198.208.46.dyn.plus.net) joined #forth 01:02:52 --- quit: aranhoide (Ping timeout: 245 seconds) 01:17:05 --- quit: proteusguy (Ping timeout: 245 seconds) 01:30:41 --- join: proteusguy (~proteusgu@ppp-110-168-229-241.revip5.asianet.co.th) joined #forth 01:46:09 --- quit: samrat (Quit: Computer has gone to sleep.) 01:46:39 --- join: samrat (~samrat@61.12.96.226) joined #forth 01:52:12 --- join: xyh (~xieyuheng@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 01:53:50 --- join: vektorman (~quassel@78.83.25.116) joined #forth 02:14:57 --- join: true-grue (~grue@95-28-161-210.broadband.corbina.ru) joined #forth 02:24:36 --- quit: samrat (Quit: Computer has gone to sleep.) 02:27:22 --- join: samrat (~samrat@61.12.96.226) joined #forth 02:38:57 --- quit: vektorman (Read error: Connection reset by peer) 02:53:17 --- quit: xyh (Ping timeout: 244 seconds) 03:07:28 --- quit: DGASAU (Ping timeout: 245 seconds) 03:20:06 --- join: xyh (~xieyuheng@113.119.215.202) joined #forth 03:21:02 --- join: DGASAU (~user@p50993595.dip0.t-ipconnect.de) joined #forth 03:25:19 --- quit: ehaliewicz (Ping timeout: 244 seconds) 03:39:14 --- join: Zarutian (~zarutian@168-110-22-46.fiber.hringdu.is) joined #forth 03:40:05 --- quit: Zarutian (Read error: Connection reset by peer) 03:40:25 --- join: Zarutian (~zarutian@168-110-22-46.fiber.hringdu.is) joined #forth 03:57:53 --- quit: samrat (Quit: Computer has gone to sleep.) 04:16:53 --- nick: Anarch_ -> Anarch 04:20:18 --- join: true-grue_ (~grue@95-25-114-120.broadband.corbina.ru) joined #forth 04:22:30 --- quit: true-grue (Ping timeout: 255 seconds) 04:35:28 if instead of the main argument-stack, I use 6 more argument-stacks. and make every function be able to name this 6 stacks by their own wishes. functions still use the main argument-stack to pass arguments, but at every beginning of the function call, a function is able to fetch the arguments from the main argument-stack and push them to the self-named 6 stacks. then I can use local variables [6 at most], and th 04:35:28 is system works well with forth's original features. 04:49:08 --- quit: DGASAU (Ping timeout: 245 seconds) 04:55:09 --- join: DGASAU (~user@p50993595.dip0.t-ipconnect.de) joined #forth 05:05:57 xyh: probably, but what for? 05:07:25 for fun 05:17:07 --- quit: Azel (Ping timeout: 264 seconds) 05:18:21 --- part: FireFly left #forth 06:05:20 --- join: ErhardtTheWhite (~quassel@93-43-71-119.ip90.fastwebnet.it) joined #forth 06:05:55 --- quit: ErhardtMundt (Ping timeout: 265 seconds) 06:18:40 --- join: gabriel_laddel (~user@c-67-161-28-199.hsd1.ca.comcast.net) joined #forth 06:40:02 --- quit: gabriel_laddel (Ping timeout: 256 seconds) 06:42:45 --- join: samrat (~samrat@123.236.183.195) joined #forth 06:50:16 --- quit: xyh (Remote host closed the connection) 06:53:38 --- join: gabriel_laddel (~user@c-67-161-28-199.hsd1.ca.comcast.net) joined #forth 06:57:32 --- quit: backer (Ping timeout: 245 seconds) 07:23:39 --- join: xyh (~xieyuheng@113.119.215.202) joined #forth 07:32:16 --- join: backer (~backer@user-1087i73.cable.mindspring.com) joined #forth 07:34:40 --- quit: xyh (Remote host closed the connection) 07:38:50 --- quit: Zarutian (Quit: Zarutian) 07:53:46 --- join: spoofer (~cruella@72.10.28.164) joined #forth 08:01:27 --- join: Zarutian (~zarutian@168-110-22-46.fiber.hringdu.is) joined #forth 08:01:54 --- join: vanila (~user@unaffiliated/vanila) joined #forth 08:07:17 --- join: xyh (~xieyuheng@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 08:17:14 What is a good example of assembler syntax in Forth? Specifically I'm interested in a full x86_64 set and the strategy used for dealing with the SIB part of the instruction. Thanks. 08:40:35 SIB? 08:41:16 spoofer: threaded-code in assembler by macros ? 08:42:25 spoofer: there's no good example. 08:42:43 xyh: I'm interested in the machine forth end of things right now, and SIB is the scale index base part of the instruction. 08:42:46 It is especially so for complex command set like amd64's. 08:43:09 xyh: [rax+rbx*4+1500] sort of thing is how it would be in nasm. 08:44:10 You can try using Horst's assembler, but in general you shouldn't. 08:45:49 spoofer: you are writing forth assembler ? 08:46:42 spoofer: you can design your own syntax then. 08:46:52 spoofer: your best syntax 08:46:56 xyh: I tinker. I've done a very minimal thing that gets me going, but I'd be much happier with a full featured assembler. 08:47:43 That's quite stupid. 08:48:04 xyh: lol. yeah, I was looking for a clever way of encoding [rax+rbx*4+n] with out resorting to parsing the string, but now that there are 16 general purpose registers, it's too much for individual words. 08:51:22 --- quit: xyh (Ping timeout: 244 seconds) 08:53:24 --- join: xyh (~xieyuheng@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 08:54:56 spoofer: where is your assembler? I wish to design an assembler myself too :) 09:22:31 --- quit: backer (Remote host closed the connection) 09:22:44 --- join: backer (~backer@user-1087i73.cable.mindspring.com) joined #forth 09:22:55 --- join: ehaliewicz (~user@50-0-50-37.dsl.dynamic.fusionbroadband.com) joined #forth 09:29:57 xyh: For now, my syntax is : asm_mov_[dsp]_tos .code1( 4D,89,3E) ; INLINEABLE // mov [r14],r15 09:30:08 --- quit: backer (Ping timeout: 250 seconds) 09:31:11 xyh: Basically, write it in nasm, produce the listing file, and copy the bytes. My INLINEABLE modifier makes the word get mem copied when executed. 09:33:23 INLINEABLE copy mem to output-file ? 09:35:03 to my word definition, i.e when you call it from another word, rather than generating a call, mem copy the opcodes. Remember this is machine forth. 09:35:12 all words are PRIMITIVES. 09:36:16 what is a machine forth ? 09:36:24 all words are PRIMITIVES forth ? 09:37:43 --- join: backer (~backer@user-1087i73.cable.mindspring.com) joined #forth 09:38:32 spoofer: I don't understand, but it's cool for you to have your assembler designed :P 09:38:43 * DGASAU shrugs. 09:38:54 machine forth is what color forth is, there is no inner interpreter. 09:40:55 I went through the "Threaded Interpretative languages" book eons ago and words were SECONDARYs or PRIMITIVES, I've not studied traditional forth much. 09:41:34 * DGASAU shrugs. 09:41:43 Compiler technologies of sixties... 09:42:43 spoofer: the function body of a word of your forth is an array of function calls ? 09:44:41 xyh: yes, intermixed with machine code as appropriate, for example, inlineable words. 09:49:47 spoofer: you use the x86's stack as return-stack, and implement your argument-stack by macro ? 09:52:17 xyh: I hava a separate stack with a register reserved for TOS. Also a separate floating point stack. 09:52:36 It was easy, and I'm tinkering... :) 09:53:31 I'm most interested as Linux as my abstract machine, that is in contrast to the embedded applications. 10:03:38 spoofer: with an inner interpreter, NON-PRIMITIVES are just data, only PRIMITIVES are real code that can be executed by CPU, thus, maybe PRIMITIVES can be better cached by CPU. 10:03:44 [some actual tests would be interesting, and I am just guessing here] 10:05:56 spoofer: do you know a runable color forth implementation on linux? I have tryed some, but none of them works. 10:07:24 xyz: Sorry, I'm not aware of any cf for linux. Admittedly, I haven't looked very hard either. I just read the stuff by Jeff Fox and Charles Moore on their websites. 10:07:56 spoofer: I am xyh not xyz :P 10:08:15 spoofer: xyh for "xie yu heng" 10:08:45 My understanding of what type of threading and machine forth or not depend a lot on the CPU architecture. Some ways are faster/slower and not universally the same. 10:09:31 spoofer: maybe CPU cache is about "mov", and store function call in function body do is faster :) 10:10:18 xyh: If it's important, profile it, I don't know. 10:14:43 hi all! about threaded-code. is it true that :: [on speed: subroutine > directed > indirected] and [on memory: subroutine < directed < indirected] 10:14:47 (where ">" denotes "better then".) 10:17:41 http://www.complang.tuwien.ac.at/forth/threading/ has some comparisons 10:18:41 --- join: Azel (~Thunderbi@ANice-653-1-528-181.w86-205.abo.wanadoo.fr) joined #forth 11:09:20 --- quit: ehaliewicz (Ping timeout: 244 seconds) 11:12:26 I find that tail-call-optimization is tricky in indirected-threaded-code, you have to let the inner interpreter check "whether it is the end of a function-body" everytime you move to the next word. while in subroutine-threaded-code it would be easy as :: "call function; ret" --> "tail-call function" (a macro) 11:15:54 I don't see any problem. 11:16:28 DGASAU: ? 11:16:40 When you do ITC, you almost always align your XT. 11:16:53 So, you can use one bit to mark XTs that are in tail position. 11:17:02 Your inner interpreter can use this information. 11:21:09 Besides, your inner interpreter has to know this information straight ahead. 11:22:00 So, you have to pass tail position information to it anyway. 11:22:50 Reusing one of those always zero bits is nice solution. 11:24:21 DGASAU: In my implementation, I let the inner interpreter find out the end of function body, by checking if the next thing in the function body is a label called "Exit". it makes next a little larger. but, IMO the problem is that, when I am compiling. I already knows where the tail position is, so the inner interpreter should not ask this fact all the time. 11:25:20 See above, you have to mark tail positions in compiler anyway. 11:25:43 At least when you want to handle general case. 11:26:20 You understand that in "if ... w else ... then ;" "w" is in tail position, don't you? 11:27:13 If you don't optimise branch instruction away, your "smart" inner interpreter won't notice that "w" is in tail position. 11:28:05 --- quit: Zarutian (Quit: Zarutian) 11:31:17 DGASAU: it there is nothing after "then", the syntax in my implementation shoud be :: "if ... w Exit else ... Exit then ;" or "if ... w Exit then ... Exit ;" 11:32:01 This is quite unusual syntax. 11:33:14 I mean, if you're going to start using "exit" as a hint to your optimiser, 11:33:52 the "Exit" must be explicit, and it is true that "if ... w else ... then Exit ;" can not get optimised by my inner interpreter 11:33:54 you can go a little bit further and use special form to make these jumps instead of calls. 11:39:02 I mean the tail-call-optimization should be done at compile-time, not at interpret-time... but this is simply can not be achieved in an indirected-threaded-code implementation :( 11:39:46 ??? 11:39:53 No, you're wrong. 11:40:04 how, then? 11:40:18 I'd like to hear 11:40:22 See above. 11:41:18 When you generate XT, you can allocate one bit to mark tail position. 11:41:41 When you inner interpreter gets XT to call, it checks that bit. 11:42:03 If it is zero, it pushes return point to stack, 11:42:18 if it is one, i.e. you're doing tail call, it doesn't push return point to stack. 11:42:29 I mean the "checking" is the problem. 11:42:36 ??? 11:43:37 in subroutine-threaded-code I can compile function-body with :: "call function; ret" ==optimise==> "tail-call function" (a macro) 11:43:39 w = *ip++; if (w & 1) {ip = w;} else {*--rp = ip; ip = w;}; 11:44:03 Or something like that. 11:45:23 wow actual forth discussion! 11:45:55 in subroutine-threaded-code, the CPU is my "inner interpreter", and it is not checking the tail position this time. 11:46:39 beretta: orz, you mean most discussions here are not about forth !? 11:47:03 xyh: in STC you do the same. 11:47:15 DGASAU: STC? 11:47:22 Subroutine-threaded code. 11:47:34 In STC you do the same. 11:47:50 The only difference is that you lift "if (w&1)" part. 11:48:19 So, your code becomes: "call s1; call s2; call s3; go s4". 11:49:15 In ITC you do "s1; s2; s3; s4'", where ' denotes modified XT to mark tail position. 11:49:57 You simply encoded call/go in single bit. 11:52:48 I mean, in STC, when the CPU interprets "call s1" it just do it. in ITC, when an inner interpreter interprets "s1" it has to check if it is with the mask or not. 11:53:43 Yes, that's true. 11:54:24 Inner interpreter is essentially an implementation of microcoded architecture. 11:54:44 if speed is a concern, then the tail call in ITC is kinda self-defeating? 11:55:22 If speed is a concern, using Forth is idiotic decision. 11:56:21 beretta: I have a solution 11:56:50 its probably great for recursion though. 11:57:09 DGASAU: lol 11:57:31 one solution is to only do tail-call-optimization for recursive-tail-call 11:57:43 I just use a forth version of JMP if I do recursion. 11:57:46 * one solution is to only do tail-call-optimization ONLY for recursive-tail-call 11:58:12 Mutual recursion presents a problem, unless you're doing classical compiler. 11:58:44 DGASAU: yes 11:59:34 indeed. 11:59:49 If you do only self-referential recursion, then you should use "recurse". 12:00:18 That's for start. :) 12:00:30 I'm a bad boy, and don't bother "smudging" or back linking... 12:00:33 DGASAU: wait, tail-call-optimization can help mutual recursion too ? 12:01:01 Since you end up using explicit construct, you can use explicit construct for tail call. 12:01:09 That idiotic, but that's Forth. 12:01:24 xyh: of course, it helps. 12:01:42 That's how you implement FSAs in sane way. 12:01:55 FSAs ? 12:02:07 Finite state automata. 12:02:27 DGASAU: a example of mutual recursion get helped by tail-call-optimization ?? 12:02:37 * an example 12:02:58 Go to Wikipedia and read about finite state transducers. 12:03:04 E.g. Mealy or Moore machines. 12:03:14 I ll 12:04:14 Seriously, in Scheme community you would be pointed to it faster than here. 12:04:22 is "FSA" just mathematically generalized "FSM" or something? 12:04:43 yeah.. forthies are just slow. 12:04:44 It is the same concept, only "automaton" is more rigorous term. 12:05:05 It has less extra connotations that can mud the water. 12:09:19 --- quit: samrat (Quit: Computer has gone to sleep.) 12:16:23 I had a teacher in school that refused to listen to any rebukes of recursion do to stack use. 12:17:39 that was in the bad old day of everything JAVA. JAVA is your mother. JAVA will soon run everything! 13:03:17 --- join: Mat3 (~Mat3@ip5b414c9f.dynamic.kabel-deutschland.de) joined #forth 13:03:22 hello 13:03:53 hello Mat3 13:04:06 hi beretta 13:04:17 who you doing ? 13:04:23 sorry how you doing 13:04:41 I am OK. Just lazing around. 14:40:49 --- quit: true-grue_ (Read error: Connection reset by peer) 14:58:34 --- join: aranhoide (~smuxi@124.Red-79-158-172.staticIP.rima-tde.net) joined #forth 15:32:07 You can do mutual recursion in Forth by using a vectored word. 15:32:43 Create the vectored word, write the first word that calls the vectored word, write the second word, vector the vectored word to run the second word. 15:32:59 The second word calls the first word in the normal way. 15:33:19 Not as easy as with compilers that figure that all out for you. 15:35:31 KipIngram: in my implementation compiler figure that out for me. the above is about optimization, not about usage. 15:35:58 I can do :: 15:35:58 : xxx help-xxx Exit ; define-verb 15:36:05 and then do 15:36:34 : help-xxx Exit ; define-verb 15:37:23 looks interesting 15:37:28 Yes. 15:37:44 compiler find out that "help-xxx" is undefined yet, and remember the name-address pair in a list 15:37:44 when help-xxx get defined, 15:38:26 Ah. 15:38:53 It does that anytime it encounters an undefined word? Even if it's actually an error? 15:38:58 When do errors get reported? 15:39:15 it fetch the name-address pair from the list, and you see the hwo it works ... 15:39:16 * how 15:39:58 So if I have 15:40:09 : word x y z ; 15:40:26 And x is undefined, when does it tell me that an undefined word was encountered? 15:40:59 KipIngram: if I do : xxx help-xxx Exit ; define-verb 15:40:59 but do not define xxx-help, and just call "xxx" 15:41:25 What does define-verb do? 15:41:39 So you get a run-time error, not a compile time error? 15:41:46 I guess if an error is detected if the word does not exist in the hidden list 15:42:09 That's interesting; I'm assuming you initially compile a pointer to an error routine, and then it gets patched over later when the word is defined? 15:42:40 Does the list maintain an index of all the places you used it, or do you have to search and find them? 15:42:59 ciao 15:43:09 --- part: Mat3 left #forth 15:43:36 What's Exit for? 15:44:11 KipIngram: yes runtime error, the list maintain all the places 15:44:19 Ok. 15:44:46 Very interesting concept. Adds a good bit of complexity to the compiler; probably more than using vetored words, but it's still interesting. 15:44:50 KipIngram: in my language "Exit" must be explicitly used 15:45:06 I see - so you always have that and it's not pertinent to this particular example. 15:45:16 ; is just a STATE-changer. 15:45:22 KipIngram: no 15:45:46 : xxx 1 2 . Exit ; 15:45:57 will push a string to argument-stack 15:46:04 Yes - why don't you just have ; compile Exit? 15:46:10 define-verb compiles it 15:46:23 for I have define-none too 15:46:46 But all of that is a whole separate thing from the recursion stuff, right? 15:46:59 KipIngram: and no STATE of interpreter anymore 15:47:08 Oh, I see. 15:47:10 KipIngram: yes separate thing 15:47:16 I've never liked STATE very much. 15:47:27 me too :) 15:47:51 It makes the code less verbose, but it leads to uncleanliness of its own. 15:48:28 So when you define help-xxx it deletes all of the help-xxx related stuff from the list. 15:48:53 yes, IMO two STATEs of the interpreter. needs to be separated to two functions 15:49:21 KipIngram: yes 15:49:21 just some little trivial tricks 15:50:58 That's quite interesting. It may add more overhead to the compiler but it removes the issue completely from the user's perspective. 15:53:36 KipIngram: I quote :: ``It is more important for the interface to be simple than the implementation.'' 15:54:50 KipIngram: I have to get some sleep now, any more questions about my lovely little language :P 15:57:32 bye bye 15:57:35 --- part: xyh left #forth 16:02:46 --- quit: aranhoide (Ping timeout: 256 seconds) 16:03:24 Re: "simplicity for the interface rather than the implementation" - that's more reasonable now than in the day when Forth was invented, when systems were very constrained. 16:03:45 These days room exists for side lists and things like that. 16:09:25 I can't figure out why I have a ghost nick here. 16:09:43 KipIngram_ looks like some sort of a leftover of mine. 16:10:02 --- join: PoppaVic (~pops@unaffiliated/poppavic) joined #forth 16:14:55 --- part: PoppaVic left #forth 16:17:24 --- quit: KipIngram_ (Remote host closed the connection) 16:17:49 There he went. 16:18:01 Looks like znc was running on my server and maintaining that nick. 16:30:01 --- join: protist (~javery@171.225.69.111.dynamic.snap.net.nz) joined #forth 16:32:29 --- join: PoppaVic (~pops@unaffiliated/poppavic) joined #forth 16:37:44 --- join: impomatic_ (~digital_w@235.198.208.46.dyn.plus.net) joined #forth 17:11:06 --- join: Zarutian (~zarutian@168-110-22-46.fiber.hringdu.is) joined #forth 18:11:22 --- join: aranhoide (~smuxi@124.Red-79-158-172.staticIP.rima-tde.net) joined #forth 18:28:08 --- join: samrat (~samrat@123.236.183.195) joined #forth 18:31:48 --- quit: aranhoide (Ping timeout: 255 seconds) 18:34:30 --- quit: samrat (Ping timeout: 240 seconds) 18:43:06 --- quit: Zarutian (Quit: Zarutian) 18:47:00 KipIngram: you dont need znc for hosting your irc, just like me, open a tmux session on your server and connect to here via any client 18:51:15 --- join: klltkr_ (~klltkr@unaffiliated/klltkr) joined #forth 18:53:02 --- quit: klltkr (Ping timeout: 265 seconds) 19:03:12 --- join: samrat (~samrat@123.236.183.195) joined #forth 19:41:53 --- join: saml_ (~saml@pool-71-190-3-251.nycmny.east.verizon.net) joined #forth 19:51:43 --- quit: saml_ (Ping timeout: 244 seconds) 20:04:28 --- join: saml_ (~saml@pool-71-190-3-251.nycmny.east.verizon.net) joined #forth 20:05:19 --- part: PoppaVic left #forth 20:11:05 --- quit: saml_ (Ping timeout: 250 seconds) 20:25:03 --- quit: probonono (Read error: Connection reset by peer) 20:26:05 --- join: probonono (~User@unaffiliated/probonono) joined #forth 20:44:20 --- quit: spoofer (Quit: Leaving) 20:46:52 --- quit: samrat (Quit: Computer has gone to sleep.) 21:37:41 --- join: samrat (~samrat@61.12.96.226) joined #forth 21:54:41 --- quit: gabriel_laddel (Ping timeout: 245 seconds) 22:00:02 --- quit: vanila (Quit: Leaving) 22:10:57 --- quit: proteusguy (Remote host closed the connection) 22:32:01 --- quit: probonono (Quit: Upgrading to 10-RC4) 22:44:13 --- quit: beretta (Ping timeout: 264 seconds) 22:47:13 --- quit: Azel (Ping timeout: 264 seconds) 22:57:23 --- join: beretta (~beretta@cpe-65-185-42-203.columbus.res.rr.com) joined #forth 23:29:19 --- join: proteusguy (~proteusgu@cm-171-101-24-28.revip11.asianet.co.th) joined #forth 23:43:55 --- quit: proteusguy (Ping timeout: 258 seconds) 23:51:36 --- join: proteusguy (~proteusgu@cm-171-101-24-28.revip11.asianet.co.th) joined #forth 23:57:11 --- join: nighty-_ (~nighty@hokuriku.rural-networks.com) joined #forth 23:58:15 --- quit: proteusguy (Ping timeout: 256 seconds) 23:59:33 --- join: proteusguy (~proteusgu@cm-171-101-24-28.revip11.asianet.co.th) joined #forth 23:59:59 --- log: ended forth/14.11.11