00:00:00 --- log: started forth/15.04.04 00:07:12 --- join: proteusguy (~proteusgu@ppp-110-168-229-109.revip5.asianet.co.th) joined #forth 00:07:13 --- mode: ChanServ set +v proteusguy 00:16:24 --- quit: vsg1990 (Quit: Leaving) 00:40:49 --- quit: irsol (Remote host closed the connection) 00:43:12 --- quit: mnemnion (Remote host closed the connection) 00:46:41 --- join: GeDaMo (~GeDaMo@212.225.93.112) joined #forth 01:02:28 --- join: irsol (~irsol@unaffiliated/contempt) joined #forth 01:12:39 --- quit: xyh (Ping timeout: 265 seconds) 01:46:27 --- join: xyh (~xyh@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 03:15:55 --- quit: xyh (Remote host closed the connection) 03:19:30 --- join: ErhardtMundt (~kvirc@93-43-157-67.ip92.fastwebnet.it) joined #forth 03:20:18 hello 03:25:27 I didn't get how DOES> works exactly 03:25:42 does it expect any token to be on the control stack? 03:27:36 The exact details will depend on the implementation 03:27:42 Do you mean at compile time? 03:28:11 well, I'm trying to understand what the standard says about that 03:28:25 yes, I'm referring to the compilation time 03:28:38 ( C: colon-sys1 -- colon-sys2 ) 03:28:50 that's what I'm considering 03:29:36 I'm a bit confused since DOES> is meant to be used in conjunction with CREATE, which doesn't leave anything on any stack 03:29:50 Yeah, I'm just looking for a definition of colon-sys 03:31:11 Apparently it's a "definition compilation" which tells me nothing :| 03:31:36 Ah, ':' leaves a colon-sys 03:31:53 And ';' removes it 03:32:30 An ambiguous condition exists if name was not defined with CREATE or a user-defined word that calls CREATE. 03:32:46 that's awkward 03:34:37 CREATE just creates a name in the dictionary, it does nothing related to compiling code 03:35:27 oh, now I got it 03:35:27 DOES> ends the 'create time' code and begins the 'run time' code 03:36:18 is CREATE an immediate word? 03:36:22 No 03:37:36 ok, what about DOES> ? 03:37:52 the standard says it appends the semantics to the newly defined word 03:38:29 It may depend on the implementation but I would say yes 03:38:38 can I append more than a semantic? 03:38:50 Such as what? 03:39:13 --- quit: djinni_ (Ping timeout: 256 seconds) 03:39:27 I don't know, I saw stuff like 03:39:28 : CONSTANT CREATE , DOES> @ ; 03:40:00 what if I add another DOES> word after DOES> @ ? 03:40:25 Hmmm ... I'm not sure what that would do 03:41:08 the behaviour I'd expect is the semantic to be replaced with the last DOES> 03:41:54 having more than a single semantic would imply that the data field is no more available to... data 03:42:24 is that reasonable? 03:42:51 --- join: djinni (~djinni@105.ip-167-114-152.net) joined #forth 03:43:17 On gforth, the first time I ran the created word, I got the first does code; on subsequent runs I get the second does code 03:44:08 so does it replace the old semantic with the new one? 03:44:21 It appears so 03:44:49 ok, the world's still spinning the right way 03:44:52 \o/ 03:53:48 "DOES> effectively ends one definition and begins another as far as local variables and control-flow structures are concerned." 03:54:05 From appendix A of the standard 04:43:41 --- join: mnemnion (~mnemnion@c-98-210-219-91.hsd1.ca.comcast.net) joined #forth 04:48:18 --- quit: mnemnion (Ping timeout: 250 seconds) 05:31:14 --- quit: proteusguy (Remote host closed the connection) 06:00:01 --- join: Zarutian (~Adium@168-110-22-46.fiber.hringdu.is) joined #forth 06:03:17 --- join: saml_ (~saml@cpe-24-102-97-97.nyc.res.rr.com) joined #forth 06:05:56 --- join: proteusguy (~proteusgu@183.89.93.116) joined #forth 06:05:56 --- mode: ChanServ set +v proteusguy 06:17:03 --- join: nighty-_ (~nighty@hokuriku.rural-networks.com) joined #forth 06:32:42 --- quit: Zarutian (Ping timeout: 252 seconds) 06:46:43 --- join: Zarutian (~Adium@168-110-22-46.fiber.hringdu.is) joined #forth 07:03:17 --- join: johnmark_ (~johnmark@c-73-51-235-57.hsd1.il.comcast.net) joined #forth 07:07:36 --- quit: Zarutian (Quit: Leaving.) 07:28:15 --- join: mnemnion (~mnemnion@c-98-210-219-91.hsd1.ca.comcast.net) joined #forth 07:45:57 --- quit: darkf (Quit: Leaving) 07:58:09 --- join: Zarutian (~Adium@168-110-22-46.fiber.hringdu.is) joined #forth 08:05:07 --- join: xyh (~xyh@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 08:11:55 --- quit: xyh (Remote host closed the connection) 08:18:59 --- join: kumul (~mool@adsl-72-50-87-208.prtc.net) joined #forth 08:37:38 --- join: xyh (~xyh@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 08:57:09 --- join: impomatic (~chatzilla@195.166.144.203) joined #forth 09:02:53 --- join: true-grue (~grue@95-27-151-139.broadband.corbina.ru) joined #forth 09:27:57 --- nick: karswell` -> karswell 09:31:43 --- join: vsg1990 (~vsg1990@cpe-67-241-148-119.buffalo.res.rr.com) joined #forth 09:32:50 --- join: Soni (SoniEx2@unaffiliated/soniex2) joined #forth 09:33:30 hmm... 09:35:08 how would I go about implementing a forth VM? 09:35:45 http://www.bradrodriguez.com/papers/moving1.htm 09:40:04 Soni: how much do you know about Forth? 09:40:18 not much, other than it has a stack 09:40:33 Two stacks 09:40:43 2? 09:40:50 Data stack and return stack 09:41:05 oh ok 09:41:12 And possibly others 09:41:49 What other languages do you know? 09:41:53 so I wanna do just a VM, no parser or any of that 09:42:41 Forth doesn't need much in the way of parsing 09:43:02 I know Lua, Java, JS, Python, I don't really know C but I'm trying to learn it, uhh... 09:43:30 I also know English and Portuguese, as you didn't specify what kind of languages :P 09:43:36 :P 09:43:48 Which language do you want to implement your Forth in? 09:43:54 Lua 09:44:02 I already know how to get the 2 stacks 09:45:38 Lua allows storing function references in variables, right? 09:46:00 yeah 09:46:07 the call stack is the return stack 09:46:13 varargs is the data stack 09:46:37 A definition could just be a list of functions 09:47:37 or a list of functions and tables 09:47:53 (that is, a table of functions and tables) 09:48:19 functions = built-ins, tables = ... you get the idea 09:54:44 When you call another word, what gets pushed on the return stack would probably be the table, index from the current word 09:55:11 nope 09:55:27 How are you keeping track of where you are? 09:55:48 http://imgur.com/aoh0vAO 09:57:07 So what's getting passed to the functions? 09:57:20 the data stack 09:58:20 Just say I define something like : square dup * ; 09:58:58 How are you stepping through the calls? 09:59:06 it'd do words["square"] = {words["dup"], words["*"]} 09:59:18 Soni: https://github.com/the-little-language-designer/cicada-nymph 09:59:20 this just calls into itself 10:00:00 I'd have a local function vm(word, idx, ...) and "..." would be the data stack, "word" would be a table, "idx" would be the current index in the table, etc 10:01:12 then for every entry in the table, if it's a table, it'd return vm(word, idx + 1, vm(word[idx], 1, ...)) 10:02:32 xyh: I think you may consider this classic book for "teaching purposes" :) http://www.amazon.com/Threaded-Interpretive-Languages-Design-Implementation/dp/007038360X 10:04:14 Soni: I still think you're going to need some kind of return stack 10:04:24 GeDaMo, that's the call stack 10:04:55 true-grue: thanks, I hope one day my work could be more helpful to new people too 10:05:08 --- quit: Zarutian (Ping timeout: 256 seconds) 10:09:22 GeDaMo, it works! http://imgur.com/H2XGdmr 10:10:20 altho it's a pain to write "forth" like that so I'm probably gonna write a parser and a "VM" for it 10:10:40 Cool :) 10:10:42 Soni: will . print strings also? 10:10:58 ErhardtMundt, it should 10:11:28 I tried to write an implementation in lua a couple of months ago 10:11:39 now I tried python 10:11:50 https://gist.github.com/ErhardtMundt/7e21e62ad17f41440958 10:12:31 I had bad times handling memory and strings 10:13:07 well this isn't real forth 10:13:13 it's just a toy 10:14:26 mine too :) 10:14:40 it's barely working 10:15:26 but I wanted . to print a "weird meaningless number" in case of memory locations 10:16:42 --- join: Zarutian (~Adium@168-110-22-46.fiber.hringdu.is) joined #forth 10:18:59 I think it is much easier to implement forth by assembly language ~~ 10:19:11 you're right, xyh 10:19:56 but I/O is cumbersome in assembly 10:20:22 I had to use iterator pattern to implement indirect threading 10:20:39 assembly is much more easy 10:22:00 I have 4 versions of IO code, when factoring functions well, IO is not so hard 10:23:34 this is TINY: http://imgur.com/WwOPE5N 10:23:38 and incomplete, but w/e 10:25:32 I could probably optimize tail calls... 10:26:51 and it didn't work, huh 10:27:59 xyh: do you handle terminal mode, too? 10:28:15 I mean, canonical mode, echos, etc 10:28:50 derp would help if I passed the right arguments .-. 10:29:08 it works! 10:30:51 ErhardtMundt: I tryed it in an old version of the interpreter, but not in the new version. syscall to ioctl would be ok for linux, (do not know is there an "ioctl" for windows too 10:36:59 --- join: gabriel_laddel (~user@unaffiliated/gabriel-laddel/x-9909917) joined #forth 10:37:17 so what do you think? https://github.com/SoniEx2/Stuff/blob/master/lua/Forth.lua 10:39:16 Soni: have you checked that a table definition works? 10:39:32 GeDaMo, what do you mean? 10:39:59 there's no parser yet 10:40:30 ["square"] = { w["dup"], w["*"] } 10:40:41 Or however it would look 10:41:41 works 10:42:33 ErhardtMundt: IMO the interface of standard IO is not well designed, 10:42:34 if let forth programmer design it, it would be much better factored, 10:42:34 for example, the functions used to implement line-mode from key-mode will be expose to users. 10:44:22 Soni: how do you encode literals in definitions? 10:44:35 GeDaMo, what do you mean? 10:44:50 : tentimes 10 * ; 10:45:00 How would the 10 be stored in the table? 10:45:18 w["tentimes"] = {10, w["*"]} 10:45:33 Ah 10:45:36 xyh: I agree 10:45:57 Soni: you'll need something similar for strings? 10:46:12 GeDaMo, it doesn't support strings yet 10:46:14 .-. 10:47:12 also, does "2 3 /" mean "2/3" or "3/2"? 10:47:21 Soni: what you could do is deal with table, function and nil then say everything else is a literal 10:47:25 2/3 10:47:36 ok so I'm doing this right 10:47:52 GeDaMo, so that coroutines and files are literals? 10:48:16 hmm maybe 10:48:30 Just a thought 10:48:51 ok 10:49:06 altho my IDE just segfaulted 10:51:17 /IDE/ :X 10:51:53 it looks like anjuta 10:52:02 or geany 10:55:37 well so my IDE keeps segfaulting >.> 11:02:34 --- quit: gabriel_laddel (Remote host closed the connection) 11:06:11 --- quit: Keshl (Quit: Konversation terminated!) 11:06:45 --- quit: xyh (Remote host closed the connection) 11:12:56 --- quit: proteusguy (Ping timeout: 244 seconds) 12:43:22 --- quit: kumul (Ping timeout: 265 seconds) 13:00:19 hmm how would I go about implementing conditionals in that VM? 13:03:22 You would need a way of changing the index 13:03:43 --- join: karswell` (~user@80.229.109.241) joined #forth 13:06:23 --- quit: karswell (Ping timeout: 245 seconds) 13:07:44 :/ 13:15:16 --- join: Mat4 (~Claude@ip5b42e358.dynamic.kabel-deutschland.de) joined #forth 13:15:25 hello 13:17:48 GeDaMo, how should I do it? 13:44:25 --- quit: mnemnion (Remote host closed the connection) 14:20:34 --- quit: GeDaMo (Remote host closed the connection) 14:28:28 --- join: mnemnion (~mnemnion@142-254-26-9.dsl.static.fusionbroadband.com) joined #forth 14:52:55 --- quit: Zarutian (Remote host closed the connection) 15:33:39 --- quit: true-grue (Read error: Connection reset by peer) 16:12:00 --- quit: Mat4 (Quit: Verlassend) 16:31:56 --- quit: mnemnion (Remote host closed the connection) 16:51:16 --- join: mnemnion (~mnemnion@142-254-26-9.dsl.static.fusionbroadband.com) joined #forth 17:00:28 --- join: xyh (~xyh@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 17:18:14 --- quit: mnemnion (Remote host closed the connection) 17:23:44 --- quit: irsol (Remote host closed the connection) 17:32:49 --- join: irsol (~irsol@unaffiliated/contempt) joined #forth 17:48:56 --- quit: ErhardtMundt (Read error: Connection reset by peer) 17:57:01 --- join: mnemnion (~mnemnion@c-98-210-219-91.hsd1.ca.comcast.net) joined #forth 18:08:04 --- quit: xyh (Remote host closed the connection) 18:14:23 --- quit: nighty^ (Ping timeout: 246 seconds) 18:15:19 --- join: nighty^ (~nighty@static-68-179-124-161.ptr.terago.net) joined #forth 18:27:51 --- join: xyh (~xyh@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 18:28:52 --- join: kumul (~mool@adsl-72-50-86-16.prtc.net) joined #forth 18:58:01 --- quit: nighty-_ (Quit: Disappears in a puff of smoke) 19:47:08 --- join: darkf (~darkf___@unaffiliated/darkf) joined #forth 20:18:18 --- quit: vsg1990 (Quit: Leaving) 20:42:37 --- quit: johnmark_ (Quit: Leaving) 21:03:10 --- quit: xyh (Ping timeout: 265 seconds) 21:18:18 --- join: nighty^_ (~nighty@TOROON12-1279662182.sdsl.bell.ca) joined #forth 21:19:48 --- quit: nighty^_ (Read error: Connection reset by peer) 21:20:28 --- quit: nighty^ (Read error: Connection reset by peer) 21:23:09 --- join: nighty^ (~nighty@static-68-179-124-161.ptr.terago.net) joined #forth 21:33:45 --- quit: saml_ (Quit: Leaving) 21:40:24 --- join: xyh (~xyh@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 21:47:40 --- quit: xyh (Read error: No route to host) 21:47:48 --- join: xyh (~xyh@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 22:38:08 --- join: true-grue (~grue@95-27-141-238.broadband.corbina.ru) joined #forth 22:44:40 --- join: Bahman (~Bahman@85.133.140.132) joined #forth 22:55:36 --- quit: Bahman (Ping timeout: 250 seconds) 22:55:55 --- quit: DKordic (Read error: Connection reset by peer) 22:56:17 --- join: DKordic (~user@178-223-60-47.dynamic.isp.telekom.rs) joined #forth 23:07:55 --- join: Bahman (~Bahman@85.133.140.132) joined #forth 23:21:54 --- quit: xyh (Ping timeout: 265 seconds) 23:28:14 --- join: xyh (~xyh@2001:250:3002:5550:6ea1:cc0f:bcb2:b187) joined #forth 23:40:42 --- quit: xyh (Remote host closed the connection) 23:51:57 --- quit: mnemnion (Remote host closed the connection) 23:59:59 --- log: ended forth/15.04.04