00:00:00 --- log: started forth/13.01.16 00:13:20 --- quit: ASau (Ping timeout: 272 seconds) 00:18:15 --- join: epicmonkey (~epicmonke@188.134.41.175) joined #forth 00:18:15 --- mode: ChanServ set +v epicmonkey 01:10:48 --- join: dessos (~dessos@c-174-60-176-249.hsd1.pa.comcast.net) joined #forth 01:10:49 --- mode: ChanServ set +v dessos 01:36:51 --- quit: john_metcalf (Ping timeout: 248 seconds) 01:39:00 --- join: john_metcalf (~john_metc@211.67.125.91.dyn.plus.net) joined #forth 01:39:00 --- mode: ChanServ set +v john_metcalf 01:51:32 --- quit: Nisstyre (Ping timeout: 248 seconds) 02:04:06 --- join: Nisstyre (~yours@oftn/member/Nisstyre) joined #forth 02:04:06 --- mode: ChanServ set +v Nisstyre 02:04:19 --- quit: tgunr (Ping timeout: 240 seconds) 02:09:34 --- quit: epicmonkey (Ping timeout: 245 seconds) 02:50:30 --- quit: proteusguy (Remote host closed the connection) 03:04:13 --- join: proteusguy (~proteusgu@ppp-58-8-88-123.revip2.asianet.co.th) joined #forth 03:04:13 --- mode: ChanServ set +v proteusguy 03:11:47 i just got my begin until loop working in my implementation of Forth :D 03:17:32 --- join: epicmonkey (~epicmonke@host-224-58.dataart.net) joined #forth 03:17:32 --- mode: ChanServ set +v epicmonkey 03:35:41 --- join: newcup (newcup@peruna.fi) joined #forth 03:35:41 --- mode: ChanServ set +v newcup 03:58:23 --- quit: newcup (Remote host closed the connection) 04:33:47 --- quit: Bahman (Remote host closed the connection) 04:34:08 --- join: JDat_ (9f9411b5@gateway/web/freenode/ip.159.148.17.181) joined #forth 04:34:08 --- mode: ChanServ set +v JDat_ 04:44:51 someone explain the value of the else statement 04:45:21 if 1 else 2 then =======> if 1 then 2 04:53:26 if number in parameter stack is true then 1 else 2 04:53:28 --- quit: Nisstyre (Ping timeout: 252 seconds) 04:54:27 c style if (PSP_top !=){ 1; } else{ 2; } 04:54:40 c style if (PSP_top !=0){ 1; } else{ 2; } 04:59:33 explain how it is useful, please 05:00:27 i am writing an interpretter....and i could just make else act as if and ignore the next if at compile-time to implement else 05:00:32 interpreter* 05:00:42 make else act as then*** 05:00:51 and ignore the next then*** 05:00:53 uhg lol 05:01:05 i am writing an interpretter....and i could just make else act as then and ignore the next then at compile-time to implement else 05:01:08 there. 05:02:20 oh i think i see now 05:02:46 nope...changed my ming 05:02:47 mind* 05:07:56 --- join: Nisstyre (~yours@oftn/member/Nisstyre) joined #forth 05:07:56 --- mode: ChanServ set +v Nisstyre 05:10:16 sorry, I am forth noob 05:10:58 I think that IF ELSE THEN can be written with ?BARNCH or something similar 05:13:17 makes sense that that word exists....as a generalization of several things 05:22:58 --- quit: beretta (Quit: Leaving) 05:29:54 --- join: impomatic (~digital_w@211.67.125.91.dyn.plus.net) joined #forth 05:29:54 --- mode: ChanServ set +v impomatic 05:34:46 --- join: tgunr (~davec@cust-66-249-166-11.static.o1.com) joined #forth 05:34:46 --- mode: ChanServ set +v tgunr 05:50:30 --- join: newcup (newcup@peruna.fi) joined #forth 05:50:30 --- mode: ChanServ set +v newcup 06:50:59 impomatic: my Forth implementation now has begin/until loops :D 06:52:03 :-) 06:54:05 impomatic: mine implicitely allows recursion...which i like, but i may change so people can define things in terms of old definitions with the same name 06:54:25 impomatic: i might change that just so i can use existing code 07:01:55 Mine Forth also allow recursion. At some point I'll change it and add the RECURSE word 07:03:56 or alternatively, you could add an `old' word 07:04:15 as a compiler directing word that compiles the last thing by that name 07:04:44 : cr old cr cr ; 07:04:48 oops 07:04:59 : cr old cr old cr ; 07:05:18 to make cr do the old cr twice 07:06:54 i think recursion should be by default...but i would like to be able to use standard code 07:07:11 what do you think of `else'...it seems useless to me 07:08:44 if i implement else, i would make it behave like if at compile-time...then ignore the next then 07:09:29 behave like then at compile-time*** 07:11:16 if i did the `old' thing...i could just run a perl script over existing code easy enough 07:11:55 Hmmm... else is useful. 07:13:28 STATE @ IF .... ELSE .... THEN <- example from Forth outer interpreter, do one thing or the other depending if state is compile or interpret 07:14:33 1 while s/(:\s++(\S++)[^;])*$2([^;]*;)/${1}old $2$2/g 07:14:41 something like that to fix things 07:15:01 $2$3 *** 07:15:26 oo damn that would add olds over and over...meh it can be done 07:16:08 impomatic: but that could be written as STATE @ IF .... THEN .... 07:16:19 impomatic: i think else is syntactic sugar 07:17:35 found another problem in my regex :/ 07:19:21 impomatic: oh...my example would still do the second thing if true...i see :) 07:30:24 --- join: fantazo (~fantazo@213.129.230.10) joined #forth 07:30:24 --- mode: ChanServ set +v fantazo 08:07:41 --- join: RodgerTheGreat (~rodger@71-13-215-242.dhcp.mrqt.mi.charter.com) joined #forth 08:07:41 --- mode: ChanServ set +v RodgerTheGreat 08:23:45 --- quit: I440r (Ping timeout: 255 seconds) 08:29:52 --- join: Nisstyre-laptop (~yours@oftn/member/Nisstyre) joined #forth 08:29:52 --- mode: ChanServ set +v Nisstyre-laptop 08:42:10 --- join: I440r (~zhiming@167.sub-70-194-68.myvzw.com) joined #forth 08:42:10 --- mode: ChanServ set +o I440r 08:43:22 --- quit: epicmonkey (Ping timeout: 252 seconds) 08:46:33 --- join: ncv (~quassel@89.35.216.197) joined #forth 08:46:33 --- quit: ncv (Changing host) 08:46:33 --- join: ncv (~quassel@unaffiliated/neceve) joined #forth 08:46:33 --- mode: ChanServ set +v ncv 08:48:44 --- quit: fantazo (Ping timeout: 246 seconds) 08:50:37 --- quit: karswell (Read error: Connection reset by peer) 08:51:30 --- join: karswell (~user@93-97-29-243.zone5.bethere.co.uk) joined #forth 08:51:30 --- mode: ChanServ set +v karswell 08:55:49 --- join: jdavidboyd (~user@72.185.97.240) joined #forth 08:55:49 --- mode: ChanServ set +v jdavidboyd 09:06:53 I've scanned the gforth manual, but I don't see how to load my own file of code at startup automatically every time, like emacs does with .emacs. Is this something that is possible, or do I just have to run 'gforth stuff.fs' every time, and go from there? 09:08:13 --- quit: JDat_ (Ping timeout: 245 seconds) 09:12:06 --- join: MayDaniel (~MayDaniel@unaffiliated/maydaniel) joined #forth 09:12:06 --- mode: ChanServ set +v MayDaniel 09:21:36 --- join: Inode (~inode@time.uk.chromedpork.net) joined #forth 09:21:36 --- mode: ChanServ set +v Inode 09:22:36 jdavidboyd: i think you just put the name of the file after it 09:22:45 jdavidboyd: like gforth FILENAME.fs 09:23:13 jdavidboyd: yes, that is correct :) 09:23:25 jdavidboyd: where .fs is part of the filename 09:23:34 jdavidboyd: so i guess gforth filename 09:23:49 that part I have no problem with. I want to know if there is a 'magic' file that loads every time gforth starts, so I can put some stuff in there, and have it always available? like a definition for binary mode, etc. 09:23:52 jdavidboyd: oh sorry...didn't read your full question 09:24:36 from the man page 09:24:39 --path path 09:24:40 Uses path for searching the image file and Forth source code files instead of the default in the environment variable GFORTHPATH or the path specified at instal- 09:24:42 lation time (typically /usr/local/lib/gforth:.. A path is given as a :-separated list. 09:54:51 --- join: epicmonkey (~epicmonke@188.134.41.175) joined #forth 09:54:51 --- mode: ChanServ set +v epicmonkey 10:06:58 --- quit: Nisstyre-laptop (Ping timeout: 252 seconds) 10:16:30 still not quite what I'm looking for. I'm wondering if gforth has a default file that it loads at startup every time, like emacs does with .emacs, or vim does with .vimrc. 10:17:40 --- join: Nisstyre-laptop (~yours@oftn/member/Nisstyre) joined #forth 10:17:40 --- mode: ChanServ set +v Nisstyre-laptop 10:18:32 jdavidboyd: I notice that my gforth installation has a blank file called "siteinit.fs" and I notice that the last thing "startup.fs" does is require it 10:24:38 jdavidboyd: hrm 10:24:52 I tried fiddling with those and they don't appear to do anything. :/ 10:25:19 there must be some other change necessary 10:36:34 RodgerTheGreat: my Forth implementation now has begin/until loops and if/then conditionals :D 10:37:29 RodgerTheGreat: and it supports recursion implicitely, which i may change later 10:37:44 RodgerTheGreat: this works right now : addtoten 1 + dup 10 = 0 = if addtoten then ; 10:40:36 RodgerTheGreat: ooo shit found a something weird...recursing like that defers all the thens haha...so any code after the then would get repeated 10:53:56 protist: what does your forth do with this if you do 3039 TEST ? : test 10 /mod dup if test else drop then 48 + emit ; (or this version without else) : test 10 /mod ?dup if test then 48 + emit ; 10:56:34 impomatic: i don't have /mod yet....but it is possible to overflow the return_stack...if that is what you are wondering 10:57:37 protist: actually it's a recursive word to display unsigned decimal integers 10:58:42 : test 10 /mod ?dup if recurse then 48 + emit ; <- standard forth version 10:58:43 i would have to implement /mod and ?dup before i could try that out :D 11:00:28 : ?dup dup if dup then ; 11:02:21 well ?dup is working now...i will need /mod 11:05:59 Hmmm... it's probably best to do /mod in asm. In 8086 it's pop bx /pop ax / cwd / idiv bx / push dx / push ax 11:06:27 i am using AT%T...i will see if that translates :) 11:06:37 protist: neat 11:06:49 my forth makes definitions available immediately like that 11:06:58 i just made `literal' 11:07:07 although I am increasingly of the opinion that an explicit "recurse" is cleaner 11:07:34 doing what we do makes it harder to "wrap" existing procedures 11:07:47 RodgerTheGreat: i would prefer an `old' word for when i DON'T want to recurse 11:07:56 which would be simple enough 11:08:06 and if you change the name of a recursive procedure you have to update the name in at least two places 11:08:42 "recurse" is a little more DRY 11:08:59 --- quit: Nisstyre-laptop (Quit: Leaving) 11:09:54 impomatic: i am 32 bit as well 11:09:56 can anyone come up with an argument for why the name "recurse" is preferable to the terser "recur"? 11:10:21 impomatic: my stack would probably get corrupted by the 16 bit instructions 11:10:28 the latter of which is actually an english word 11:10:54 RodgerTheGreat: never though about it 11:11:10 "recurse" is how it's done in gforth at least 11:11:19 seems like a poor name 11:11:32 impomatic: i will try popl %ebx popl %eax cwd idiv %ebx pushl %edx pushl %eax i guess 11:14:52 impomatic: i got a floating point exception....my asm is probably wrong 11:23:12 well you divided by zero 11:24:42 you could always just test with ": /mod 2dup mod >r / r> ;" 11:29:57 i don't have mod or 2dup yet haha 11:30:05 lots of words to put in 11:33:15 protist: : 2dup over over ; : mod 2dup <= if begin swap over - swap 2dup < until then drop ; 11:33:16 :) 11:34:55 ok i got /mod implemented :D 11:35:09 actually a better mod would be : mod 2dup / * - ; 11:35:42 RodgerTheGreat: nice definitions :)...i am missing too many words to use those, though 11:36:15 protist: you don't have "over"? 11:46:59 RodgerTheGreat: nope...what does that do? 11:47:19 it's like dup for the second stack element instead of the first 11:47:29 it's a pretty basic primitive 11:47:47 oh :) 11:48:28 I'm kind of surprised that you're halfway through writing a forth without knowing about "over" 11:50:12 haha 11:51:24 --- quit: ncv (Ping timeout: 252 seconds) 11:52:34 impomatic: are you sure the non-else version of test is correct....i tried it and i get a `3' then three messed up unicode things or something 11:52:46 s/correct/correct?/ 11:52:47 protist: I'd tell you about "swap" but it might blow your mind 11:52:56 RodgerTheGreat: lolol 11:53:44 RodgerTheGreat: i also had to check just now to see what nip and tuck do...i usually only use swap, rot, dup, and drop 11:54:27 I usually only use dup, drop, swap, over, r> and >r. 11:55:21 ah i can see how over is handy haha 11:55:48 you might find yourself using fewer rot 11:55:51 instead of swap dup rot swap 11:56:02 just over haha 11:56:08 jesus 11:56:18 hey it was good practice ;D 11:56:25 I guess? 12:05:20 --- join: ncv (~quassel@89.35.216.197) joined #forth 12:05:20 --- quit: ncv (Changing host) 12:05:20 --- join: ncv (~quassel@unaffiliated/neceve) joined #forth 12:05:20 --- mode: ChanServ set +v ncv 12:07:22 --- join: JDat (JDat@89.248.91.5) joined #forth 12:07:22 --- mode: ChanServ set +v JDat 12:09:37 i now have `[' `]' and `literal' 12:10:06 : ' get_lexeme lookup ; 12:11:31 * kulp jealous 12:11:36 you're going to make me work on mine ! 12:11:49 kulp: :D 12:13:59 protist: just tested with gforth. Also works there. 12:14:44 ' this : dothis10times 0 >r begin literal execute r> 1 + dup r> 10 = until r> drop ; 12:14:52 impomatic: hmmm 12:16:27 impomatic: does your recursion defer computation?...or is yours a tail-recursion? 12:16:46 impomatic: mine defers, and i assume yours does too...:/ 12:16:57 protist: what does that code do? 12:17:18 protist: yeah I don't understand what you're trying to do there 12:17:33 impomatic: makes a word `dothis10times' that does `this' 10 times 12:17:46 well the short version is that won't work 12:17:46 impomatic: i got the execution pointer with ' 12:18:03 RodgerTheGreat: maybe my words are different 12:18:07 At compile time, my recursion just compiles a call to the word (just like any other word). At execution time, it just calls the word (like any other word) 12:18:08 i'll test it 12:18:23 is "literal" immediate? 12:18:48 i didn't think literal made sense as a text word 12:19:05 RodgerTheGreat: i suppose so...i am not fluent in forth, i thought i saw literal in Starting Forth 12:19:06 i thought you just had an execution token for it 12:19:14 it seems sort of odd to have a dictionary definition which takes an xt as an argument at compile time 12:19:49 as far as I can tell that's what you're doing 12:19:58 ooo after dup i meant >r 12:19:59 maybe protist doesn't have a separate compile and execution time ? 12:20:28 kulp: then what the hell does ' this do in that code? 12:21:02 RodgerTheGreat: well what does literal do :P 12:21:13 either way i am confused. but i am no forth expert either 12:21:19 ahg something is off 12:21:38 I know what those words would do in a normal forth and I do not think they would do what protist means for that definition to do 12:21:39 i just thought LITERAL was something that appeared in an xt stream but didn't have interpretation semantics 12:21:56 kulp: my literal takes the thing of the top of the stack at compile time, and compiles it as a constant 12:22:05 so it's immediate 12:22:07 kulp: so i can do 3 : three literal ; 12:22:27 or : three [ 2 1 + ] literal ; 12:23:05 hmm okay well maybe i have the wrong idea about it 12:23:18 --- join: Nisstyre-laptop (~yours@oftn/member/Nisstyre) joined #forth 12:23:18 --- mode: ChanServ set +v Nisstyre-laptop 12:28:08 --- quit: Nisstyre-laptop (Quit: Leaving) 12:30:11 well this is working...but my example of what i thought would isn't ' this : another literal execute ; another 12:30:27 i think my begin/until loop needs a little work 12:30:32 protist: dothis10times works on Itsy, but gforth didn't like it. 12:30:43 impomatic: interesting haha :) 12:31:30 : dothis10times 0 begin >r [ ' this ] literal execute r> 1+ dup 10 = until drop ; <- gforth was happy with this code though 12:34:03 ok i fixed my begin/until...now to try dothis10times 12:34:16 "[ ' this ] literal execute is a 12:34:25 fairly involved way of saying "this" 12:34:37 impomatic: odd that gforth is so finicky 12:34:56 protist, when you get to do loops your going to have problems unless you understand all 3 of the items that DO puts on the return stack :) 12:35:15 and how the run time of (DO) and compile time of DO work :P~ 12:35:30 i have a shorthand for [ 123 ] literal 12:35:34 [ 123 ]# 12:36:17 I440r: three? I thought it was just i=current, i'=max 12:36:53 nope the exit point of the loop is also pushed onto the stack so we can EXIT out of the loop using leave 12:37:07 : leave 2r> 2drop exit ; except its not done in a : definition 12:37:45 hm. That isn't how I've defined DO and LOOP in the past. 12:37:49 DO compiles (do) followed by a dummy cell. the dummy cell will be backpatched with the address of the XT following the TWO xt's compiled by loop 12:38:03 (loop) is a conditional branch back to the start of the loop 12:38:13 I440r: i do have separate compile time and runtime behavior 12:38:21 so : foo 10 0 do i . loop ; would be compiled as ..... 12:38:25 foo: 12:38:29 (lit), 10 12:38:33 (lit) 0 12:38:38 I440r: or i would have had massive trouble getting as far as i have 12:38:39 yet another reason I prefer FOR...NEXT as a looping construct I guess 12:38:46 (do) xyzzy 12:38:51 i dot 12:38:57 (loop) abcde 12:39:00 xyzzy: 12:39:02 exit 12:39:15 abcde: shuld be before i dot 12:39:38 RodgerTheGreat, theres an advantage to do loops. you can count backwards -1 +loop etc 12:39:47 0 10 do ... -1 +loop 12:39:54 or do increments of more than 1 12:39:56 yeah 12:40:01 10 0 do i . 2 +loop 12:40:10 0 2 3 4 6 8 12:40:23 but for loops are preferable 12:40:28 i also have rep 12:40:34 : blah 10 rep foo ; 12:40:37 repeat foo 10 times 12:40:43 hm 12:40:44 i can also do 12:40:48 how do you define rep? 12:40:49 10 rep foo 12:40:54 in interpretive mode 12:41:04 --- join: kylert__ (~kroot@c-65-96-213-133.hsd1.ma.comcast.net) joined #forth 12:41:04 --- mode: ChanServ set +v kylert__ 12:41:14 (rep) uses for loops 12:41:28 the behavior of rep is state dependant 12:42:10 : (rep) swap for dup>r execute r> next drop ; 12:42:45 : dorep param (rep) ; \ will show def for param in a sec 12:42:59 : rep state @ if compile dorep else ' rep then ; immediate 12:43:20 rep sort of reminds me of how chuck prefers IF A EXIT THEN B to IF A ELSE B THEN 12:43:45 my ?: is more efficient than CM's method 12:44:01 : foo some-test ?: foo bar fud ; 12:44:13 if sometest returns true FOO is executed and bar is skipped. 12:44:23 if it returns false foo is skipped and bar is executed 12:44:30 either way execution continuses with fud 12:44:47 ?: executes one or other of the 2 xt's following it then continues with the 3rd 12:45:14 thus *forcing* you to factor your conditional bodies 12:45:15 i can define min/max in as few cells as chuck moores every efficient but BAD versions using ?: 12:45:41 one of the reasons i prefer it to if/else/then but sometimes if/else/then is needed 12:46:09 it also compiels in way fewer cells than if/else/then because the if is 2 cells. followed by 2 more at the end of the if block to branch round the else block 12:46:28 then also compiles DOTHEN which is a noop - this is simply an aid for the decompiler 12:46:50 my case: constructs also FORCE you to factor because i have NO endof 12:46:52 you cant do 12:46:59 I440r: but you also pay for the dictionary entries associated with the two halves of the branch if they aren't reused elsewhere 12:47:02 case 10 of 1000 lines of code endof 12:47:16 no you dont. turnkey discards them :) 12:47:26 i dont count head space as being part of any app 12:47:48 each definition still costs you a return, which is one cell 12:48:09 so you only break even if the definitions are not reused 12:48:19 you save space if they're reused 12:48:37 if noop else noop then is compiled as a ?brahch + a vector, noop, brahch + vecror, noop, dothen 12:48:49 my ?: would be ?: noop noop 12:48:50 3 cells 12:49:11 space is not the issue. factoring is 12:49:25 plus i think my ?: executes faster too 12:50:25 even if your going to use IF ELSE THEN i say factor the IF part and ELSE part into separate words 12:50:43 well... where possible 12:50:45 cant always do that 12:50:57 I'd say it depends on the size and complexity of those branches 12:51:08 if they're repeated code, absolutely factor them 12:51:10 like when doing if r@ blah else r@ fud then where you have put something on the return stack beforehand 12:51:43 even if you never repeat them. factoring them out is preferable for the sake of readability 12:52:09 : fud 1+ swap ; <-- even if i only use fud ONCE iwould still factor out probablh 12:52:11 just like loop bodies it often makes more sense to have a body that is a few words long and *most* of the code is factored out 12:52:55 oh theres another reason why DO loops are sometimes preferable 12:53:10 with for loops one implementation will count the loop UP, others will count it DOWN 12:53:31 whereas with do loops YOU decide which direction the loop counts 12:53:44 I would argue that something like " : .table 255 for i calc-val . next cr ; " would make less sense if you factored the i and . into calc-val 12:54:11 you cant factor I out. its a primitive 12:54:21 no reason to factor it out 12:54:49 you can factor it out but it would be brittle 12:55:21 i takes the top two items off the return stack and adds them and puts the result on the parameter stack 12:55:33 you cant do 12:55:41 : do-i i ; 12:55:51 or it fetches the top element of the rstack or it fetches the top element of the loop stack, depending on your forth 12:56:00 because do-i has a return address burying the for loop parameters 12:56:20 I fetches TWO items off the return stack and adds them togehter 12:56:27 it doesn't have to 12:56:36 if your implementation of DO and I dont work this way i think they are probably broken 12:56:37 impomatic: i figured out why dothis10times isn't working for me....begin is putting it's return address on the same stack at compile time 12:56:48 impomatic: i could change that around 12:57:05 RodgerTheGreat, can you do : fud 0 10 do i . -2 +loop ; 12:57:07 i just needs to push the current loop index; that is all 12:57:11 and get the expected results? 12:57:12 impomatic: or [ swap ] 12:57:22 i.e. with your implementation of do/+loop etc 12:57:24 protist: My version above might work for you then? 12:58:25 proteusguy, BEGIN does not do anything except push HERE onto the stack. the repeat/again/until words use the item at the top of the stack to say where to loop back to 12:58:31 : dothis10times 0 begin >r [ ' this ] literal execute r> 1+ dup 10 = until drop ; <- I removed a couple of return stack instructions, might work for you now? 12:58:36 : begin here ; 12:58:37 impomatic: the [ ' this ] literal execute one? 12:58:41 is a good definition for begin 12:58:42 impomatic: probably :) 12:58:47 impomatic: i will try it 12:59:11 : again ( address --- ) compile (again) , ; immediate 12:59:32 or rather compile branch , ; 12:59:44 impomatic: yes, that works :D 13:00:01 protist, you need to learn how >mark >resolve I440r: i wanted to use a stack so i can nest conditionals and loops 13:02:43 protist: you already have one y'know 13:02:55 RodgerTheGreat: i know :) 13:03:41 phone 13:08:54 --- join: kumul (~Mo@173.215.194.228) joined #forth 13:08:54 --- mode: ChanServ set +v kumul 13:16:39 --- join: Onionnion (~ryan@adsl-68-254-169-75.dsl.milwwi.ameritech.net) joined #forth 13:16:39 --- mode: ChanServ set +v Onionnion 13:26:00 --- quit: bjorkintosh (Ping timeout: 252 seconds) 13:32:11 just had a phone interview. dont know if ill get the position because he has one more to interview 13:32:30 what's the position? 13:32:45 contract position in MO, they do medical gizmos 13:52:47 --- join: ASau (~user@46.115.98.84) joined #forth 13:52:47 --- mode: ChanServ set +v ASau 14:05:13 : constant get_lexeme dp @ dup >r write dp ! r> ep @ ! ep @ 4 + ep ! 3 dp @ ! dp @ 4 + ! dp @ ep @ ! dp @ 8 + dp ! ep @ 4 + ep ! ; 14:05:17 worked first try :D 14:06:16 protist: what does it do 14:06:47 RodgerTheGreat: defines constant such that i can say 3 constant three .....and now `three' will put 3 on the stack 14:07:11 RodgerTheGreat: my definition for variable will be similar, only it will return the address instead of the value 14:07:45 I'm thinking that maybe you could factor that a bit more 14:08:03 RodgerTheGreat: arrows keys don't work in my interpreter lol 14:08:14 RodgerTheGreat: i will factor it later :) 14:08:23 RodgerTheGreat: for now i am testing things 14:09:22 i will define +! and things will be smoother haha 14:09:57 4 constant cell 14:10:12 : cells cell * ; 14:10:25 protist, arrow keys in linux dont return a character. they return an escape sequence 14:10:35 the exact sequence depends on which terminal 14:10:53 brb, gotta start packing. will dc 14:10:58 kk cya :) 14:13:16 --- quit: MayDaniel (Read error: Connection reset by peer) 14:14:57 protist: what is "3 dp @ !" doing? 14:15:19 --- quit: I440r (Ping timeout: 240 seconds) 14:18:08 it really is a lot easier to write and understand forth code if you factor as you go rather than making tangles and then trying to discover repeated patterns 14:19:02 this is almost impossible to follow without knowing about the precise implementation of your dictionary 14:19:22 you should write words for manipulating the dictionary more abstractly 14:23:22 RodgerTheGreat: 3 dp @ ! is compiling the `constant' data type 14:24:09 RodgerTheGreat: yeah i know.....3 at the beginning of a definition tells execute to push the number in the next data location 14:24:52 wait so why does execute care about the implementation of constants? 14:25:15 execute is recursive and goes down until it finds a primitive or a constant 14:25:53 my variables will be implemented as constants that push an address value 14:25:59 what type of threading does this forth use? 14:26:11 i have no idea 14:26:18 i tried not to look at other implementations haha 14:26:23 hrm 14:26:47 maybe someone here should make a colorforth for unix 14:26:59 instead of reimplementing yet another forth :) 14:27:23 kumul: my code is all x86 gas assembly 14:27:29 kumul: 32 bit 14:27:45 kumul: oh you want colorforth haha 14:28:06 it doesnt seem that difficult though 14:28:17 kumul: I don't really trust languages that need a new text editor 14:28:23 it doesnt 14:28:27 this is part of why I don't use smalltalk 14:28:31 its forth with a tag 14:29:10 and considering terminal have color codes, thats just half the battle done 14:29:14 but im with you 14:29:44 oh, and there is a version that uses fonts instead of colors, for the colorblind 14:30:00 colorforth replaces punctuation and some of the state of the compiler with colors 14:30:18 so you must by definition enter code using the colors 14:30:31 displaying colorforth on a terminal is easy, yes 14:30:44 how many colors are there? 14:31:04 I think 6? 14:31:17 let's see if i can remember 14:31:19 really? i've only seen 2 14:31:22 red and green 14:31:25 red for colon defs, 14:31:29 green for compiled code 14:31:33 yellow for immediate code 14:31:40 grey for comments 14:31:57 protist: this works for Itsy : variable create 0 , ; 14:32:09 and then I think there are colors which change the base interpretation of numbers 14:32:19 --- quit: kylert__ (Ping timeout: 240 seconds) 14:32:41 that really simplifies the compiler you know... doesnt seem bad 14:33:04 it does simplify the compiler slightly but the editor has to do more 14:33:29 I'm unconvinced that losing the ability to use a lot of existing tools is worth it 14:33:55 it already highlights syntax, what more does it have to do? 14:34:24 if you're just coding on metal in a block editor that only runs on the pentium 2 you've had for years then that's fine, but what if you want to store your source in files and use a version control system? 14:34:55 or grep through your source files 14:35:11 or use almost any unix utility to help manage or inspect your code 14:35:59 impomatic: i dont have a create word yet 14:36:05 impomatic: or `,' 14:36:25 impomatic: that is very clean, though :) 14:36:28 it makes sense if you don't care at all about the underlying OS and don't intend to use it for anything, but if you want to interact with unix it's a waste 14:36:38 again, think about smalltalk 14:37:20 each word has a tag(byte) at start, so { grep $colorX^word file } would work i guess 14:38:17 if you give colorforth a text-based serialization format that adds the colors back in as text you haven't simplified the compiler anymore- arguably you have ADDED complexity 14:38:48 for all that fucking around you've only saved two variables worth of state 14:48:35 --- join: kylert__ (~kroot@c-65-96-213-133.hsd1.ma.comcast.net) joined #forth 14:48:35 --- mode: ChanServ set +v kylert__ 15:02:01 --- quit: kylert__ (Quit: leaving) 15:26:48 --- join: I440r (~zhiming@167.sub-70-194-68.myvzw.com) joined #forth 15:26:48 --- mode: ChanServ set +o I440r 15:27:12 --- quit: I440r (Client Quit) 15:30:39 --- join: I440r (~zhiming@167.sub-70-194-68.myvzw.com) joined #forth 15:30:39 --- mode: ChanServ set +o I440r 15:37:12 --- quit: JDat () 15:40:02 --- quit: ncv (Remote host closed the connection) 15:42:02 --- join: kumool (~Mo@173.215.194.228) joined #forth 15:42:02 --- mode: ChanServ set +v kumool 15:42:05 --- quit: kumul (Ping timeout: 246 seconds) 15:47:12 --- quit: kumool (Quit: Leaving) 16:38:12 --- join: kumul (~Mo@173.215.194.228) joined #forth 16:38:13 --- mode: ChanServ set +v kumul 17:02:52 --- quit: epicmonkey (Ping timeout: 272 seconds) 17:26:30 what is it that forth calls a size of two cells? 18:03:06 --- join: bjorkintosh (~bjork@ip68-13-229-200.ok.ok.cox.net) joined #forth 18:03:06 --- mode: ChanServ set +v bjorkintosh 18:09:05 --- quit: john_metcalf (Ping timeout: 246 seconds) 18:09:28 --- quit: impomatic (Ping timeout: 264 seconds) 18:10:31 --- join: john_metcalf (~john_metc@211.67.125.91.dyn.plus.net) joined #forth 18:10:31 --- mode: ChanServ set +v john_metcalf 18:17:51 double? 18:18:18 D is for double no? 18:21:13 ah possibly! 18:21:14 i 18:21:18 i'll test it 18:22:14 meh 18:22:33 i want something that works like `cell' ...only to times that 18:22:40 but i want to use the standard word 18:37:03 '2 cells' ? 18:38:27 ah 18:38:50 thank you :) 18:39:01 in GFORTH, is there any way to list a subset of words? I've tried "xxxx words" and "words xxxx", but neither seems to make any difference. 18:43:48 protist, use the ans standard, there's a nice zip available 18:44:10 jdavidboyd: you mean, as if you were using a pager? 18:46:05 it seems like he wants all words to have some sort of tag 18:46:22 darn you RodgerTheGreat 18:47:00 i still think ansi escape codes arent that big a deal 19:03:59 dzho: no, I mean like a filter of the words. so 'xxx words' would only show words that have the text string 'xxx' in them. 19:04:32 dzho: I don't want to have to see ALL the words ALL the time when I am looking for something 19:08:09 kumul: ill look into that :) 19:13:06 kumul: what 19:13:47 RodgerTheGreat, exactly 19:14:01 ... 19:14:10 jdavidboyd: that doesn't sound to hard to make 19:15:48 RodgerTheGreat: i now have variable as : variable create 0 , ; like impomatic 19:15:57 RodgerTheGreat: it made a lot of sense after i defined create 19:16:08 that's good 19:16:12 what does create look like? 19:16:16 sec 19:16:33 : create get_lexeme here dup ep, write dp ! here ep, con_type , here cell + , ; 19:16:57 that's much better 19:17:00 where : ep, ep @ ! 4 ep +! ; 19:17:04 :D 19:17:10 MUCH better 19:17:23 yeah im factoring it down :) 19:17:37 i shall...i was having fun lost in references, though ;) 19:17:44 thank you 19:17:50 I suspected there was a , like factor that could be extracted from your original version but I didn't understand what you were doing well enough to find it 19:18:13 ep, is a good factor 19:18:22 ep is my entry pointer 19:18:26 although I would recommend replacing the 4 with "cell" 19:18:29 my data structure is non-standard :) 19:18:33 I figured it was something like that 19:19:15 write ( source dest --cell after last written to) 19:19:20 do you agree with me re extracting that magic number? 19:19:31 the 4? 19:19:34 yeah haha 19:19:34 yes 19:19:49 you'll thank me if you ever port this to 64 bit 19:22:02 haha :D 19:29:58 protist: don't want to _make_, want to _use_. Trying to learn forth, so I'm not qualified to make anything yet. :-) 19:30:00 * ttmrichter wonders if a 64-bit Forth would ever be used. 19:30:19 * RodgerTheGreat motions in the direction of gforth 19:30:22 jdavidboyd: The best way, traditionally, to learn Forth is to make one. 19:30:31 ttmrichter: put another way, your guess is as good as mine 19:31:22 bigger cells == good thing? 19:31:29 sure why not 19:31:52 jdavidboyd: In this day and age of loads of cheap CPU emulation software packages, just pick a simple CPU, pick a Forth tutorial (like Jonesforth, say) and make one. 19:31:59 really, a "cell" is supposed to strike some balance between being large enough to be useful and something convenient for the machine to manipulate 19:32:29 RodgerTheGreat: : constant get_lexeme here dup ep, write dp ! here ep, con_type , , ; 19:32:30 jdavidboyd: or for that matter make a simple VM 19:32:41 a crude forth is simpler to write than an assembler 19:32:48 Much simpler. 19:32:59 Then you can easily write your assembler in that Forth. :) 19:33:27 yep 19:34:18 I really do think that people who write in pure assembler are Doing It Wrong™. 19:34:28 c'mon guys, I don't want to reinvent the wheel, I just want to learn gforth. I used to do a lot with Blazing Forth on the old commodore 64/128 lines (years back) then Win32Forth on windows, and now gforth. 19:34:55 You should spend the first weekend writing a Forth for that target machine, then you should write the rest of your "assembler" in Forth as if it were a fancy assembler library package. 19:35:33 jdavidboyd: well, ok, what do you intend to write in Forth? 19:35:37 And if you keep your abstractions straight while implementing the Forth, you can even change the engine out from underneath with better threading models for your needs, etc. without changing your application code much. 19:36:08 jdavidboyd: It's not "reinventing the wheel", it's "learning how the wheel works by building one". 19:36:45 It's an educational experience. You'll learn more about how to program in Forth and how to make Forth sing by *implementing* a Forth (in Forth) than you'll ever learn by just writing Forth programs. 19:37:21 i noticed something odd when making mine, although i am not done 19:37:41 my inner interpretter needs a separate return stack 19:37:48 i suppose this is normal 19:38:15 interpreter* 19:38:16 protist: how large is your inner interpreter? 19:38:33 RodgerTheGreat: not very large...but all my asm is structured like Forth 19:38:47 well I mean usually an innner interpreter is basically just a loop 19:39:04 RodgerTheGreat: it uses a return stack of it's own for the recursive execution function 19:39:05 fetch a cell, execute it, loop 19:39:36 its* 19:40:19 jdavidboyd, sorry, people are insane here... the way they help ends up taking months 19:41:22 http://ideone.com/qs6RAf 19:42:23 that is the execute function :D 19:42:36 protist: unless you're doing it for efficiency purposes you could make constants a "primitive" 19:42:47 I agree, the best way to learn something (or mayhap not best, but most 'immersive') is sink or swim. Right it, and you will understand it. 19:43:10 RodgerTheGreat: primitives call the function, constants push the value 19:43:13 Ain't got time for that right now, though, just want to use gforth for a few utility filters I used to do in C, then Java, just for the practice. 19:43:45 RodgerTheGreat: ide rather not do a bunch of functions that just push values hehe 19:43:47 protist: yeah, you would have a primitive which grabs the next value from the thread stream 19:44:03 you don't have to have separate prims for each number 19:44:31 it would work just like how your branch0 primitive presumably works 19:44:54 i don't have a branch0 primitive 19:45:00 lol 19:45:07 then how do you implement IF 19:45:39 i had to reachup in execute's return stack, mess with it, then jump to execute_user_defined 19:45:48 reach up into * 19:46:05 that seems rather clumsy 19:46:35 wait a sec...maybe i misintrepretted the question 19:47:08 any idea if a copy of Starting FORTH by Leo Brodie is worth anything? Or Thinking FORTH. Had them for years, haven't looked at them in a long long time. 19:47:14 normally your threaded code is a series of addresses to simply call 19:47:23 jdavidboyd: both are dated but excellent books 19:47:25 i do mess with that return stack but there is more to it....if at compile-time pushes the location of the value of the constant before it, then `then 19:47:34 ' puts the proper address in the constant 19:47:51 jdavidboyd: A more up-to-date version of Starting Forth is online at forth.com, IIRC. 19:48:02 And Thinking Forth is one of the best books on software engineering ever written. 19:48:04 normally you have primitives branch0 and literal 19:48:18 But the Forth used in the book is a bit out of date. You'd have to translate to more modern dialects. 19:48:21 --- quit: kumul (Quit: Leaving) 19:48:21 both of which grab the next cell of the threaded code stream to obtain their argument 19:48:30 branch0 takes and address, literal takes a value 19:48:36 yes, I read Starting Forth every 4 or 5 years for fun, and Thinking Forth every year for the mind boost. 19:48:51 that way the inner interpreter is literally just "fetch an address, execute it" 19:49:00 RodgerTheGreat: interesting :) 19:49:04 --- quit: proteusguy (Ping timeout: 264 seconds) 19:49:17 RodgerTheGreat: i will implement mine fully before i look at how it is normally done :D 19:49:22 ok 19:50:56 my execute is highly recursive, i would imagine that part is normally recursive? 19:51:21 because the data structure is recursive 19:52:47 if you think of execute as just being a loop, CALL as being something which pushes a threaded code address onto the rstack and RETURN as being something which pops the rstack I don't see any reason why you'd need an additional stack 19:53:07 execute just needs a "program counter" 19:53:20 --- join: kumul (~Mo@173.215.194.228) joined #forth 19:53:20 --- mode: ChanServ set +v kumul 19:54:10 you just said pops the rstack 19:54:18 the user needs that too 19:54:29 the interpreter would crash without 2, no? 19:56:32 the state of the inner interpreter which is recursive is stored on the rstack as part of the execution of user code 19:56:44 I don't know how else to explain it 19:57:10 an inner interpreter should just be a few instructions long 19:57:17 you are overcomplicating it 19:58:25 RodgerTheGreat: this is my inner interpreter http://ideone.com/D8ZEFZ 19:58:31 RodgerTheGreat: what i showed you was execute 19:59:03 that looks like an outer interpreter 19:59:34 :D 19:59:38 the outer interpreter executes interactive commands. The inner interpreter executes threaded code in procedure definitions 20:00:16 my inner interpretter is doing both, i guess 20:00:59 i wonder how many interpreters you would have to run inside eachother before your computer gave up 20:01:27 --- join: proteusguy (~proteusgu@ppp-58-8-124-203.revip2.asianet.co.th) joined #forth 20:01:27 --- mode: ChanServ set +v proteusguy 20:02:18 protist: how much memory does your computer have 20:02:33 memory is the only real limitation to nested interpreters 20:02:35 RodgerTheGreat: idk, 4gb ram? 20:02:53 and probably at least half a terabyte of HD space praying to become virtual memory 20:03:05 in that case the answer is "many" 20:03:10 :) 20:03:18 SSD 20:05:07 --- quit: I440r (Ping timeout: 248 seconds) 20:06:25 the only really proper forth I've implemented only had an outer interpreter because it used subroutine-threaded code 20:06:53 thus there is no distinction between "primitive" words and otherwise- they are all compiled directly into machine code 20:07:52 cool :) 20:08:10 I doubt this will be my last Forth 20:08:40 subroutine threading is not terribly hard to do but it is easier when you're targeting an actual stack machine 20:09:21 hmm 20:09:55 I'll note that by most definitions ColorForth is subroutine threaded 20:11:33 what exactle does subroutine threaded mean? 20:12:08 my words compile to lists of pointers to addresses of functions 20:12:08 the name comes from the fact that words are compiled as subroutines 20:12:26 protist: I believe that would be direct threaded 20:12:35 although I confuse direct and indirect threading 20:12:43 ah hmmm 20:14:14 If you want the nitty-gritties on threading techniques: http://www.bradrodriguez.com/papers/moving1.htm 20:14:50 i will bookmark it and save it :)...but then again, i am past that part, it may not hurt :D 20:15:18 oh i looked at this some 20:16:10 yes it looks like mine is indirect threaded :) 20:16:30 That's the classic Forth. 20:16:38 Still my favourite for ease of coding. 20:16:41 :D 20:17:41 it should produce more compact compiled definitions, too 20:17:45 unless i am mistaken 20:17:53 generally yes 20:18:16 oh looks like direct is faster though, makes sense 20:18:17 subroutine threading is the fastest, because you have effectively "unrolled" the inner interpreter completely 20:18:52 ooo mine might be token threaded 20:19:51 i would have to stare at these more 20:20:15 RodgerTheGreat: ah that would explain why my execute is more complicated 20:20:54 mine looks token threaded 20:21:20 i do have a table of addresses of all words, that is what my ep points to 20:22:18 but mine doesn't have the size advantage, i don't think 20:25:00 RodgerTheGreat: seems like mine: http://www.bradrodriguez.com/papers/mov1-4.gif 20:25:27 so an extra layer of indirection 20:25:34 RodgerTheGreat: yeah 20:26:07 except as I said you have chosen to implement "literal" as a weird sort of first class thing 20:26:10 --- quit: proteusguy (Remote host closed the connection) 20:26:33 RodgerTheGreat: ill show you my definition of colon 20:27:43 RodgerTheGreat: http://ideone.com/fbZJUa 20:28:59 semicolon can simply be an immediate word 20:31:48 RodgerTheGreat: ah i just read up on immediate again 20:31:59 RodgerTheGreat: i had not put that in at all haha 20:32:08 --- join: I440r (~zhiming@167.sub-70-194-68.myvzw.com) joined #forth 20:32:08 --- mode: ChanServ set +o I440r 20:32:15 RodgerTheGreat: i have compile-time things....but not like that 20:32:32 protist: immediate words will both simplify the internals of the compiler and grant additional flexibility 20:32:50 often what you have is named "docol" or "]" 20:33:07 colon is really "create ]" 20:33:35 the extra indirection is part of the reason that these things are harder to implement in mine 20:33:57 I'll bet 20:34:01 the return stack isn't at the same state haha 20:36:06 my literal is like the one in Starting Forth...i am not sure why you think it is odd? 20:36:16 what is the difference? 20:36:42 I mean the way you implement constants as a special case in your inner interpreter 20:36:58 the primitive which normally handles that behavior is called "literal" 20:37:12 ah 20:37:49 --- join: proteusguy (~proteusgu@183.89.58.8) joined #forth 20:37:49 --- mode: ChanServ set +v proteusguy 20:40:02 the create/does> thing is going to be interesting 20:41:35 the layer of inderection is what makes it like that 20:42:59 I'd say, unless you can come up with a good reason to be using token threading you should remove that layer of indirection 20:44:16 RodgerTheGreat: it is to late in this one...i will write another Forth in the future 20:44:31 RodgerTheGreat: or rewrite this one drastically at some point :) 20:44:38 factor early, factor often 20:45:01 it is in the nature of forth to start over when our understanding of a problem domain has changed significantly 20:46:30 how did your first Forth turn out? 20:46:48 my first forth targeted a VM 20:47:01 which VM? 20:47:09 a custom one 20:47:13 oh weird 20:49:42 ah, found it. Here was my first forth VM: http://hastebin.com/godejavudo.java 20:50:07 ah it is in C :) 20:50:12 no, java 20:50:16 oh 20:50:24 at first i think wth it is so small lol 20:50:25 doesn't really use OO 20:50:39 it is simple java, which resembles C 20:56:04 --- join: Bahman (~Bahman@bba141175.alshamil.net.ae) joined #forth 20:56:04 --- mode: ChanServ set +v Bahman 20:58:48 RodgerTheGreat: i like your formatting 20:59:07 RodgerTheGreat: if i do some serious juggling i can get create does> to work 20:59:16 --- quit: tgunr (Ping timeout: 248 seconds) 21:00:46 for comparison, here is the VM I use currently: https://github.com/JohnEarnest/Mako/blob/master/src/MakoVM.java 21:01:32 --- join: tgunr (~davec@cust-66-249-166-11.static.o1.com) joined #forth 21:01:32 --- mode: ChanServ set +v tgunr 21:06:05 --- quit: Onionnion (Quit: Leaving) 21:10:42 RodgerTheGreat: i see no strings...is there no outer interpretter? 21:10:59 this is just a VM 21:11:11 I program it using an external compiler 21:11:18 it's called "Maker" 21:11:39 it can be viewed either as an assembler which closely resembles forth or a compile-only forth 21:12:02 I have used Maker to write a "true" forth which runs interactively on the VM 21:16:37 interesting :D 21:17:19 Maker is less powerful/flexible than a true forth but it's still very usable 21:17:42 the main limitation is that I cannot build new defining words- they must be built into maker 21:20:45 I've made a couple other compilers which target my VM- a FORTRAN, a BASIC, a BCPL-like language 21:21:19 and there are interactive compilers that run on the VM itself for a Forth, a BASIC and a Logo 21:21:56 I am currently planning a Logo compiler which will generate forth code suitable for running through Maker 21:25:49 cool haha 21:25:55 "SystemLogo" 21:26:20 it's really tricky to compile logo, as it has excessively dynamic characteristics 21:26:37 dynamic scope in general seems much easier to interpret than compile 21:27:19 I intend to use a split approach, where logo routines satisfying certain conditions are compiled into machine code while other routines are interpreted 21:27:35 the interface between these worlds is really the tricky part 21:27:41 hmmm 21:28:40 anyway, 'night all 21:28:44 goodnight 21:28:56 --- quit: RodgerTheGreat (Quit: RodgerTheGreat) 21:39:56 proof of concept : main get_lexeme dup lookup if swap drop execute main then drop number ; 21:40:38 oops mistake 21:41:28 proof of concept : main get_lexeme dup lookup if swap drop execute main then drop number main ; 21:41:32 there 22:09:33 --- quit: protist (Quit: leaving) 22:20:09 --- join: flimflam665 (~flimflam@blk-215-117-36.eastlink.ca) joined #forth 22:20:09 --- mode: ChanServ set +v flimflam665 22:26:02 is there anyway to put a time limit , or a contional, to cancel an ACCEPT command promot? 22:26:13 prompt* 22:42:50 --- join: epicmonkey (~epicmonke@188.134.41.175) joined #forth 22:42:50 --- mode: ChanServ set +v epicmonkey 22:48:36 --- quit: kumul (Quit: Leaving) 23:03:33 --- join: rabenauge (~sag@88.130.185.192) joined #forth 23:03:33 --- mode: ChanServ set +v rabenauge 23:05:18 --- quit: rabenauge_ (Ping timeout: 260 seconds) 23:32:03 --- quit: epicmonkey (Ping timeout: 248 seconds) 23:59:59 --- log: ended forth/13.01.16