00:00:00 --- log: started forth/19.04.03 00:19:58 --- join: xek (~xek@apn-37-248-138-82.dynamic.gprs.plus.pl) joined #forth 00:41:44 --- quit: dys (Ping timeout: 246 seconds) 01:25:29 --- quit: reepca (Ping timeout: 246 seconds) 01:37:38 is Forth's IF ELSE THEN something that lisp calls "macros" ? 01:38:45 they 'do' stuff at compile time, not just add more code to the definition... that's macros? 01:40:01 AFAIK ""IF"" from 4th is equivalent to both Read Macros and Macros in Lisp. 01:40:27 Has functionality of both Read-Macros and Macros. 01:41:18 aha i googled "lisp read macros" 01:42:21 lisp is complicated :-/ 01:45:04 Complicated eor Complex (Ref: [[https://zen-of-python.info/][The Zen of Python]])?! 01:45:39 AFAIK Forth Text Interpreter is equivalent to Lisp Reader. 01:49:24 rdrop-exit: You said meta-compiling only allows small modifications. Can you give an example? I'm still not seeing why that would be the case. 02:03:32 --- quit: ashirase (Ping timeout: 255 seconds) 02:08:25 --- join: ashirase (~ashirase@modemcable098.166-22-96.mc.videotron.ca) joined #forth 02:21:20 --- quit: xek (Remote host closed the connection) 02:21:46 --- join: xek (~xek@apn-37-248-138-82.dynamic.gprs.plus.pl) joined #forth 02:22:54 --- quit: xek (Remote host closed the connection) 02:45:50 --- quit: chunkypuffs (Quit: ZNC 1.7.1 - https://znc.in) 02:45:58 --- join: chunkypuffs (~chunkypuf@2a01:4f9:2b:16d5::1) joined #forth 03:14:14 So, this is coming together into a nice plan. I have that start on an assembler I did a couple of weeks ago. I'm now re-writing my primitives (in blocks), in what I'll call a "portable" form - I'm just invoking words that are descriptive of the steps that are required in the Forth VM to implement that primitive. For example: 03:14:17 :p .@-- w=tos; w--; w.push; tos=[tos]; next; 03:14:52 Next step will be to define a vocabularly "portable" that contains assembly implementation of those words: 03:15:09 : w=tos w tos mov; ; 03:15:18 and above that somewhere 03:15:24 : w r8 ; 03:15:29 : tos rcx ; 03:15:47 So with all that in place, I should be able to compile and TEST the primitives. 03:16:16 And from there I can just roll on into defining the higher level definitions in Forth (I have the Forth as comments in my assembly file for pretty much everything I've written). 03:16:34 I should be able to pursue that strategy of "add to, test..." all the way up through the complete system. 03:16:51 Then finally I address the generation of an actual image, knowing that code is all working. 03:17:08 As far as I can tell there are no roadblocks - just labor between me and a fully metacompilable system. 03:19:23 The goal here is to capture all of the configuration specifics in that "portable" layer. I could change data cell / instruction cell size there. I could change the underlying processor architecture. 03:19:49 The hope is to make the primmitives and the system definitions in a UNIVERSAL form. 03:20:08 I'm going to try to even capture the threading model that way, but some nagging thing tells me that may be hard. 03:20:20 Haven't put my finger on anything specific there yet - just a hunch. 03:23:17 I think one thing that would be needed to make the main source threrading model independent would be to have something at the portable level that "compiled a CFA field." Since that actually changed between direct and indirect threading. 03:23:51 And of course NEXT has to be in that layer. 03:24:10 But that was already going to be the case. 03:29:18 What I really like about this approach (other than the obvious "nicety" of having a universal, portable system definition) is that the primitive definitions are coming out VERY "readable." It's just absolutely clear what each one is "doing" in the vm. 03:31:07 Also, this abstraction shouldn't cost me ANY performance. Generally speaking most of these "portable instructions" are a single line of x86 assembly. In a few cases a p.i. might have two lines of assembly. On the other hand, many of them will have multiple lines when I port to the ARM architecture, just because of ARM's RISC nature. But I think I'll still be able to make a claim that it's the "best" (or at 03:31:09 least "a best") implementation. 03:42:40 i have a style question... do you prefer IF ... exit THEN ... or IF ... ELSE ... THEN in this code? https://termbin.com/h0sq 03:43:21 it's the same amount of words and characters so you can't go for the shorter one :-p 03:43:48 I like IF ... exit THEN ... 03:44:14 By the way, I named EXIT ;, 03:44:39 KipIngram: yes i thought it would be less typing for you ;^) 03:44:42 Shorter, completely "concept connected" to ; etc. 03:44:58 Well, it just LOOKS cleaner and less involved. 03:45:06 It's not JUST about the keystroke count. :-) 03:45:38 I call it IF ... THEN; 03:46:00 Yeah, that's really good as well. 03:46:15 it turns out that exit THEN is one less cell because "exit" is 1 cell, but "ELSE" is 2 cells branch+address 03:47:15 but that's only cos i'm close to the code 03:48:02 The red flag for me in your second pastebin clause is the "THEN THEN" 03:48:16 ick 03:48:46 I don't really like IF ... THEN to start with - much less doubling up on them. 03:48:58 oh 03:50:15 On my host Forth ;THEN compiles to 1 byte, ELSE compiles to 2 bytes 03:50:34 My habit is to replace IF ... THEN with a factored word : ; ... ; 03:50:43 ; being a conditional return. 03:51:26 you don't think exactly 1 exit per word is better? 03:51:36 Definitely not. 03:52:04 Now, you want to stay away from tangled up messes, but if it's clean and clear what's going on multiple exits can be very powerful. 03:52:31 When the alternate exit is right at the very beginning and associated with a test, it's pretty clear what's happening. 03:54:59 Exactly, exit as soon as your done with that particular condition, it's been "disposed of". 03:55:14 Makes code clearer INO 03:55:18 * IMO 03:55:18 in the paste, IF true ELSE ... THEN you have to skip over the "..." with your eyes, which is complicated 03:55:39 else is smelly 03:55:56 i'm getting unanimous for exit 03:57:00 thanks all :-) 03:57:07 WilhelmVonWeiner: Yes - I dislike IF ... THEN, but I REALLY dislike ELSE. 04:14:18 : then; { a -- }( -- )( r: a -- ) & exit resolve ; directive 04:17:10 What's the & doing there? 04:17:46 & is just what I name POSTPONE 04:17:46 returns a pointer (e.g., ' or ['] ) 04:18:26 hmm, that make sense too :) 04:18:33 :) 04:19:26 * crc updates his notes... 04:20:33 dave0's `>digit` would look like this in my forth: 04:20:35 :>digit (c-nf|f) 04:20:35 dup c:digit? [ $0 - TRUE ] if; 04:20:35 dup c:letter? [ c:to-lower #87 - TRUE ] if; 04:20:35 drop FALSE ; 04:20:36 DIRECTIVE is like IMMEDIATE but it also makes it a compile-only definition 04:22:39 5 04:22:40 6 digit Convert an integer digit of up to base 40 to the 04:22:40 7 corresponding ASCII digit character (i.e 0..9, a..~). 04:22:44 8 04:22:52 --- quit: proteusguy (Remote host closed the connection) 04:22:56 3 04:22:56 4 : digit ( 0..39 -- c ) 04:22:56 5 dup 9 > ascii 0 ascii a 10 - \mux + ;inline 04:22:56 6 04:25:22 1 04:25:22 2 rebase Convert an ASCII digit character of up to base 40 04:25:22 3 (i.e 0..9, a..~) to an integer. 04:25:22 4 04:25:36 1 04:25:36 2 : rebase ( c -- u ) 04:25:36 3 dup ascii 9 > ascii 0 ascii a 10 - \mux - ;inline 04:26:15 4 04:28:01 Maybe I should factor out the the "ascii 0 ascii a 10 - \mux" portion 04:29:11 ahhh \mux i've heard you talk about that before 04:29:47 It's a cell-wide two-to-one multiplexer 04:30:22 I have two versions as opcodes: 04:30:25 mux ( x1 x2 mask -- x ) 04:30:40 \mux ( mask x1 x2 -- x ) 04:30:45 mask bits select which x the result comes from? 04:31:09 Yes, equivalent in C language to: 04:31:21 x=(~mask&x1)|(mask&x2) 04:31:47 I imagine I have some places that could be used. 04:32:32 I use it to make code branch-less 04:33:12 Pretty much always a good thing. :-) 04:33:30 Usually yes :) 04:34:17 isnt \mux just mux with -ROT at start? 04:34:43 Yes, but it's an opcode of the VM 04:34:57 why an opcode? just for speed? 04:36:17 My host Forth is bytecoded so I have up to 256 opcodes, I use both MUX and \MUX frequently, so I wanted them to both be opcodes 04:36:18 : mux ( x1 x2 mask -- x ) dup >r and swap r> invert and or ; \ should do it, no? 04:37:08 Yes, but mine is not a secondary, it's a single-byte opcode 04:37:14 I have a *lot* of primitives that aren't strictly necessary (could be easily generated from other primitives). I like being able to choose the highest performance option. 04:37:44 It isn't a primitive in my case, it's a VM opcode 04:37:50 right. This actually open up the option of self-testing vm images, no? 04:37:52 My usual reasoning is "if it can be done simply and fast in a primitive, make it one." 04:38:09 that is vm images that test if all opcodes are implemented per spec. 04:38:28 I don't have that layer - I have primitives written in machine code. 04:38:44 Though this "portable layer" I was talking about earlier could be viewed that way. 04:38:50 The machine code of my VM is these opcodes 04:38:55 I use those "instructions" to *generate* code, though, not "run on a vm." 04:39:09 no, I mean for instance to use that mux word definition I gave to test if the opcode version does as it should do. 04:39:24 brb 04:40:41 back, I don't understand the question 04:43:39 The host Forth that I use for my IDE runs on a portable POSIX VM 04:44:48 I only use it on the host side, it's not meant for targets 04:49:00 I get it now Zarutian, I usually provide a high level equivalent in the shadow screens for documentation purposes 04:49:58 But no, I haven't automated any sort of testing using the high level equivalents, their just there for documentation purposes 04:51:25 For example: 04:52:02 9 04:52:03 a mux 64x2-1 mux, i.e. x=(~mask&x1)|(mask&x2), 04:52:03 b |copy and swap pop andc or|. 04:52:03 c 04:52:55 0 source Host VM Bytecodes $ 68 .. $ 6b 04:52:55 1 04:52:55 2 $ 68 bytecode @@+ ( a -- x ) 04:52:55 3 04:52:55 4 $ 69 bytecode @b@+ ( a -- b ) 04:52:57 5 04:53:00 6 $ 6a bytecode mirror ( x -- x' ) 04:53:02 7 04:53:05 8 $ 6b bytecode mux ( x1 x2 mask -- x ) 04:53:07 9 04:54:38 Hex 6b is the bytecode (VM opcode) for MUX 04:57:29 If ever I were to decide I to get rid of the MUX opcode, because I have a more important use for that slot, I would redefine as a primitive whose content is "copy and swap pop andc or" 04:58:15 : mux ( x1 x2 mask -- x) tuck and >r not and r> or ; 04:58:24 i gotta practise my forth 04:59:34 I use Chuck-ish return stack operator names, COPY is equivalent to DUP >R 04:59:46 POP is R> 04:59:57 PUSH is >R 05:00:32 TOP is R@ 05:01:59 They're all VM opcodes 05:05:01 CM doesn't use the forth standard? 05:05:10 :-)))) 05:05:25 Good one dave0 ;-) 05:05:31 oh heh 05:07:21 I don't think CM cares at all about the standard 05:10:08 It's too far from his approach to Forth at this point 05:19:46 For Chuck Forth is Words + 2 Stacks + Blocks 05:33:58 --- join: dddddd (~dddddd@unaffiliated/dddddd) joined #forth 05:37:06 Dave0, not that MUX isn't just for flags: 05:37:07 1 05:37:07 2 >offset Replace low 10 bits of with low 10 bits from 05:37:08 3 . 05:37:10 4 05:37:18 1 05:37:18 2 : >offset ( u offset -- u' ) 1023 mux ;inline 05:37:19 3 05:38:47 * correction: *note* that MUX isn't just for flags 05:45:16 bbiab 05:45:34 honestly, even blocks are optional to chuck 05:45:51 two stacks and some kind of memory 05:50:32 He sees blocks as a convenient fixed size unit to acess memory (of whatever kind), e.g. : block ( blk# -- a ) 1024 * ; 05:50:51 * access 05:51:54 (they don't have to be 1k blocks either, whatever makes most sense for his needs at the time) 05:52:41 bbiab 05:53:02 yeah. 05:54:59 --- quit: gravicappa (Ping timeout: 245 seconds) 05:55:44 --- join: gravicappa (~gravicapp@h109-187-18-29.dyn.bashtel.ru) joined #forth 07:08:58 --- join: proteusguy (~proteusgu@cm-58-10-208-131.revip7.asianet.co.th) joined #forth 07:08:58 --- mode: ChanServ set +v proteusguy 07:13:34 --- quit: rdrop-exit (Quit: Lost terminal) 07:34:59 --- quit: proteusguy (Ping timeout: 245 seconds) 07:41:44 --- quit: tabemann_ (Ping timeout: 250 seconds) 08:27:45 --- quit: dave0 (Quit: dave's not here) 09:01:18 --- quit: chunkypuffs (Remote host closed the connection) 09:01:25 --- join: chunkypuffs (~chunkypuf@2a01:4f9:2b:16d5::1) joined #forth 12:06:13 --- quit: gravicappa (Ping timeout: 246 seconds) 15:26:47 --- join: dave0 (~dave0@223.072.dsl.syd.iprimus.net.au) joined #forth 15:27:06 hi 15:34:02 Hi dave 15:34:38 hi john_cephalopoda 16:29:15 --- join: wa5qjh (~quassel@110.54.249.181) joined #forth 16:29:15 --- quit: wa5qjh (Changing host) 16:29:15 --- join: wa5qjh (~quassel@freebsd/user/wa5qjh) joined #forth 16:40:47 --- quit: john_cephalopoda (Ping timeout: 258 seconds) 16:41:16 --- join: tabemann (~tabemann@rrcs-162-155-170-75.central.biz.rr.com) joined #forth 16:53:40 --- join: john_cephalopoda (~john@unaffiliated/john-cephalopoda/x-6407167) joined #forth 16:58:08 --- quit: wa5qjh (Remote host closed the connection) 17:00:08 --- join: wa5qjh (~quassel@110.54.249.181) joined #forth 17:00:08 --- quit: wa5qjh (Changing host) 17:00:08 --- join: wa5qjh (~quassel@freebsd/user/wa5qjh) joined #forth 19:06:59 --- quit: tabemann (Ping timeout: 268 seconds) 19:10:00 --- join: tabemann (~tabemann@rrcs-162-155-170-75.central.biz.rr.com) joined #forth 20:03:42 --- quit: dddddd (Remote host closed the connection) 20:04:57 --- quit: tabemann (Ping timeout: 268 seconds) 20:06:24 --- join: gravicappa (~gravicapp@h109-187-18-29.dyn.bashtel.ru) joined #forth 20:48:14 --- join: tabemann (~tabemann@2600:1700:7990:24e0:e9cf:9aca:5cdd:e5ee) joined #forth 20:57:39 --- quit: cp- (Quit: Disappeared in a puff of smoke) 20:58:03 --- join: cp- (~cp@b157153.ppp.asahi-net.or.jp) joined #forth 22:08:22 --- quit: wa5qjh (Read error: Connection reset by peer) 22:08:43 --- join: wa5qjh (~quassel@110.54.249.181) joined #forth 22:08:43 --- quit: wa5qjh (Changing host) 22:08:43 --- join: wa5qjh (~quassel@freebsd/user/wa5qjh) joined #forth 22:30:48 --- join: leaverite (~quassel@110.54.249.181) joined #forth 22:30:48 --- quit: leaverite (Changing host) 22:30:48 --- join: leaverite (~quassel@freebsd/user/wa5qjh) joined #forth 22:30:56 --- quit: wa5qjh (Read error: Connection reset by peer) 22:40:34 --- join: Croran (~quassel@2601:601:1801:6dde::4276) joined #forth 23:37:13 --- join: wa5qjh (~quassel@freebsd/user/wa5qjh) joined #forth 23:38:00 --- quit: leaverite (Read error: Connection reset by peer) 23:59:59 --- log: ended forth/19.04.03