00:00:00 --- log: started forth/18.09.22 00:54:32 --- join: dys (~dys@tmo-113-43.customers.d1-online.com) joined #forth 01:06:20 --- join: ncv (~neceve@2a02:c7d:c5c9:a900:6eaf:6ef7:3b81:d5f6) joined #forth 01:06:20 --- quit: ncv (Changing host) 01:06:20 --- join: ncv (~neceve@unaffiliated/neceve) joined #forth 01:50:37 The BEGIN ... UNTIL loop starts off by DROPping the top of the stack 01:50:49 It wants to drop the leftovers every iteration 01:51:11 first iteration you just feed it garbage so it doesn't mess up your stack 02:01:29 --- join: h4shc4t (~umar@39.52.252.184) joined #forth 02:04:21 --- quit: ashirase (Ping timeout: 252 seconds) 02:04:22 --- join: ncv_ (~neceve@185.195.19.89) joined #forth 02:04:22 --- quit: ncv_ (Changing host) 02:04:22 --- join: ncv_ (~neceve@unaffiliated/neceve) joined #forth 02:04:25 --- part: h4shc4t left #forth 02:06:56 --- quit: ncv (Ping timeout: 240 seconds) 02:06:59 --- join: ashirase (~ashirase@modemcable098.166-22-96.mc.videotron.ca) joined #forth 02:15:40 --- join: Keshl_ (~Purple@24.115.185.149.res-cmts.gld.ptd.net) joined #forth 02:15:45 --- quit: Keshl (Read error: Connection reset by peer) 02:17:00 --- quit: dys (Ping timeout: 252 seconds) 02:32:56 --- quit: ncv_ (Ping timeout: 240 seconds) 02:34:14 --- join: ncv (~neceve@unaffiliated/neceve) joined #forth 02:43:20 --- join: dys (~dys@tmo-106-105.customers.d1-online.com) joined #forth 02:45:30 --- join: rdrop-exit (~rdrop-exi@112.201.162.180) joined #forth 02:51:17 --- quit: wa5qjh (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) 02:53:13 --- join: wa5qjh (~quassel@freebsd/user/wa5qjh) joined #forth 03:25:06 --- join: dddddd (~dddddd@unaffiliated/dddddd) joined #forth 04:53:44 --- quit: wa5qjh (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) 04:56:55 --- quit: jedb (Ping timeout: 246 seconds) 05:10:31 --- join: jedb (~jedb@199.66.90.209) joined #forth 07:17:31 --- quit: rdrop-exit (Remote host closed the connection) 08:09:25 --- quit: pierpal (Ping timeout: 246 seconds) 08:59:10 --- join: gravicappa (~gravicapp@ppp83-237-168-97.pppoe.mtu-net.ru) joined #forth 09:06:45 --- quit: dave9 (Ping timeout: 252 seconds) 09:28:03 --- join: pierpal (~pierpal@host102-235-dynamic.181-80-r.retail.telecomitalia.it) joined #forth 10:51:23 --- quit: ncv (Remote host closed the connection) 10:59:03 --- quit: phadthai (Remote host closed the connection) 11:02:26 --- join: phadthai (mmondor@ginseng.pulsar-zone.net) joined #forth 11:48:22 --- quit: tabemann (Ping timeout: 260 seconds) 13:14:48 --- join: lemonpepper24 (~lemonpepp@2603:3024:1a0b:5a00::62b0) joined #forth 13:39:07 --- quit: pierpal (Ping timeout: 244 seconds) 13:50:45 --- join: pierpal (~pierpal@host102-235-dynamic.181-80-r.retail.telecomitalia.it) joined #forth 13:55:08 --- quit: pierpal (Ping timeout: 244 seconds) 14:03:47 --- join: pierpal (~pierpal@host102-235-dynamic.181-80-r.retail.telecomitalia.it) joined #forth 14:18:05 --- join: GITIB (~GiL@91.160.171.221) joined #forth 14:18:58 --- part: GITIB left #forth 14:19:27 --- quit: dys (Ping timeout: 260 seconds) 14:30:27 That seems like an odd way for it to work. I thought BEGIN just marked an address and AGAIN compiled a jump to it - end of story. 14:31:34 I'm not sure I'm going to implement that at all in mine. 14:31:50 It's an opportunity to factor - put the loop content in its own word - and just use tail recursion. 14:55:37 --- quit: lemonpepper24 (Ping timeout: 260 seconds) 15:00:21 --- join: wa5qjh (~quassel@175.158.225.222) joined #forth 15:00:21 --- quit: wa5qjh (Changing host) 15:00:21 --- join: wa5qjh (~quassel@freebsd/user/wa5qjh) joined #forth 15:17:27 --- quit: gravicappa (Ping timeout: 252 seconds) 16:13:02 --- join: dave9 (~dave@90.20.215.218.dyn.iprimus.net.au) joined #forth 16:13:16 hi 16:53:10 --- join: raoul (~raoul@2a02:1205:5017:3ca0:428d:5cff:febb:33b) joined #forth 16:56:21 Hi all! Does anyone have insights on running https://github.com/organix/pijFORTHos on QEMU? 16:58:09 I have been trying with a command such as "qemu-system-arm -M raspi2 -kernel kernel.img -serial stdio" but to no avail... 16:58:18 --- join: travisb (~travisb@cpe-24-209-155-210.wi.res.rr.com) joined #forth 16:59:42 The emulator does not crash, but nothing happens either. I only get a black screen. 17:35:21 --- quit: raoul (Quit: WeeChat 1.9.1) 17:49:13 raoul: qemu-system-arm -M raspi2 -nographic -kernel kernel.elf -semihosting; stty sane 17:50:21 offline already bah 18:02:28 --- quit: travisb (Read error: Connection reset by peer) 18:03:01 pointfree: h'lo there 18:03:43 ahoy, Zarutian 18:05:04 for a long while I have been looking into how to combine forth and ocap thinking 18:05:15 s/while/while now/ 18:05:59 and other than implementing an memory safe object system ontop of forth I am rather stumped for ideas. 18:07:35 What's ocap? 18:09:19 KipIngram: well, here is a short version https://github.com/Agoric/PlaygroundVat/blob/master/docs/objcap.md 18:10:51 KipIngram: here is much longer involved explanation http://habitatchronicles.com/2017/05/what-are-capabilities/ 18:13:13 Ah, "capabilities" I recognize. 18:13:18 Old idea. 18:13:21 I've always liked it. 18:13:41 KipIngram: but in short it ask what computer security is about, turns out it is about access control but not which ape at the keyboard but what piece of state and behaviour, an object, can access and affect other such things or even the outside world 18:14:48 okay so yeah ocap is just the shortening of object-capabilities which is an attempt to capture the essence of the original idea put forth (hah!) by Dennis and Van Horn 18:14:49 --- join: travisb (~travisb@rrcs-162-155-170-75.central.biz.rr.com) joined #forth 18:14:55 --- nick: Keshl_ -> Keshl 18:16:58 KipIngram: turns out that references between fully encapsulated objects in memory safe systems where there is no static or ambient authority (no System.out.println or access to network or filesystem unless spefically given) are capabilities. 18:22:07 Zarutian: I just uploaded some braindump notes I had on my laptop from a while ago. https://hub.darcs.net/pointfree/cap-algebra 18:22:31 --- quit: wa5qjh (Remote host closed the connection) 18:22:33 I may not endorse everything in there today 18:24:32 I was trying to make it all work without the need for sealed, curtained memory areas and tpm chips. I want it to work without secrets. 18:25:17 pointfree: my browser crashed on me, just a sec 18:26:07 --- join: wa5qjh (~quassel@175.158.225.222) joined #forth 18:26:07 --- quit: wa5qjh (Changing host) 18:26:07 --- join: wa5qjh (~quassel@freebsd/user/wa5qjh) joined #forth 18:26:10 * Zarutian has the tabs-weed problem, they the tabs sprout like weeds ;-Þ 18:27:29 pointfree: well, the usual hardware trusted-computing-base I have in mind is pretty much very akin to Apple ][ or some such. Not this morass we have today. 18:30:46 pointfree: right, after having a glance at these notes I see you are probably in the domain of the design space like descriptor-machines or Plessly 2000 or some such. 18:33:25 Zarutian: There's the string capabilities idea -- start with string literals and attenuate as you constrain the dictionary with more definitions, and also, could we implement a partial function algebra in hardware where things forbidden by the string capabilities are undefined until they aren't. 18:34:22 I do not see how, note that might just be artifact of how I see these things. 18:37:34 the string-caps.txt idea reminds me of macaroons and what I had/have in mind in a system I am tentively calling Grórún 18:38:56 which is a punny name but describes it well. Gró can mean spore in Icelandic and rún is just rune. 18:41:21 as some composite runes had some mystical/magical/memetic? power plus I can homophun it with 'roon I find it fitting 18:41:41 (homophun -> homophonicpun) 18:43:01 those are chained hmac constructions like macaroons (but not quite the same format) that both designate things and convey permission/authority but also attenuations thereof 18:44:02 the other part of the idea are the spores of processes 18:44:52 now, this system assumes hierchical storage system of binary blobs, puck it, lets call it a file system. 18:45:37 each long lived process has a spore file which it can write anything it wants to remember in later incarnations 18:46:42 there is the requirement though that the first thing in the spore file is a rún/rune/roon designating the executable of the process 18:48:17 think of the spore file as a specialized quine shell script where the aforesaid first rune is like the hash bang line ( #!/usr/bin/zeforth ) ) 18:48:30 s/) )/)/ 18:49:57 now, in a special subdirectory in the root of the file system there is a one file that keeps the one 'secret' this scheme needs for it to work 18:50:32 that 'secret' is the initial hmac key of the local rúns 18:51:58 s/rúns/runes/ 18:54:36 pointfree: ^ the main difference I see from above and string-caps.txt is the spefic designations which I think is a key insight of ocaps. 18:55:31 now... I need to make tasks able to interact with one another 18:56:07 (I haven't implemented things like mutexes and condition variables yet) 18:56:25 (just got task sleeps working) 18:56:40 travisb: all running in the same memory space? do you have something like compare-and-swap atomic primtives? 18:56:46 (yes, I'm working on a multitasking Forth implementation) 18:56:56 they're all running in the same memory space 18:57:39 I could easily implement a compare-and-swap atomic primitive, because all my tasks run in one OS thread, and Forth primitives cannot be interrupted 18:57:57 --- nick: travisb -> tabemann 18:58:22 right, how complex do you expect these interactions to be? 18:58:24 damn you hexchat for not being able to keep nicks apart across servers 18:59:04 I think that just a mutex implementation and a condition variable implementation would do; if I wanted to be a little more general I could implement full semaphores in the place of plain mutexes 18:59:36 if I really wanted to get elaborate I could implement things like read/write mutexes 18:59:42 tabemann: well you could have, do not recall the correct name of the, ?sync ports? 19:00:55 brb 19:01:48 --- join: vxe (~vxe@31.153.239.35.bc.googleusercontent.com) joined #forth 19:02:07 basically a special variant of a VALUE where an task will auto suspend when it writes to it and other tasks will when they read from it reasume the suspended task 19:02:34 (or vice versa, that is reads suspends and writes resume) 19:03:04 a bit like the ports between comps in Green Array chips 19:06:09 on like MVars in Haskell 19:06:29 kinda 19:06:54 not familiar with those, sorry 19:08:07 an MVar is a variable that can be either full or empty 19:08:19 attempting to put a value in a full MVar blocks 19:08:34 as does attempting to remove or read a value from an empty MVar 19:09:00 it's essentially a single-item blocking queue 19:09:17 yebb, pretty much the same idea then 19:10:11 hopefully if I get a compare-and-set implemented I will be able to go on and implement such things in Forth 19:10:23 hmm.. how big are the task structures? That is the thing that keeps track of where in execution they are and if they are sleeping and such 19:11:09 if they are cheap then you might have lots of tasks and basically implement a FlowBasedProgramming ontop of Forth 19:11:09 compared to what exactly? (I don't know if my task structures are small or big or like) 19:12:03 my tasks are a bit heavyweight just because I allocated a good amount of space for my stacks and I keep separate data spaces for each thread 19:12:13 say bigger or around ten cells in size? 19:12:15 oh I see 19:12:39 and my data spaces are designed so they normally have a good amount of extra room in them 19:13:32 the separate data spaces are so that data space operations are thread-safe 19:16:12 --- join: siraben (~user@unaffiliated/siraben) joined #forth 19:16:39 I could make task lighter-weight though 19:17:56 well, I do not know your requirements and what tradeoffs you have 19:18:04 Hi all, I thought this would be the right place to share a project I've been working on; a Forth interpreter for the TI-84+ calculator series 19:18:22 Got a basic REPL working, compile mode to be added soon 19:18:22 https://github.com/siraben/ti84-forth 19:18:49 tabeman: I wrote the system I'm working on on a Macbook Air, with "tons of memory"by Forth standards. Just recently I decided I'd try to port it to a small Cortex M4 environment, and it caused me to realize I'd paid inadequate attention to memory efficiency. I'm working through it now preparing for the port, and part of that is going to be to make some improvements in how I manage available RAM. 19:19:53 siraben: sounds like the kind of environment Forth was originally intended for 19:20:33 tabemann: Yep. After you get the basic idea of Z80 assembly, it becomes straightforward to define new words 19:20:36 whereas my Forth is running on a x86-64 Linux system with 16 GB of RAM, such that allocating 64K to data space to a task sounds perfectly reasonable if not stingy 19:20:50 I should buffer my input to pass to KEY and WORD 19:21:08 tabemann: Exactly what I did - I've got a heap of 64k pages, and just grab one for whatever I need it for. 19:21:39 tabemann: I have around 765 bytes of available space after the initial HERE pointer, is that enough? 19:21:42 I think one of the changes I'll be making is to go to a much smaller heap page size and make processes able to just get a new page when they fill a small one up. 19:21:43 I made an elaborate input system to support executing code from the keyboard, from strings, and from files equally easily 19:22:11 --- quit: TeMPOraL (Ping timeout: 244 seconds) 19:22:13 --- join: lemonpepper24 (~lemonpepp@c-24-6-137-62.hsd1.ca.comcast.net) joined #forth 19:22:21 like there is a whole input stack in my Forth 19:22:55 siraben: depends on how much space you have to begin with 19:23:00 Hmm I believe there's another 768 bytes of available space elsewhere on the TI starting at SaveSScreen, so ~1500 bytes 19:23:13 tabemann: Most of the words are hardcoded in. 19:23:19 --- join: TeMPOraL (~temporal@hellsgate.pl) joined #forth 19:23:39 how many bytes does a compiled xt take up? 2 bytes? 19:23:45 The return stack is manually implemented and starts at the end of the free RAM space and grows downwards, so heavy recursive calls might blow new words 19:23:48 tabemann: xt? 19:23:51 siraben: hmm.. how do you represent the name portions of words? 19:23:56 execution token 19:24:36 anyways, my Forth is aimed for systems as small as, say, the Raspberry Pi - i.e. it really is meant for large systems 19:24:58 Like this: ... 19:25:23 I implemented it in C so that it would run on x86-64, x86, ARM, and ARM64 systems equally well without having to be rewritten 19:25:36 tabemann: well, I am using one right now to chat here ;-) (I hate fan noise) 19:26:06 So if you're defining a new word called "POTATO" it would take 2 + 1 + 6 + 1 + 3 + (number of words in POTATO * 2) 19:26:08 siraben: well you can omit that nul byte as you are already counting the length of the name 19:26:27 I agree with Zarutian 19:26:39 tabemann: Zarutian: Hmm, perhaps, but I have a PUTLN word that prints a nul-terminated string. 19:26:45 Oh ok I'll try that. 19:27:07 the only time you need that null byte is if your processor has alignment issues, and then the null would be there only if the word header and name take up an odd number of bytes 19:27:16 siraben: also if you want you can go the way of just having length and first three letters of each name you can save a lot 19:27:41 By the way I'm basing a lot off of jonesforth, which has served well 19:27:44 siraben: it shouldn't be hard to write a PUTLN word that takes, say, a counted string 19:27:44 ^ What Zarutian just suggested works surprisingly well. 19:27:55 But wow the x86 has a lot registers to work with 19:28:02 tabemann: Right. 19:28:14 KipIngram: IIRC POLYFORTH used this method? 19:28:19 siraben: but tha- mea-- you- wor-- can not be dif------ 19:28:33 I have an idea 19:28:38 length + hash 19:28:45 Oh but I lose the ability to write WORDS to see all the defined words 19:29:07 siraben: in the fol------ let---- 19:29:08 Well I'll move the return stack to location SaveSScreen + 767 19:29:23 Yeah, hash "spreads things" over the available space, but it's one way. 19:29:50 tabemann: Then I'd have to write a hash routine? 19:30:00 But in a system that small you're not going to have a particularly huge number of words. Count + first three is unlikely to give you collision problems. 19:30:05 it shouldn't be too hard to implement a hash 19:30:14 remember this does not need to be a cryptographic hash 19:30:17 Anyone here know Z80 assembly (specifically the TI-84 variant)? 19:30:34 siraben: the other way is to not use ascii and use someting like ITA.2 or infocomms inscii and stuff three letters per two bytes 19:31:03 remember that traditionally forths are case-insensitive 19:31:31 tabemann: Looks like the KnightOS kernel has a SHA1 routine https://github.com/KnightOS/kernel/blob/bd927397e7d35b50cea7553d3c07ca88901545d2/src/02/crypto.asm 19:31:43 you don't need SHA1 19:31:48 Righty 19:31:51 Right* 19:32:00 A CRC? 19:32:25 I'd think a CRC32 should do it 19:32:41 tabemann: I'll take a look at it. 19:33:03 Are there any other forth implementations for the TI calculators? I've tried finding for a while until I gave up and wrote this 19:33:07 siraben: but as you see you have some options on getting the size of words down 19:33:21 Zarutian: Right. 19:34:13 siraben: one thing to look at is refactoring common sequences in words into shared smaller words 19:34:34 So look, if you categorize all of your words by length, in each length bucket there are 17,576 possible three letter combinations. Granted, English naming will reduce that. But do you really have the problem you're trying to solve? 19:34:50 --- quit: dddddd (Remote host closed the connection) 19:34:57 KipIngram: Not yet, but I'll keep those tips in mind. 19:35:33 Yes, a well-loaded hip pocket is always good. :-) 19:36:07 I haven't implemented signed numbers yet, not sure how to go about doing that. 19:36:35 Unsigned seems good enough for now I suppose. 19:36:41 You mentioned how a hash would keep you from having "words" capability - the three-letter scheme limits you on that front too. You'd have to print the first three letters and * or something for the remainder. 19:37:19 siraben: big endian twos complement, assuming 16 bit cells you can detect minus numbers by anding them with 0x8000 19:38:24 KipIngram: I think I could just statically allocate several KB of space in my asm program and use that, then not worry about this 19:38:37 siraben: negating is simply XORing with 0xFFFF and adding one 19:38:59 But the TI will crash with the program counter exceeds 0xC000 19:39:03 Zarutian: Ah I see. 19:39:17 siraben: oh? you have servral KBs of program memory? 19:40:00 Zarutian: I haven't tested the several KB thing yet, but currently I know I have only around 765 bytes 19:40:08 Statically allocating an memory block should bring it up 19:40:16 I'll just test it out and see. 19:40:37 siraben: oh, so the TI device might not be as constrained as I thought 19:41:06 Well technically speaking I have 20424 bytes of free RAM currently in my TI-84 19:41:18 But that's for program storage, variables, lists etc. 19:41:29 So I could just have a 10 KB program 19:41:39 Oh actually this fixes a lot of storage problemsa! 19:42:03 siraben: how big do you generally have if nothing is saved on the TI? 19:43:05 * siraben hits *clear RAM* 19:43:13 24096 bytes 19:43:15 siraben: having 16 KibiBytes for Forth is often enough, specially if you can call routines that are provided in ROM 19:43:43 There's 218615 bytes of flash memory, but I don't know how to access it 19:43:52 Zarutian: Right. 19:44:03 Because my words are lists of 16 byte addresses 19:44:45 siraben: well, I suggest you read the manual and or the datasheet closely to see what the unit you have is capable of. 19:44:46 I wonder if it is more or less efficient to try to implement everything in Forth and have as few primitives as possible 19:45:10 That's a tradeoff. 19:45:13 Right, I'm not very concerned about speed, just about really how long it takes to define things in asm/forth 19:45:34 tabemann: well, I know eForth does have quite a few primitives. I have gotten down to about sixteen to eighteen primitives. 19:45:37 More Forth = more portable, but you are paying a performance penalty for every definition word, because of your NEXT overhead. 19:45:58 By the way I'm using it direct-threaded 19:45:59 Zarutian: That's pretty neat - I've never tried to do one with minimum primitives. 19:46:05 And the top of stack is stored in register BC 19:46:29 my Forth, Attoforth, has a lot of stuff that is implemented in Forth rather than being truly primitive 19:46:37 KipIngram: yeah and those primitives are quite primitive 19:46:52 mine has way more primitives than that though 19:47:14 since I have a whole multitasking system and IO manager system which are implemented as primitives 19:47:41 I could've implemented more of the multitasking in Forth were I to do cooperative multitasking but I opted for preemptive multitasking 19:47:52 --- quit: lemonpepper24 (Ping timeout: 260 seconds) 19:47:56 --- quit: wa5qjh (Remote host closed the connection) 19:48:08 Generally speaking, if I felt a word was likely to be used frequently in the applications I may write, and it was subject to a simple primitive implementation, I did it as a primmitive. 19:48:10 and the IO manager is needed so that tasks can have blocking operations without blocking all tasks in the process 19:48:30 But for the compiler and interpreter stuff that just "gets the applications launched" I tried to make things Forth as much as possible. 19:48:49 I have two interpreters 19:49:01 I'm surprised it's pretty hard to find compilers for the TI calculators 19:49:04 one which is a hardcoded interpreter in C, for bootstrapping the system 19:49:07 None came up, everyone seems to write in asm 19:49:13 KipIngram: UM+ AND XOR 1LBR 1+ @ ! DUP DROP SWAP SKZ >R R> EXIT are all the primitives I managed to do in the end 19:49:30 Oh, thanks for that. 19:49:32 and another interpreter in Forth, for actual normal execution 19:49:42 What are 1LBR and SKZ? 19:50:25 KipIngram: 1 LeftBitRotate and SKip if Zero 19:50:28 --- join: wa5qjh (~quassel@freebsd/user/wa5qjh) joined #forth 19:50:32 the hardcoded interpreter is pretty simple, and can only execute from a string 19:50:38 Neat. 19:51:04 whereas the interpreter written in Forth can execute interactively, from files, and from strings 19:51:06 So that SKZ is your only conditional? 19:51:23 I was having a discussion with Dave the other day about minimum conditionals. 19:51:24 KipIngram: yes 19:51:31 I have 0BRANCH and BRANCH so far 19:51:38 I opted for BRANCH and ?BRANCH 19:51:48 (?BRANCH is what you call BRANCH) 19:51:52 *0BRANCH 19:52:15 I see. 19:52:17 (I implemented all my other flow-control operations in Forth based on those two) 19:52:26 Right, jonesforth does that, makes sense I think. 19:52:42 KipIngram: yeah, I made BRZ out by using ?: which in turn uses SKZ 19:53:08 There's an IOCCC forth that uses a handful of primitives to define everything 19:53:25 I think the whole "minimum primitive" thing is pretty fascinating. 19:54:03 I'm aiming for a reasonable number of primitives rather than minimum primitives 19:54:04 KipIngram: well I found a way to get rid of SKZ but it is just too damn slow 19:54:38 https://www.ioccc.org/1992/buzzard.2.design 19:54:51 I saw a paper once on an 8-instruction setup. Not Forth, but you could have based one on it. 19:55:09 There are 12 primitives, everything else is defined in terms of that. 19:55:55 --- quit: wa5qjh (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) 19:56:08 well I am off to bed 19:56:08 You can build whole computer from NAND gates, so I've always wondered if NAND and SHIFT (or ROTATE) might bring you close, if performance just wasn't an objective at all. 19:56:17 Night - rest well. Me too soon. 19:57:10 g'night 19:57:16 Minecraft would be a good target for Forth 19:57:21 Well, I guess you'd need DUP and some other things like that. 19:57:42 Because that NAND computer would have fanout as well. 19:57:44 8 instructions is called Brainfuck 19:57:53 If someone wrote a BASIC interpreter for Minecraft (https://www.youtube.com/watch?v=t4e7PjRygt0), surely it would be much easier to create Forth 19:59:16 well, I'm going to get kicked out of this coffee shop soon (it's about to close), so I'll be back on later once I'm home 19:59:47 Be safe. 20:00:20 Why is Forth not used more? It seems like a perfectly reasonable language, no? 20:00:39 --- join: wa5qjh (~quassel@freebsd/user/wa5qjh) joined #forth 20:00:53 Well, one of its strongest offerings is how RAM efficient it is. 20:01:02 I think that sort of lost its meaning in the years after Forth was developed. 20:01:12 Plus it's postfix, and most people aren't accustomed to that. 20:01:44 On the other hand, my first programming experience ever was on an HP-41CV calculator, so I got "stack think" burned into my brain early on, before anything else tainted me. 20:02:00 Also, it doesn't support the whole "library thing" as well as some other languages do. 20:02:30 And finally, I think the Forth community has made things hard for itself by often adopting a rather "superior" attitude. 20:02:31 RPN isn't that hard, perhaps it's because I've been using the Emacs calculator a lot 20:02:48 We tend to think that Forth is better at everything, and look down on other languages a little. 20:02:54 People in other camps don't react well to that. 20:03:02 Forth is very good for embedded, that's for sure. 20:03:10 Those are just the things I've thought of to explain "Forth neglect." 20:03:26 Yes, and embedded was the backbone of my career. 20:03:32 Yeah I wouldn't program a web server in Forth, unless I'd like to rewrite everything 20:03:35 So I've always had a tremendous appreciation for it. 20:03:43 Then again, it's just libraries all the way down 20:04:10 I think that to write really good Forth you need to think deeply about your problem, and understand it thoroughly. 20:04:21 It's not really a "code monkey" language. 20:04:48 --- quit: tabemann (Ping timeout: 272 seconds) 20:05:17 The big corporations want to be able to throw 10k programmers at a monster project. 20:05:46 It's like writing asm, I suppose. 20:06:15 I should confess here I don't really have strong training in team programming. I've managed software teams, but my real expertise is more "small system" oriented. 20:06:54 I have a professional CS acquaintance who likes to label Forth as a fancy macro assembler. 20:07:06 I don't think that really quite fits as well as he likes to think, but I also see his point. 20:07:51 It's also really nice to have something you understand fully from the top down. 20:10:14 I don't have to worry about aligning bytes, right? 20:10:25 jonesforth had quit a bit of that 20:10:27 quite* 20:13:09 So what do folks here use Forth for? 20:16:22 Yes, that's the biggest thing for me - that ability to understand every shred of it. 20:16:40 That depends on your underlying processor, I think. 20:17:13 I was absent from the channel for a long time, and have only gotten back on recently. 20:17:25 Years go when I hung around here it would go for weeks with no one saying anything. 20:17:29 Much more fun these days. 20:17:39 So I don't know exactly what everyone does with it. 20:17:52 In some cases it's just a hobby, and that's part of it for me. 20:18:18 The one I'm working on right now I hope to deploy on an embedded system "core circuit" that I then use to build things around. 20:18:27 Lab instruments, industrial control, that sort of thing. 20:18:56 I have a "gleam in my eye" toward commercial applications, but we'll see if anything ever comes of it. 20:22:40 I've got this little $15 Cortex M4 board I bought recently. 20:22:52 120 MHz, 32-bit processor, 192k RAM, 512k flash. 20:23:10 Basically equivalent in RAM and mass storage to the first IBM PC I ever owned, but 20x the clock speed. 20:23:25 I'm interested in seeing how good of a Forth "operating system" I can set up for that guy. 20:24:06 My Forth is designed to support multiple processes, multi-threading, etc. I'd like to be able to open multiple windows sort of like with screen. 20:24:24 I'm thinking in terms of cooperative multi-tasking rather than pre-emptive, though. 20:25:06 And I've got it in mind that it will have Linux-style I/O re-direction, command history (that already works, actually), and things like that. 20:25:10 Yeah this channel was silent for a long while 20:25:42 Yeah, a Forth machine would rival the Lisp machines! 20:25:59 Zarutian pointed me at flow-based programming; I think that will be a good fit. 20:26:16 Multiple processes collaborating on a problem, streaming information to one another. 20:26:17 What makes Forth great is that it alleviates having to name variables. 20:26:31 ^temporary variables, that is 20:26:32 I already had the whole stream thing in mind, but he suggested msgpack for the format of that, and I think it looks good. 20:26:47 Also planning a source code compression system that I think will get me a factor of 5-6 compression. 20:26:51 Although I'd like to see if I could make Forth have some "functional" elements to it 20:26:54 Such as closures 20:27:18 and words like COMPOSE which take the top two elements of the stack (closures) and makes a closure that composes them 20:27:20 Some of the guys here talk about that (closures) - I'm not sure exactly what it means. 20:27:32 Have you experience with functional programming? 20:27:35 I'm a hardware guy by education. 20:27:38 No, not really. 20:27:43 Ah, hm. 20:27:47 Just a very vague notion of what it's about. 20:27:53 It's like procedure calls 20:28:00 We have that in Forth, concatenation is composition 20:28:06 I think of it as being more "mathematically rigorous" than other types of programming. 20:28:12 Where you can prove correctness, and things likethat. 20:28:13 e.g. : quadruple double double ; 20:28:36 in a language like Scheme, it would be (define (quadruple x) (double (double x))) 20:28:48 But it's also useful to define new closures with lambda 20:29:23 Forth has these things but under different names. 20:29:34 --- quit: pierpal (Quit: Poof) 20:29:49 --- join: pierpal (~pierpal@host102-235-dynamic.181-80-r.retail.telecomitalia.it) joined #forth 20:30:55 I spent most of this past week overhauling my assembly source to make it more portable. 20:31:05 KipIngram: I think if you take the imperative state-changing parts of Forth it would be easy to prove correctness as well 20:31:09 Switched to macros for a lot of things, installed register aliases, etc. 20:31:47 I've now got a 3200 line assembly source that I think I should only have to "port" about 500 lines of - the rest should "just work." 20:32:08 I love the fact that in Forth every hard has a meaning, at first I thought ; did nothing, for instance, because so many languages treat it like that. 20:32:12 every word* 20:32:31 Right. 20:33:05 I added some extra "; functionality" to mine - I can return from the middle of a word, do conditional returns, and return more than one level. 20:33:23 I've now started writing code that has control structures that span multiple call/return levels. 20:33:32 It's like gaining access to an extra "dimension." 20:33:35 KipIngram: How long have you been writing Forth? 20:33:47 Oh, gosh. 20:33:50 --- quit: dave9 (Quit: one love) 20:33:53 --- quit: pierpal (Read error: Connection reset by peer) 20:33:56 Off and on since college, 35 years ago. 20:34:10 More intensely some times than others. 20:34:10 Ah, I see. 20:34:19 I've been working on this implementation since early this year. 20:34:28 Writing it with nasm on MacOS. 20:34:38 Do you have a repo up? 20:34:47 No, not ready to share it yet. 20:34:48 I'm on macOS as well, it would be nice to see an assembly forth 20:34:50 Ah I see. 20:34:52 I do plan too, but later. 20:35:08 An interesting target would be the Emacs bytecode, because Emacs is more or less a VM 20:36:03 Has anyone here implemented arbitrary precision arithmetic in Forth? 20:36:33 I don't know for sure. I've chatted with dave9 about it some, but only sort of "in theory." 20:36:55 This is impressive: https://www.ticalc.org/archives/files/fileinfo/323/32326.html 20:36:59 I have the program in my calculator 20:37:07 It's a stack calculator with arbitrary precision math 20:37:21 Written in asm as well, so yeah it's possible in theory. 20:37:23 Nice. 20:37:33 I'm very interested in numerical applications. 20:37:36 It would be easier in Forth I suppose, but not as fast. 20:37:55 I've done a lot of scientific programming over the years. 20:38:04 EM field modeling in rotating machinery and that sort of thing. 20:38:17 Interesting. What tools/languages do you use? 20:38:38 Well, early on in my career FORTRAN. Later I've mostly used C. 20:39:03 Ah, C. 20:39:22 --- join: pierpal (~pierpal@host102-235-dynamic.181-80-r.retail.telecomitalia.it) joined #forth 20:39:40 I don't know what to make of that language. There's a lot of crazy stuff especially with undefined behavior 20:39:52 Last couple of years at work I've done fair bit of Python. 20:40:13 I've heard Rust mentioned several times in various places, apparently as an alternative to C 20:40:13 I've never been in a position to worry about portability. 20:40:30 If I know what it's doing right now with the compiler I'm using on the computer I have in front of me, I'm happy. 20:40:34 Do you do embedded systems? 20:40:52 Not in the last few years, but that is where my primary expertise lies. 20:40:56 The hardware and the software. 20:40:59 I see. 20:41:29 Python is a good language. I believe Guido didn't want a lot of functional programming stuff in it though 20:41:33 I was particularly good with digital logic back in the early days, pre-Verilog. 20:41:45 When you had to "do it yourself" with schematics and so on. :-) 20:42:49 These days I feel like they're trying to turn hardware design into software design. :-) 20:43:25 How do you mean? 20:43:35 Having languages to express hardware designs? 20:44:01 Well, expressing the hardware design in terms of what you want to happen, instead of how it is accomplished. 20:44:08 "Behavioral" vs. "structural." 20:44:14 Ah, more declarative 20:44:47 It would be interesting though, to produce hardware by program synthesis 20:44:58 For me, with a digital circuit, knowing what each gate and flip flop is doing brings the same satisfaction that we talked about before, re: Forth making it possible to understand everything involved. 20:45:08 What do you use for a digital logic simulator? 20:45:26 ;-) They didn't exist when I was at that part of my career. 20:45:31 Well, they did, but they were new and expensive. 20:45:41 I designed my stuff, got a prototype, and tested it. 20:45:46 Logic analyzer and so on. 20:47:43 Later on I moved to management - was VP of engineering for two different small companies here in Houston. Then IBM bought a company I was working for and imported legacy IBM managers, and these days I do performance testing on our flash-based storage products. 20:48:31 NAND flash is crap. But we make storage systems out of it that have enterprise grade reliability. 20:48:37 It's like building armor out of tissue paper. 20:48:42 I see. 20:49:12 --- join: tabemann (~travisb@2602:30a:c0d3:1890:ccf2:f6ec:5a58:6b88) joined #forth 20:49:23 I used to think that 10KB was nothing, but learning Forth has made that 10KB seem absolutely gigantic 20:49:49 Yes! :-) 20:50:05 It's amazing how wasteful so many other languages are in terms of space 20:51:08 Yes. 20:51:13 So much bloat. 20:51:18 --- quit: pierpal (Read error: Connection reset by peer) 20:51:32 --- join: pierpal (~pierpal@host102-235-dynamic.181-80-r.retail.telecomitalia.it) joined #forth 20:51:39 Starting FORTH was a good resoucre 20:52:03 Check out "Thinking Forth," by Leo Brodie. 20:52:06 It's available online. 20:52:27 Yeah, but it doesn't have much Forth code? Or is it more about the philosophy? 20:52:35 Yes. 20:52:44 It's important philosophy, though. 20:53:49 How does one go about learning hardware? I'd like to simulate a computer from scratch, like everything 20:54:02 Don't know where to start 20:55:12 One second - my wife's talking at me. 20:57:50 So, if I were going to teach someone hardware (digital / computer hardware), I'd start with logic gates, show how they can be arranged to form flip flips, then get into state machines, and then attack a basic simple CPU architecture. 20:59:20 Really what it all comes down to is that once you have flip flops (thus registers), you now can include a clock in your design. 21:00:12 KipIngram: Have you heard of Powder Toy? https://powdertoy.co.uk/ 21:00:18 Essentially on each clock the flip flop outputs change, and those changes have to propagate through all of the gates between the flip flop outputs and inputs before the next clock edge comes along, with setup and hold times considered. 21:00:21 This might seem random, but there's a lot of "hardware" stuff in it 21:00:25 Now, hven't heard of that one. 21:00:28 No 21:00:36 People build computers in it such as https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=22833 21:00:46 With its own assembly language and so on 21:01:05 Maybe I should start there and see how to build up logic components 21:01:45 As far as simulating such things goes, a naieve simulator would update everything on every clock. The good ones will start with just the outputs that change, and follow the changes as they fan out through the ciruit. 21:01:57 Stuff that doesn't change on a given clock edge won't be given any consideration. 21:02:14 Right. The computer in that game save runs at one cycle per frame 21:02:27 And a simulator can also work with three-value logic: true, false, and "in between" (X). 21:02:35 Ah I see 21:02:42 You can make truth tables for the basic logic function that consider all three values. 21:02:45 So I'd have to use an actual realistic simulator? 21:03:27 Like an OR gate is output 0 only if all inputs are 0 - if any input is 1, the output is 1, but if no input is 1 and any input is X, the output is X. 21:03:42 Well, if you want an actual realistic simulator, yes. :-) 21:03:49 I mean simulation 21:04:12 But as I noted earlier simulation isn't my strong suit. 21:04:17 Would a RAM with 4096 16-bit cells be enough for a Forth? 21:04:37 For a basic simple Forth, probably y es. 21:04:38 yes 21:04:44 Once this calculator Forth is done, it would be fun to write a Forth for that in-game computer as well 21:04:52 In the 16-bit days it was common for a full-featured Forth to run about 8k. 21:04:55 It has I/O, registers, and everything 21:04:57 Which is right at your limit. 21:05:26 I'm sure you could put a lean one in 8k with a bit of room to work with it. 21:06:35 My Forth is fairly complete at this point, and it uses 32-bit internals (64 bit stacks and variable width), and it's around 15k right now. 21:06:56 It's nice that some video games have seen the creation of microcomputers 21:06:57 If it were a 16-bit internals Forth, it would be roughly half that. 21:07:02 I wonder how much space my Forth would take up if I whittled down the amount of space allocated to each task 21:07:11 KipIngram: Which chip is this on? 21:07:27 The working version of it right now is on a Macbook Air. 21:07:44 I'm looking at doing a port to the SAMD51G19. 21:07:57 That's a Cortex M4 system-on-a-chip. 21:08:31 I plan to store the definition lists as 16 pointers, but I'll left-shift them 2 bits to let them span the whole 192k RAM space. 21:08:33 hmm I should get a smaller system just to try to port Attoforth to it 21:09:12 (despite its name, Attoforth is a "big" Forth) 21:10:15 (well, in the systems that it targets; it's definitely smaller than the likes of gforth) 21:11:36 What are some good forth implementations? 21:11:48 I currently use gforth 21:11:51 One of the easiest to get your hands on is GForth. 21:11:54 ^ Yes. 21:12:23 But on macOS if I type "see dup" or any other word not defined in Forth it freezes 21:12:26 one I played around with, which is meant for embedding in C programs, when I was a teenager is ficl 21:12:48 ficl is used in FreeBSD in the bootloader 21:13:02 There's one out there called pforth that's written in C and I've found to be very easy to build. 21:18:05 If you want to do some interesting Forth reading poke around here: 21:18:08 http://www.ultratechnology.com/index.html 21:18:18 Lots of stuff from Chuck Moore and some of his close associates. 21:19:36 I'm going to head on to bed - glad you guys joined us this evening. 21:19:49 KipIngram: Night! 21:24:01 --- join: lemonpepper24 (~lemonpepp@c-24-6-137-62.hsd1.ca.comcast.net) joined #forth 21:26:10 I'd want to do an assembly forth, but there's no assembly I am really familiar with, and I'd really like to have a Forth that works on all of x86-64, x86, ARM, and ARM64 without having to rewrite for each, which is why I'm sticking with C 21:26:56 even though I get the impression that a handwritten assembly Forth would probably be faster than my C Forth 21:27:16 Ah. It's strange because I couldn't really think about how to write a Forth without doing it in asm 21:27:28 of course my C Forth is slow to begin with because I put lots of stack range checks 21:27:41 even though I designed it so I could easy comment them out 21:28:06 Oh, I have no stack checks, haha. I just save the stack pointer and return address at the program start and on exit restore them and jump to the program return address 21:28:06 * tabemann didn't want his Forth to segfault whether it attempted to go outside the range of the stacks 21:28:52 I do have a stack underflow check, kinda. I push the value 9999 onto the stack and check if the top element of the stack is 9999 at the end of the program, if not, something probably left something on the stack or popped too much 21:28:57 tabemann, it depends. can you write assembly for the those architectures better than your C compiler can? 21:29:06 good point 21:29:14 I don't have any C compiler for my target 21:29:25 the main advantage is that I wouldn't be bound to C calling conventions 21:29:38 but rather could make up my own calling conventions that would better suit the needs of Forth 21:29:47 siraben, what does it run on? 21:29:48 tabemann: Right. Depends on the target. 21:29:52 the TI-84 calculator 21:30:00 oh wow 21:30:04 Z80 assembly? 21:30:06 MrMobius: https://github.com/siraben/ti84-forth 21:30:10 See forth.asm 21:30:16 Not complete yet, but a basic REPL in place 21:30:34 MrMobius: Yes, Z80 assembly. 21:31:08 Oh the joy of implementing a lookup table to convert key codes into characters: https://github.com/siraben/ti84-forth/blob/master/forth.asm#L764 21:31:58 MrMobius: Do you have a calculator at hand? 21:32:19 Perhaps you could compile the program and try it out, if you wanted. 21:32:44 I should add a disclaimer that segfaults cause a RAM clear on the calculator 21:33:02 siraben, I got a TI-89 in 2002 when I first got into calculators. the only Z80 machine I have is a TI-86 I bought for a hardware project 21:33:29 so all the compilation is on the pc side? 21:33:41 The macro expansion, pre-processing is 21:33:58 I use this assembler: https://github.com/alberthdev/spasm-ng 21:34:15 have you implemented an interactive mode on the calculator or do you intend to? 21:34:19 MrMobius: I have 21:34:22 See the REPL screenshots 21:34:35 I'm currently reworking input to make it buffered 21:36:58 neat 21:37:46 Yeah I couldn't find an existing Forth for my calculator 21:37:56 But I love the language so much I couldn't resist 21:38:09 sounds like a good project for a calculator 21:38:29 I made an RPN program for my Casio AFX 2.0 with key stroke programming 21:39:18 Forth is one of those languages that any decent programmer should be able to implement; I'm surprised there arent' more TI-84 Forths out there 21:39:27 never a real forth though :P 21:39:44 tabemann: Yeah, given that there's an active hacking community around TI calculators 21:39:47 ticalc.org 21:39:59 https://ticalc.org 21:43:12 Not sure if people know about this resource already, but worth a read: http://www.bradrodriguez.com/papers/moving1.htm 21:45:20 yeah, I read that 21:45:35 Any other recommendations for resources? 21:46:06 I once saw a number of pages on someone implementing a Forth in F# of all things 21:46:26 and as absurd as the concept seems, the pages were actually informative about things 21:46:34 like how to implement control flow constructs 21:46:51 up next: a Forth in Haskell 21:46:52 transforth was the name of it 21:47:02 I actually thought of implementing Forth in Haskell 21:47:12 A Forth in Haskell would be a little tricky to implement, I suppose 21:47:35 but then it seemed nearly impossible, without essentially implementing an emulator in Haskell for an emulated environment on which Forth would be implemented 21:47:36 But you could use State monads to pass the stack around and all the registers of the Forth VM 21:47:44 Right. 21:47:52 Basically writing a VM 21:48:01 the problem is that Forth assumes direct access to the address space 21:48:26 which is why implementing Forth in any language higher level than C is hard 21:48:47 I can barely think of how to do it in C, but ASM makes it easier in fact. 21:49:10 Could one write a C compiler in Forth? 21:49:19 You could theoretically bootstrap from asm -> Forth -> C 21:49:26 I don't see why not 21:52:37 --- quit: pierpal (Remote host closed the connection) 21:52:56 the question I have is why would you want to 21:53:24 There are projects to create a chain of trust for compilers 21:53:44 So it makes sense in some contexts, to have a trusted, reproducible C compiler 21:54:34 tabemann: http://git.savannah.nongnu.org/cgit/stage0.git/tree/README 21:54:40 and its Forth stage http://git.savannah.nongnu.org/cgit/stage0.git/tree/stage2/forth.s 21:59:05 is trying to make forth prefix like trying to make lisp parenthesis-free? 22:00:06 cobax: Where'd you get that idea? 22:00:39 siraben: I just thought it would be the equivalent pet-peeve ? 22:01:18 Lisp without parens isn't Lisp. Forth with prefix still could be a Forth. 22:01:49 Because say in 1 + 2, + could be an immediate word which takes the next number, pushes it on the stack and adds the top two elements together. 22:03:29 but that's infix ;) 22:03:40 Oh sorry you mean prefix 22:03:54 Then + could be an immediate word which reads two numbers, pushes them and does the addition 22:03:57 + 2 3 22:04:06 Of course, it would be hard to read 22:04:47 And you could modify ( to do some stuff preserving operator precedence 22:04:59 ( + 2 ( * 3 5 ) ) . => 17 22:06:16 Then why not add things like ( defvar a 6 ), ( defun foo ( a b ) ( + a b ) ) 22:07:31 hmm I see. very interesting :) 22:08:53 siraben: what is the easiest way you know to explain (or introduce) the concept of interpretive threaded code? 22:09:09 Interpretive? 22:09:19 You mean code as a list of addresses? 22:10:09 this: http://wiki.c2.com/?ThreadedInterpretiveLanguage 22:11:10 Oh. There's many variants of threading. 22:11:20 The best explanation I've seen is at http://www.bradrodriguez.com/papers/moving1.htm 22:11:48 You would need to know what pointers are and roughly how assembly language works 22:12:08 Basically, instead of writing do_thing: call a \ call b \ call c, you store the addresses of the routines a,b and c 22:12:14 so you have do_thing: .dw a,b,c 22:12:51 Then you can "run" do_thing, by using the values a,b,c as the list of instructions to "execute", or in this case, jump to. 22:13:49 The differences between the threading depends on if your calls to a,b,c might themselves be other Forth words also defined as an array of Forth word addresses, and so you need to take the return stack into account so you can return from a subroutine call 22:17:53 I think I'm starting to get it. I will read through your reference and come back if I have a question. thank you! 22:18:29 The best way to get it is to step through the codes yourself. 22:19:05 No problem. 22:30:46 --- quit: jedb (Ping timeout: 246 seconds) 22:43:58 --- join: jedb (~jedb@199.66.90.209) joined #forth 23:45:39 --- quit: lemonpepper24 (Ping timeout: 252 seconds) 23:59:59 --- log: ended forth/18.09.22