00:00:00 --- log: started forth/19.01.02 00:28:53 --- quit: proteusguy (Remote host closed the connection) 01:05:41 --- join: xek (~xek@apn-37-248-138-80.dynamic.gprs.plus.pl) joined #forth 02:04:25 --- quit: ashirase (Ping timeout: 246 seconds) 02:09:15 --- join: ashirase (~ashirase@modemcable098.166-22-96.mc.videotron.ca) joined #forth 02:37:43 well, i really like the form the unit tests are taking - https://gitlab.com/lilo_booter/rpany/blob/master/tests/main.cpp - should be trivial to define them all in a json file or something, and then you should be able to run them against any stack instance (rather than just an empty default one) 02:48:14 the_cuckoo: why not integrate them as Forth programs? 02:48:15 https://github.com/siraben/zkeme80/blob/18228aa78f2356006855d1ec6394b940f6c208e4/bootstrap-flash1.fs#L363 02:51:19 sure - that can be done too - currently i just want to test the underlying stack and default dictionary rather than the tokenising logic (which is defined in terms of the stack and default dictionary) 02:53:44 i like the T{ ... }T stuff though - nice 02:54:44 the_cuckoo: got it from https://forth-standard.org/standard/testsuite 02:55:12 Ah since you're emulating a stack? 02:57:10 well, i'm providing an api - it's the api which needs testing first 02:58:50 but mebbe it would be best to adopt the T{ }T approach in the longer term - will see 02:59:03 Cool. 02:59:39 i used pick for dup & over, and roll for swap & rot, too :-) 02:59:50 why does pick & roll have a bad rap? 03:00:08 it does? i've always loved those :) 03:00:39 i'm a newbie so i don't know how NOT to do something heh 03:00:49 Damn I have no idea how to implement ROLL 03:01:00 Generalized "ROT" 03:01:11 rot is 2 roll 03:01:21 swap is 1 roll 03:01:24 of course 03:01:43 PICK is easier to implement, offset the stack pointer 03:01:47 siraben: i wrote drop, pick, and roll as primitives 03:01:57 dave0: in assembly? 03:02:07 it's in x86 assembly.. yep 03:02:14 that should be quite easy, yeah 03:02:22 I'll try it for the Z80 03:02:35 roll isn't that different to pick - it's just that you need the additional remove 03:02:41 i can post it if you want? 03:03:20 i'd be interested :) 03:03:30 okay gimme a few minutes 03:03:46 Yep, interested here 03:05:25 z80 - my oh my - that's going back some :) - i wrote a forth compiler in z80 when i was a kid - wasn't fully comprehensive of course, but worked well enough :) 03:06:27 the_cuckoo: you might be interested in my project then https://github.com/siraben/zkeme80 03:06:32 I'm wondering is there any html version of the Thinking Forth book or an attempt to port them at least? 03:07:43 siraben: nice :) - will take a look later - lunchtime now 03:07:49 Pretty fun, combining three languages :) 03:07:54 http://termbin.com/cwxr 03:07:59 the_cuckoo: I'm sure you'll find something interesting there 03:09:01 blinks 03:09:09 DAT is %rdi it is the data stack, RSP is %rsi it is the return stack, and TOS is %rbx top of stack 03:09:12 Haven't a clue how to read x86 03:09:42 I get the gist of it though 03:11:12 roll is like you go down the data stack and swap each element with TOS.. that has the effect of moving everything down 1 cell 03:12:30 Ah i see. 03:12:33 Makes sense 03:12:36 siraben: can you read C ? i might be able to write it off the top of my head in C 03:12:49 dave0: I can read C 03:13:55 n = TOS; TOS = datastack[0]; for(a = 0; a < n; a++) { b = datastack[a]; datastack[a] = TOS; TOS = b; } 03:14:41 oh sorry i got that wrong 03:15:06 n = TOS; TOS = datastack[0]; for(a = 1; a < n; a++) { b = datastack[a]; datastack[a] = TOS; TOS = b; } datastack[0] = TOS; 03:15:41 it's hard to write off the top of my head 03:17:08 eventually i will profile it... you can do swap with roll, but it might be a good idea to write swap as a primitive 03:18:00 siraben: it's a work in progress 03:18:26 I'd implement roll with a swap :þ 03:19:11 hehehe 03:19:15 no one like roll :-) 03:19:48 Oh, wait, I just mixed up ROLL and ROT. 03:20:26 maybe >r swap r> swap ? 03:20:54 i need to practise my Forth 03:22:41 dave0: Yeah, that's what I'd do. 03:22:57 I haven't quite understood the purpose of ROLL yet. 03:24:59 dave0: I get the idea 03:28:15 i come from C.. forth is MUCH cleaner and more powerful 03:31:44 i spent some time with fm/mod and sm/rem (i have yet to translate it into Forth) but it was very enlightening 03:33:44 until those, i had never thought about division, because in C, you just use whatever instruction your cpu has 04:04:21 dave0: Yeah, coming from other languages you lose a lot of baggage 04:05:03 When I first heard about Forth, that a low level language could have a REPL style of development I was in disbelief :) 04:05:36 Losing the test debug compile cycle is fun 04:48:36 --- join: dddddd (~dddddd@unaffiliated/dddddd) joined #forth 04:51:40 dave0: the_cuckoo: my PICK https://github.com/siraben/zkeme80/blob/18228aa78f2356006855d1ec6394b940f6c208e4/forth.scm#L1266 04:52:26 Should have changed that 2* to a bitshift 04:54:08 very succinct :) and yeah, bitshift would be better 04:54:18 oh hi 04:54:26 hi 04:54:54 Hello 04:56:33 Looks like I need to write a test to cover PICK too 04:56:48 I need to test all the words, hm. 04:57:13 i'm going upward in my stuff now :) - the goal is to wrap arbitrary objects and their methods as dictionaries, so a c++ thing like: foo x; x.bar( ); x.baz( 2 ) becomes foo bar 2 baz 04:57:39 Ah cool. 04:57:52 I'm not familiar with C++ at all 04:58:17 it's nice - well, post c++11 anyway :) 04:58:27 Seems like C or unlike it, depending on who writes it 04:59:01 it allows for some very strange styles of coding, yeah 04:59:28 but at its core, all c stuff is (more or less) valid - but not necessarily the best way to use it 05:19:28 c++ is no longer a superset of c. they've diverged into two separate languages 05:26:41 --- quit: pierpal (Quit: Poof) 05:27:00 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 05:54:20 how do you implement LEAVE? 05:54:48 i thought of doing DO with an IF and LOOP is BRANCH and THEN 05:58:04 zy]x[yz: yeah - that's what i nmeant by more or less :) 06:13:41 https://gitlab.com/lilo_booter/rpany/blob/master/extends/main.cpp <- this attempts to demonstrate how the dictionary of the stack is extended by way of c++ functions and classes - need something better though... 06:14:16 corecode: https://github.com/siraben/zkeme80/blob/18228aa78f2356006855d1ec6394b940f6c208e4/bootstrap-flash1.fs#L172 06:14:20 That's how I did it 06:14:50 And that's certainly one way to implement DO, but I think people usually use the return stack. 06:15:26 corecode: here's my implementation of DO and LOOP https://github.com/siraben/zkeme80/blob/18228aa78f2356006855d1ec6394b940f6c208e4/forth.scm#L1552 06:19:41 I do have DO and LOOP use some of the branching primitives 06:23:22 --- join: Kumool (~Khwerz@adsl-64-237-232-89.prtc.net) joined #forth 06:24:26 hm maybe i didn't get it 06:24:32 It's important that they're flagged as immediate though, otherwise it won't run 06:24:40 corecode: do you see that implementation? 06:24:44 does DO apply the test when entering? 06:24:46 yes i do 06:25:03 how does your LEAVE work? 06:25:48 it seems that it jumps out of the word, instead of out of the loop 06:26:10 Like that 06:26:23 It drops the LOOP control parameters on the return stack 06:26:53 Off the return stack* 06:27:56 corecode: out of the loop == out of the word 06:31:54 --- join: X-Scale (HydraIRC@89.180.218.131) joined #forth 06:32:55 --- quit: Kumool (Ping timeout: 245 seconds) 06:33:07 so DO puts the end of the loop onto the return stack? 06:33:54 --- join: mahmudov (~milisman@5.176.24.112) joined #forth 06:34:32 Yes 06:34:38 --- part: mahmudov left #forth 06:34:56 --- join: Kumool (~Khwerz@adsl-64-237-235-192.prtc.net) joined #forth 06:34:58 Wait no 06:35:06 So when you run 10 0 DO 06:35:31 DO takes 10 and 0 off the stack into the return stack 06:36:27 DO compiles >r >r into the word, which means the word transfers these loop parameters to the return stack 06:36:58 At the same time when you run DO in a colon definition 06:37:09 HERE gets placed on the steak 06:37:11 Stack 06:38:55 What LOOP does is compile r> r> into the word 06:39:09 And extra stuff which increments the current loop counter 06:39:15 yes 06:39:27 so when you do LEAVE inside that loop 06:39:32 Then also compiles the offset to the word 06:39:41 When then numbers are equal 06:40:08 10 9 DO X LOOP gets run only once 06:41:10 --- quit: Kumool (Ping timeout: 250 seconds) 06:41:49 yes 06:42:39 say you have : FOO 4 1 DO LEAVE LOOP 5 ; 06:42:46 will your code drop 5 on the stack? 06:42:55 or will it skip it? 06:43:19 --- join: Kumool (~Khwerz@adsl-64-237-233-250.prtc.net) joined #forth 06:49:00 skip it 06:49:10 Because LEAVE jumps to FOO'S caller 06:49:45 My DO LOOP is standard conforming so check that out for details 06:50:29 --- quit: Kumool (Ping timeout: 240 seconds) 06:52:47 --- join: Kumool (~Khwerz@adsl-64-237-235-1.prtc.net) joined #forth 06:53:14 ams says 06:53:18 Discard the current loop control parameters. An ambiguous condition exists if they are unavailable. Continue execution immediately following the innermost syntactically enclosing DO ... LOOP or DO ... +LOOP. 06:54:32 Yes 06:55:34 so yours just works differently 06:56:11 What do you mean 06:56:16 It works correctly 06:56:26 Well ah 06:56:36 Let me check 06:57:05 maybe i can implement DO LOOP with BEGIN WHILE REPEAT 06:57:28 which allegedly works with multiple WHILEs 06:57:31 You could 06:57:40 But it's more difficult 06:57:43 I tried that 07:01:17 aha 07:01:44 so does yours conform to the description? 07:03:51 this is what happens when you don't write tests for some words, hehe 07:06:13 Well looks like my words are standard conforming but test-wise 07:06:21 https://forth-standard.org/standard/core/LEAVE 07:06:28 Notice how there's nothing after LOOP? 07:06:38 corecode: so yes, my LEAVE works differently 07:06:44 I'll adjust it later, good to know. 07:11:46 ok 07:31:29 --- quit: tabemann (Ping timeout: 250 seconds) 07:55:20 I use IF ELSE THEN so little I temporarily forgot how nested IF ELSE works 07:55:30 Else is smelly 07:57:19 Hmmm... 07:58:27 I wonder how inefficient it is to do something like "A_PRESSED? B_PRESSED? C_PRESSED? D_PRESSED?" which checks a mutually exclusive thing but doesnt't use ELSE. 07:59:02 probably less than else, because A_PRESSED should return 07:59:18 IF ELSE IF ELSE IF ELSE THEN THEN THEN still continues to the end of the statement 07:59:19 Right, but even without RDROP 08:03:11 I'd need a napkin and a pen 08:08:06 john_cephalopoda: like CASE? 08:08:10 CASE 08:08:43 https://github.com/siraben/zkeme80/blob/18228aa78f2356006855d1ec6394b940f6c208e4/bootstrap-flash1.fs#L123 08:08:57 CASE OF ENDOF and ENDCASE are pretty simple to implement 08:09:04 just a wrapper around IF ELSE THEN anyway 08:11:30 fold the buttons into an integer; use that against a vector-table. 08:14:28 --- quit: pierpal (Quit: Poof) 08:14:43 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 08:17:41 --- join: gravicappa (~gravicapp@h109-187-254-198.dyn.bashtel.ru) joined #forth 08:19:32 As long as you check for bounds! 08:24:47 bounds checking is for people who cant reboot 08:27:38 What does that mean? 08:27:40 And for people who connect their devices to the internet and don't feel like becoming part of a botnet. 08:28:46 resistance is futile. you will be assimilated 08:29:00 Well if you're rolling it yourself by all means ignore bounds checking 08:31:19 what is the obsession with internet john 08:31:22 cmon 08:31:29 when that's a problem, then worry about it 08:31:46 or don't, that's what i do 08:31:57 a well architectured system can be modified when appropriate 08:33:09 --- join: mahmudov (~milisman@5.176.33.177) joined #forth 08:40:50 --- join: dys (~dys@tmo-103-124.customers.d1-online.com) joined #forth 08:41:04 I takes some precautions in my servers (e.g., checking input for buffer overruns), and will probably do a bit more in the future 08:42:00 (When I setup an OpenBSD server, I'll do a VM implementation with pledge & unveil to better isolate permissions and filesystem access) 08:43:14 oh yeah, I should look at that 08:43:30 once I finish this chip8 interpreter I need something new 08:43:54 Unveil in particular looks interesting to me. 08:45:32 Probably won't be something I actually work on for another month or two. I need to complete the 2019.1 release, then finish the turnkey compiler. 08:45:44 that turnkey compiler is awesome. 08:46:01 I will have to read the source later 08:47:32 --- quit: X-Scale (Quit: HydraIRC -> http://www.hydrairc.com <- Would you like to know more?) 09:12:35 --- quit: pierpal (Quit: Poof) 09:12:53 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 09:15:47 I've got a nice idea for a "serverless" Forth backend 09:16:37 WilhelmVonWeiner: "Serverless"? 09:18:01 when a user passes a program to run, the backend creates a new dictionary for that user (where the last link connects to the start of the FORTH dictionary) and tarnsparently allocates them a memory block that appears to be contiguous with the "core" memory (which would have to be write-protected) 09:18:57 So as long as your program didn't write below HERE it would be indiscernible to normally running an entire instance of gforth 09:19:13 and the backend just round-robin allocates time for each user 09:19:24 now that I think about it I just described multi-user Forth as already existed 09:19:33 * WilhelmVonWeiner shrugs 09:20:17 john_cephalopoda: "Serverless" is a misleading term for Amazon running a script at your behest instead of having to set up your own server 09:20:52 you can just choose scripts and link them to trigger conditions, from your POV there's no server to manage just a cloud of scripts 09:24:15 Hmm... 09:24:21 So basically paging. 09:25:26 --- quit: Kumool (Ping timeout: 244 seconds) 09:25:42 no?... 09:42:56 WilhelmVonWeiner: Well, with paging you act like you've got a continous memory space although it can be spread all over memory. 09:46:12 I know what paging is but it's not "just" performing paging 09:48:52 F me if I know how to correctly implement it, though... 09:51:27 --- join: proteusguy (~proteus-g@cm-58-10-154-246.revip7.asianet.co.th) joined #forth 09:51:27 --- mode: ChanServ set +v proteusguy 09:57:28 just out of interest... is anyone running ubuntu 16.04 x64 and an interest/collection of video or audio? i've got (what i think is) an interesting media playing server with a FORTH interface... don't have builds for other systems at this point, and it's a bit of a bitch to build at the moment ... but if anyone wants to test it, let me know (i will be releasing it properly soon anyway, so no worries either way) 10:03:36 No b'untu here. 10:29:10 np :) 10:29:35 --- quit: rpcope (Ping timeout: 245 seconds) 10:29:45 --- join: X-Scale (~ARM@46.50.5.15) joined #forth 10:35:02 --- join: rpcope (~GOTZNC@muon.copesystems.com) joined #forth 10:43:21 --- quit: dave0 (Quit: dave's not here) 10:58:43 --- quit: corecode (Ping timeout: 260 seconds) 10:59:13 --- join: corecode (~2@0x2c.org) joined #forth 10:59:24 the_cuckoo: I've done stuff with sixel raster graphics and tek4014 terminals, but I'm also looking at using terminal escape sequences for audio. 10:59:43 *tek4014 vector graphics 11:00:21 Sequence: ESC % F 11:00:21 Description: switch to Audio Data Syntax of CCITT Rec. T.101 11:00:26 https://hub.darcs.net/pointfree/forth-sixel/raw-file/docs/all-escapes.txt 11:02:41 https://www.etsi.org/deliver/etsi_i_ets/300100_300199/300149/01_60/ets_300149e01p.pdf Terminal Equipment (TE) Videotex Audio syntax 11:09:47 pointfree: You could also take a look at OSS audio. You can still emulate it in the linux kernel and it allows you to just push data to a file in order to play music 11:11:17 * pointfree is unsure of the current status of terminal emulator support for ESC % F audio 11:11:35 Adding it to xterm should be doable considering that xterm already hooks into the audio for the bell character. No additional dependencies needed. 11:17:33 --- quit: pierpal (Quit: Poof) 11:17:45 john_cephalopoda: My main interest is graphics and audio for microcontroller forths over a simple uart or radio link. 11:17:47 I could finish my forth 9p fileserver over uart for mecrisp-stellaris implementation, mount the fileserver over uart, and then perhaps direct audio data to OSS that way. 11:17:52 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 11:23:50 Hmmm... 11:24:29 You could simply write a protocol or use an existing one in order to communicate with text, sound and images. 11:34:58 --- quit: gravicappa (Ping timeout: 268 seconds) 11:36:10 * john_cephalopoda . o O ( XMPP over UART ) 11:52:56 --- join: Kumool (~Khwerz@adsl-64-237-237-93.prtc.net) joined #forth 12:13:32 --- quit: Kumool (Ping timeout: 246 seconds) 12:15:46 pointfree: that sounds kinda cool, but my stuff is very high level - normal video and audio formats supported (mp4, mp3, avi, mkv, mpegts etc) - it's primarily about editing and provides a filter graph mechanism and playout type of stuff 12:17:01 Oooh, I have thought about building decoders for those foromats before. 12:17:43 well, this is a library that wraps many open (and closed) source components 12:17:55 --- join: Kumool (~Khwerz@adsl-64-237-239-183.prtc.net) joined #forth 12:18:49 comes with a command line interface for constructing the graphs and i've got a server component which provides the same as the command line, but can interactively edit the graph while playing 12:19:33 the core open source part is open source itself (LGPL) - i just haven't posted a release for a few years :) 12:20:29 gearing up to it now - slightly delayed as some components i upgraded last year haven't hit the productive development yet 12:21:17 it's also pretty well used by various broadcasters and has been for quite some time 12:22:46 http://vml.hopto.org/pug/~charlie/docs/aml.html <- docs for the command line tool - all very RPN oriented :) 12:22:59 --- quit: Kumool (Ping timeout: 246 seconds) 12:24:25 i think i managed to implement LOOP 12:24:28 and LEAVE 12:25:16 nice :) - haven't got round to that in my current approach yet (haven't even added a return stack yet either :)) 12:27:39 --- join: Kumool (~Khwerz@adsl-64-237-233-166.prtc.net) joined #forth 12:30:17 --- join: Croran_ (~quassel@2601:601:1801:6dde::4276) joined #forth 12:31:08 Hello Forth fans 12:32:50 hi 12:45:32 good afternoon 12:47:16 the_cuckoo: That sounds like something I could use together with a forth lexicon for software defined radio. 12:48:37 I tried GNU Radio but I don't like the odd mix of python and c++ needed for implementing new blocks. 12:49:28 good afternoon crc 12:49:47 yeah - think it should work for that kinda thing - the server itself has configurable outputs, so it can play, stream, encode or do combinations - it also normalises the playout so, you can mix pretty much anything together in a playlist 12:50:54 it is a hobby project though and it's a bit hokey in parts (and the core stack stuff... ugh... which is why i'm developing rpany - wanna replace :)) 12:53:17 (the server is the hobby part i mean - the core library is my day job) 12:56:16 I'm working my way through the official gforth tutorial. I'm working on section 3.26 (floating point) today. 12:58:07 Croran_: have you read Starting Forth? 12:58:52 what does WORD do? 12:59:14 parses the next word 12:59:16 does it take a stack argument? 12:59:22 no 12:59:37 ok, i wasn't sure about the spec 12:59:43 Skip leading delimiters. Parse ccc, delimited by char, in the parse area. 12:59:51 - gforth word index 13:00:04 ccc is the next word in the input strea, 13:00:16 s/,/m 13:00:51 WilhelmVonWeiner: I haven't. Is it good? I own 'thinking in forth' and I've skimmed through it. 13:00:52 corecode: it takes the delimiter e.g. BL WORD hello 13:01:24 WilhelmVonWeiner: 'Thinking Forth' rather 13:01:53 zy]x[yz: ^ 13:02:01 Starting Forth is (personally) the best book for beginners 13:02:33 isn't that PARSE? 13:02:35 Good, I'll do that next. 13:02:50 Someday I'd like to read through the code of some good open source applications coded in forth. Recommendations? 13:03:01 it helps one think like a Forther rather than an imperative programmer or a this or that 13:04:29 Croran_: Sam Falvo's text preprocessor video is good Forth IMO https://www.youtube.com/watch?v=mvrE2ZGe-rs 13:04:55 http://theforth.net/packages also has packages written in differently-styled Forth 13:05:56 thank you 13:06:07 https://www.forth.com/starting-forth/ 13:10:33 zy]x[yz: PARSE does too, but PARSE has stack signature ( char "ccc" – c-addr u ) while WORD has signature ( char "ccc– c-addr ) 13:10:33 https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/The-Input-Stream.html#index-parse-_0040var_007b-char-_0022ccc_003cchar_003e_0022-_002d_002d-c_002daddr-u---_007d--core_002dext-1557 13:11:40 oh 13:11:56 that's weird 13:20:31 --- quit: xek (Ping timeout: 244 seconds) 13:23:03 crc: you might want to specify and implement an nga 'device' that allows one to check if a file|socket|pipe|std(in|out|err) handle is blocking or not. Probably by doing something with the select() (2) POSIX systemcall. 13:33:14 Zarutian: I'll look into adding this 13:35:21 crc: this makes it possible to implement stuff like KEY? or even green executing-threads 13:43:39 --- join: mtsd (~mtsd@94-137-100-130.customers.ownit.se) joined #forth 14:07:57 --- quit: mtsd (Quit: WeeChat 2.3) 14:29:45 --- quit: dddddd (Ping timeout: 244 seconds) 14:31:38 it's a bit annoying that WORD and FIND operate on c-strings - need a special staging area for that 14:31:52 what's the point? 14:35:56 you have a staging area with TIB right? 14:36:53 --- quit: Kumool (Ping timeout: 268 seconds) 14:43:24 what is TIB? 14:44:50 Text Input Buffer 14:53:13 --- join: dddddd (~dddddd@unaffiliated/dddddd) joined #forth 15:01:33 well, "Terminal" input buffer 15:01:59 i have a buffer, yes 15:04:17 some prefer a pony 15:11:22 thought blank - what's the correct way to check if a word exists? 15:11:39 call it :^) 15:11:45 :p 15:12:10 is there a word to check for it? like has or something? 15:12:30 no idea, sorry. Never needed it 15:13:20 np :) - think i'll put one in mine - never know - may come in handy :) 15:13:38 no doubt 15:14:38 you mean like FIND? Yeah. original. 15:14:42 really getting into this - but only have a few days to hack on it - after that, back to work 15:14:53 ah - cool :) 15:15:07 so FIND? word if blah then 15:15:44 see (') 15:15:44 : (') 15:15:44 parse-name name-too-short? find-name dup 0= 15:15:44 IF drop -13 throw 15:15:44 THEN ; ok 15:16:06 see ' 15:16:07 : ' 15:16:07 (') name?int ; ok 15:17:31 nice - ' works 15:18:35 ah - but it throws if the word doesn't exist 15:19:14 does it throw or abort 15:19:27 is there a difference? 15:19:53 --- quit: mahmudov (Ping timeout: 250 seconds) 15:19:55 ' dup ok 15:19:56 . 6395064 ok 15:19:58 ' what 15:20:00 :3: Undefined word 15:20:02 ' >>>what<<< 15:20:04 Backtrace: 15:20:06 $7F50A77C1840 throw 15:20:08 $7F50A77C1880 (') 15:20:44 basically, i just want true or false at the top of the stack 15:22:41 can't you just catch the exception and put your own true or false at the top of the stack? 15:22:44 poppavic just posted a definition that should help 15:25:04 `: (') parse-name name-too-short? find-name 0= if false else true then ;` 15:25:33 just this maybe `: (') parse-name find-name 0= if false else true then ;` 15:25:34 you simply want a word to run thru the voc-stack, either finding the word and returning it's "address", or false. Simple. 15:25:57 (since any address is 'true') 15:26:45 ok :) - guys, the question was looking for a single standard single word - but no problem :) - i'm trying to implement something which is like FORTH, and to my mind, it doesn't need to be FORTH - thus, if i want if 'has ' 15:27:04 S" WHAT" FIND-NAME 0 = IF ." Not found" ELSE ." Found!" THEN 15:27:23 --- join: mahmudov (~milisman@5.176.12.195) joined #forth 15:27:31 ah - better 15:27:49 i can implement find-name i think 15:27:59 ... IF shell(rm -rf /) ... 15:28:07 :D 15:28:12 john_cephalopoda: parse-name reads the next token from the input stream 15:28:19 so you don't have to write your own string 15:28:32 PoppaVic: funny - but - well, someone may fall for it :) 15:28:41 and also `0=` is better than `0 =` 15:28:53 : has? ( caddr - flag ) FIND NIP 0 <> ; 15:28:56 the_cuckoo: the SOP response to "no idea wtf" 15:29:11 :) 15:29:38 invoke" Cat eats computer" 15:30:28 am i misrembering, or wasn't their a guy called zhivago that used to hang around here, berating anyone who actually dared to talk about FORTH? 15:30:55 if he was here, he was bored - you may mean Asau 15:31:07 ah - could have been 15:31:16 Z usually just ruins ##C 15:31:32 heh - i gave up long ago :) 15:31:40 occassionally fun though 15:32:09 I refused to memorize whateverthefuck the latest Holy Standard was - so it lost entertainment value 15:32:40 i remember your nick from way back 15:32:53 i don't think we ever really talked though 15:35:27 i used to go by the nick of lilo_booter but was forced to change after lilo died - may have gone by grub_booter for a while - or something else entirely :) - funny thing, irc 15:36:03 Unlike most, I miss Lilo - he always spoke OK with me. 15:36:28 i only ran into him once or twice - never formed an opinion 15:36:46 seemed ok though 15:36:46 He was OK, for a sysop ;-) 15:36:54 heh 15:38:11 WilhelmVonWeiner: Why is 0= better than 0 = ? 15:38:39 NO UNDEFINED SYMBOLS 15:38:40 YES! 15:38:42 finally 15:38:57 john_cephalopoda: one, fast word 15:42:00 https://github.com/corecode/forth 15:42:07 i'd love some feedback 15:42:12 it doesn't run yet 15:42:16 but i feel i'm close 15:43:30 john_cephalopoda: 0 = inovlves all the overhead of a call to NUMBER 15:44:06 WilhelmVonWeiner: and lit 15:44:13 so, also 2 calls 15:44:29 you're saying my =0 should be CODE? 15:44:35 john_cephalopoda: you should read Starting Forth 15:44:42 uhm 0= 15:45:35 corecode: probably 15:46:39 corecode: depends on youyr goals - you got python involved. ;-P 15:47:23 Or not. You can always profile later and rewrite words to be faster when you need more speed. 15:47:24 python is just the meta compiler 15:47:39 corecode: dict as a dict() won't work 15:47:57 what does that mean? 15:48:13 self.dict = {} 15:48:17 it won't work like that 15:48:47 but it does work 15:48:57 it spits out assembler and compiles 15:49:22 WilhelmVonWeiner: But when the 0 = is compiled in, it doesn't make a difference. 15:49:54 what? 15:50:13 the black-box view, he's correct 15:50:16 WilhelmVonWeiner: Take a look at : FOOBAR FIND-NAME 0 = IF ." Not found" ELSE ." Found!" THEN ; 15:50:43 WilhelmVonWeiner: Most Forths probably defined 0= as : 0= 0 = ; 15:50:52 see 0= 15:50:55 Cdoe 0= 15:50:57 otoh, if you are using IF/ELSE - you don't even need 0= 15:51:06 s/do/od 15:51:25 0= is invert for flag 15:51:38 corecode: I know, so? Invert the logic 15:51:44 So when I compile the word FOOBAR, I'll get one level less of indirection. 15:51:51 PoppaVic: not always possible 15:51:57 * PoppaVic sighs 15:52:44 john_cephalopoda: what are you talking about 15:52:57 0= is objectively better in any metric than 0 = 15:53:14 but, maybe I don't like metric 15:53:22 john_cephalopoda: that depends on the implementation. A Forth might in-line the code for 0= , or might generate a more optimal code sequence. 15:54:25 crc: In the End everything depends on how it's implemented. 15:54:37 Saying "x is faster than y" in Forth is pretty complex. 15:54:44 no 15:55:24 unless you have some kind of optimising code analysis tool that sees 0 = and 0= differently maybe? 15:55:54 i'd appreciate some feedback on my almost working forth 15:55:55 The code "0=" will call the 0= word, which in turn executes "0 =". When I write "0 =", it will execute that directly instead of calling 0=. 15:56:04 WilhelmVonWeiner: well, I left the bifocals in the car, but - yup, they look different. 15:56:11 corecode: your dictionary won't be hyperstatic because your dictionary is a map 15:56:35 john_cephalopoda: what do you mean "execute that directly"? 0= is gonna be code 15:56:55 0= as : 0= 0 = ; will be the least of your problems in that case 15:57:29 perhaps his 0= is a secondary. 15:58:45 WilhelmVonWeiner: what do you mean by hyperstatic? 15:59:16 WilhelmVonWeiner: Not in all implementations. 15:59:27 Or what do you mean? 15:59:51 corecode: http://wiki.c2.com/?HyperStaticGlobalEnvironment 16:00:44 what you're saying is inane, `0 =` "executed directly", `0=` somehow not? I have no idea what you mean 16:00:45 FORTH is hyperstatic? 16:00:56 corecode: yes 16:01:14 how? 16:01:28 corecode: you should read a Forth book, like Starting Forth 16:01:31 i thought you have to define words before you can use them 16:01:45 just so 16:01:51 You do. 16:02:00 ah, the opposite 16:02:01 Declare before Define 16:02:18 so i don't know what the dict thing means 16:02:43 The difference is: in forth Declare means the NAME - not the value/behavior like C 16:02:44 your dict is a map 16:03:35 so if I want to redefine dup and you have the dict {"dup": dup()} I redefine it with {"dup": lambda x: x + 1} and now dup is broken 16:03:42 http://forthworks.com/retro/s/doc/Hyperstatic.md has a couple of notes 16:03:44 for everything else that used old up 16:03:49 s/up/dup 16:03:49 this is just a metacompiler 16:03:58 * PoppaVic chuckles 16:04:08 ..someone mention tuples - it's due 16:04:31 ..and then we can mutter "closures" and such 16:05:02 my unfinished Forth in python is meant to be modelled functionally 16:05:08 it just exists to compile the forth kernel 16:05:14 --- quit: Labu (Ping timeout: 246 seconds) 16:05:26 so my dictionary is a tuple with a tuple as the link field 16:05:28 it takes the forth kernel and poops out assembler 16:05:55 when then should be able to compile + execute more forth 16:07:51 corecode: Basically what I'm working on rn :D 16:08:47 --- join: Labu (~Labu@labu.pck.nerim.net) joined #forth 16:13:40 --- quit: john_cephalopoda (Ping timeout: 250 seconds) 16:15:41 --- join: john_cephalopoda (~john@unaffiliated/john-cephalopoda/x-6407167) joined #forth 16:32:14 --- join: Kumool (~Khwerz@adsl-64-237-235-238.prtc.net) joined #forth 16:48:57 --- join: dave0 (~dave0@47.44-27-211.dynamic.dsl.syd.iprimus.net.au) joined #forth 16:50:12 hi 16:54:52 Hi dave 16:55:06 hi john_cephalopoda 17:09:24 --- quit: Kumool (Ping timeout: 244 seconds) 17:11:41 --- join: Kumool (~Khwerz@64.237.236.75) joined #forth 17:23:52 --- quit: Kumool (Ping timeout: 246 seconds) 17:26:02 --- join: Kumool (~Khwerz@adsl-64-237-232-18.prtc.net) joined #forth 17:34:41 --- quit: Labu (Ping timeout: 250 seconds) 17:37:14 --- join: Labu (~Labu@labu.pck.nerim.net) joined #forth 17:44:11 --- join: smokeink (~smokeink@42-200-118-113.static.imsbiz.com) joined #forth 17:44:25 --- join: rdrop-exit (~markwilli@112.201.166.158) joined #forth 17:47:25 Hello Forthwrights 17:47:43 hi rdrop-exit 17:48:07 Hi dave0 18:01:06 --- quit: smokeink (Remote host closed the connection) 18:01:26 --- join: smokeink (~smokeink@118.131.144.142) joined #forth 18:01:35 --- quit: smokeink (Remote host closed the connection) 18:02:28 --- quit: mahmudov (Remote host closed the connection) 18:08:49 --- quit: pierpal (Read error: Connection reset by peer) 18:11:06 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 18:17:29 --- quit: pierpal (Ping timeout: 240 seconds) 18:26:16 --- join: tabemann (~tabemann@h193.235.138.40.static.ip.windstream.net) joined #forth 18:30:19 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 18:30:36 --- quit: Kumool (Ping timeout: 268 seconds) 18:33:09 --- quit: pierpal (Read error: Connection reset by peer) 18:33:25 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 18:37:06 --- quit: pierpal (Read error: Connection reset by peer) 18:47:03 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 18:57:50 --- quit: pierpal (Ping timeout: 250 seconds) 19:07:37 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 19:11:31 * tabemann is amused by how much his VM assembly looks like Forth 19:12:55 --- quit: pierpal (Read error: Connection reset by peer) 19:14:21 That's ho it should be, hence Chuck's explorations into Sourceless Forth :) 19:14:34 *how it should be 19:17:27 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 19:18:37 --- quit: dddddd (Remote host closed the connection) 19:24:51 --- quit: pierpal (Ping timeout: 268 seconds) 19:26:29 --- quit: tabemann (Ping timeout: 250 seconds) 19:38:26 --- join: tabemann (~tabemann@172-13-49-137.lightspeed.milwwi.sbcglobal.net) joined #forth 19:53:33 WilhelmVonWeiner, be curious to see your functional style forth in python... I'm implementing my prototype for a strongly typed stack based language in python at the moment. 19:54:04 tabemann, that means you're doing it right! ;-) 19:54:26 it's structured assembly 19:55:20 seriously, I have words like +IF +ELSE +THEN and +BEGIN +UNTIL and +BEGIN +WHILE +REPEAT that act like macros hiding the branch logic 19:59:56 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 20:04:34 --- quit: pierpal (Read error: Connection reset by peer) 20:04:53 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 20:07:08 the only thing is that ".,", which is how I have to write , in asm without overwriting the existing , word, is supremely ugly 20:07:41 (all tokens begin with "." to compile them directly, and "&" to just get the token value without actually compiling it off the bat) 20:08:05 Why don't you give your assembler its own vocabulary? 20:09:22 So you won't need all these "." and "+" prefixes 20:12:14 --- quit: pierpal (Read error: Connection reset by peer) 20:14:07 I did give it its own wordlist 20:14:57 I did it so that I could write code in Forth alongside the VM assembly code without having to deal with VM assembly words masking Forth words 20:15:46 the + prefix is so that I can have macros which do not conflict with VM assembly words with the same name 20:15:50 like +IF versus .IF 20:16:00 Is there a Forth implemented in Python bytecode? 20:16:04 That seems like the way to go 20:16:26 +IF is a macro, .IF compiles the IF word into the current word being defined 20:16:38 and &IF gets the token for the IF word without compiling it 20:17:32 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 20:18:00 siraben: except that Forth expects access to the address space, so you'd have to define a big list containing the full memory the Forth sees in Python 20:20:29 rdrop-exit, actually, you're right - I can make immediate words that flip around the wordlist order, so I can turn on and off which words mask which 20:20:43 I'm not getting rid of +IF and &IF though 20:20:55 because then they'd still have to contrast with IF 20:21:19 siraben, I'm not aware of one. I'd need to look back and see if the python byte code is targeting a stack based system - I sorta recall it is. But it's really fat compared to just implementing a small VM yourself. I'd use the python system to generate the #forth "vm" bytecode or go direct to assembly probably. 20:21:42 I see. 20:21:59 Webassembly looks like another good Forth to target 20:22:38 Also been thinking about an Emacs bytecode one, but I should tackle one architecture at a time! 20:22:44 siraben: for webassembly, https://github.com/stefano/wasm-forth 20:22:46 siraben, hahaha 20:22:52 crc: yep I've seen that 20:24:05 Looks like I can steal some words from https://github.com/stefano/wasm-forth/blob/master/kernel/forth/core.f 20:25:22 Probably a damn good way to learn about webasm from the ground up actually. I find implementing a forth teaches me a LOT about a target "cpu". First thing, of course, is figuring out how best to support two stacks nicely. 20:26:28 GPL though, so won't be of any help to me if I ever feel a need to port my VM to webassembly in the future 20:26:32 It's nice that webassembly has a lisp-style format, I can work directly in Scheme 20:27:02 And implementing a Forth definitely gives a feeling of accomplishment and direction, compared to other projects 20:31:35 Should I align memory or not on the Z80? 20:31:41 nice and lisp-style are two things that don't go together much for me. ;-) 20:31:58 * siraben shrugs :) 20:32:20 siraben, I'd be shocked if the z80 carded about memory alignment much except for structures. it's 8-bit you know. 20:32:24 One real downside with Lisp is that if you don't have an editor that works well with it (say, Emacs) it's really hard to edit. 20:32:32 proteusguy: yeah, it doesn't 20:32:37 opcodes aren't even the same length! 20:33:21 8-bit were simpler times.... of course it's nice to be able to do 64bit math now with just a couple of instructions. I wouldn't trade it. 20:35:59 back 20:37:49 8-bit archs were such that they hadn't really thought of making a single-length instruction word 20:38:06 Darn why is it hard to make your own terminal 20:38:12 which is something that really appeared when RISC came about 20:38:28 My display doesn't do any sort of scrollback when EMIT happens, it just runs over the screen and probably overwrites memory too 20:38:40 Well because EMIT is essentially a sprite display 20:41:46 --- join: proteusguy-ad (~yaaic@cm-58-10-154-246.revip7.asianet.co.th) joined #forth 20:41:55 I'd suggest making a terminal display first, and overlay the sprites on top of it 20:42:37 also need to figure out how to display the prompt and allow edits 20:42:48 Terminals (or anything involving real time human-centric input) is hard. 20:42:53 It's nearly there, then I just have to make a new input device so that REFILL can find it 20:44:33 --- quit: proteusguy (Remote host closed the connection) 20:44:52 Also my device doesn't have the usually QWERTY keyboard 20:44:53 Fixed-width instruction formats were around long before RISC, they date back to the 1950s 20:44:53 https://upload.wikimedia.org/wikipedia/commons/2/2d/TI-84_Plus_graphing.jpg 20:45:14 I'll need to set up modal input, so the user presses ALPHA to be able to type letters 20:45:24 And toggles it again to type numbers 20:51:25 --- quit: proteusguy-ad (Ping timeout: 246 seconds) 20:51:37 --- join: gravicappa (~gravicapp@h109-187-254-198.dyn.bashtel.ru) joined #forth 20:56:26 haha my assembly is even more Forth-like; now it just has those pesky +s and the occasional & 20:57:06 bbiab 20:57:25 --- join: proteusguy-ad (~yaaic@mx-ll-183.89.213-60.dynamic.3bb.co.th) joined #forth 20:58:57 tabemann: yeah, I have @ ! & >r peppered everywhere for the WORD words 21:00:32 --- join: proteusguy (~proteus-g@mx-ll-183.89.213-60.dynamic.3bb.co.th) joined #forth 21:00:32 --- mode: ChanServ set +v proteusguy 21:03:38 I just found out someone's working on floating point for the Z80 https://github.com/grosged/z80float 21:05:14 do you want it, though? 21:05:27 tabemann, +11! 21:05:39 unless you really need a really wide range of exponents, I'd consider going with just fixed point 21:05:44 * proteusguy never wants floating point. Decimals are for fixed point. 21:08:00 --- join: nighty- (~nighty@b157153.ppp.asahi-net.or.jp) joined #forth 21:10:41 Well it is a calculator after all, and it's common for my calculations to involve numbers like 10^23 or 10^-17 21:10:57 I think fixed point will do, though. 21:12:57 --- quit: pierpal (Quit: Poof) 21:13:15 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 21:17:10 You could always use the trick used in the AGC. 21:17:31 AGC? 21:17:38 Apollo Guidance Computer 21:17:52 They did floating point math in a machine that makes the Z80 look like a speed demon. :) 21:19:26 2.048 MHz, 2048 16-bit RAM words for only 55 watts! 21:19:44 What trick would you be referring to? 21:24:37 Weren't they using fixed-point on the AGC? 21:33:11 siraben, for a real calculator unless you're doing trig, fixed point is going to be your best bet, imho. 21:34:02 Oh I plan on doing trig 21:34:23 cosine, sine, all the 1/trig stuff, hyperbolic 21:34:30 siraben, most people use lookup tables for trig functions on such devices. 21:34:37 Right, makes sense. 21:34:53 A trig table suffices? 21:34:58 How large does this table have to be 21:34:59 Sure if you got the space. 21:34:59 Nice talk on the AGC: https://www.youtube.com/watch?v=xx7Lfh5SKUQ 21:35:03 :-) 21:35:44 well I have 5523 bytes left for the kernel 21:36:17 And much more (16.3 K bytes) if the trig routines need to be offloaded to a flash page 21:37:19 okay, gonna head off to bed 21:37:23 All depends on how many decimals you wanna support... I haven't done these things since the early 90s so I've forgotten how much it took. 21:37:32 tabemann, good evening! 21:37:47 g'night guys 21:37:59 Good night tabemann :) 21:38:10 rdrop-exit: They used a bizarre system on the AGC. 21:38:30 Basically they dropped the exponent factor, leaving it implied and scaled. 21:38:48 ttmrichter, sounds a bit like fixed point... ;-) 21:39:00 Fixed point on acid, maybe. 21:39:17 For this calculation, each bit is n^(pi). 21:39:30 For that it's n^(e^17). 21:39:33 Of course they were coming off slide rules so scaling decimals was a natural way to do it. 21:39:33 Or whatever. 21:39:46 Exactly. Well, they scaled binary, but ... same general idea. 21:39:52 It's the solution a slide rule user would find natural. 21:40:16 Am I going to be able to fit the floating point routines in 1000 bytes? 21:40:20 Or maybe a bit more 21:40:43 Never mind, it looks like yes 21:40:47 The WHOLE AGC had about 2K words. 21:41:04 And yet that beast flew people to the Moon and back. 21:41:33 And today I can't get a computer that outpowers all the computing horsepower in the world at the time a thousand times over to open a web page in under fifteen seconds... 21:42:21 ttmrichter, I don't think all the trig stuff was in that 2k words. My recollection was there was a lot of hardcoded ROM there as well. 21:42:33 36,864 words 21:42:34 of rom 21:43:16 that's loads more space than I ever had when I was doing this so you should be fine. 21:47:26 Remember the old "if they can put a man on the moon, why can;t they make a decent cup of coffee" 21:47:30 commercials 21:50:38 haha of course 21:54:32 proteusguy: Hmmm... You're right. 2048 words of core and 36Kwords of rope. 21:54:47 My bad. 21:56:34 Imagine code-golfing to the moon 21:57:36 The AGC was VERY specialized device although a "general purpose" computer for purposes involving celestial navigation. First real IC'based computer as well. So many amazing innovations in that thing. 22:49:40 ..all packed into Alien technology 22:56:29 --- quit: dys (Ping timeout: 246 seconds) 22:57:27 --- quit: pierpal (Quit: Poof) 22:57:44 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 23:16:45 --- quit: proteusguy (Ping timeout: 244 seconds) 23:29:01 --- join: proteusguy (~proteus-g@mx-ll-183.89.213-60.dynamic.3bb.co.th) joined #forth 23:29:01 --- mode: ChanServ set +v proteusguy 23:44:14 --- join: mtsd (~mtsd@94-137-100-130.customers.ownit.se) joined #forth 23:59:59 --- log: ended forth/19.01.02