IRC channel logs

2022-04-29.log

back to list of logs

<theruran>has anyone bootstrapped from hex0 to a Forth already?
<j-k[m]> https://bootstrapping.miraheze.org/wiki/Bootstrapping_Specific_Languages#FORTH
<stikonas[m]>theruran: https://github.com/oriansj/stage0/blob/master/stage2/forth.s
<stikonas[m]>But nobody managed or wanted to make any use of it
<stikonas[m]>So instead we have cc_* C compilers written in assembly
<stikonas>fossy: by the way, how does xbps handle conflicts between packages (e.g. if we already have some file installed). Does it simply overwrite files or errors out?
<theruran>stikonas[m]: what was the suggested path using Forth? I found a barebones Scheme written in Gforth that is licensed GPLv2. seemed easy to audit: https://git.hackers.town/theruran/Scheme-in-Forth
<stikonas>theruran: there is no suggested path
<stikonas>right now we don't even have forth in stage0-posix, only in stage0
<theruran>hm alright. lemme sync stage0 repo and give it a try
<theruran>I see
<stikonas>and that barebones scheme has the same problem as forth, they are both very simple, so can't bootstrap anything in out current bootstrap path. Both will need extending
<stikonas>that lisp implementation won't be able to run mescc
<theruran>so this forth.s cannot take file input
<stikonas>well, it takes one tape in and one tape out
<stikonas>there are no files on baremetal
<theruran>got it
<stikonas>for concept of file, you need kernel and that's stage0-posix
<stikonas>but then you also need to implement common syscalls in forth if you want to port it to posix
<stikonas>i.e. printing stuff, file input/output, executing other calls
<theruran> https://github.com/oriansj/stage0-posix :D
<stikonas>this would make forth quite a bit bigger
<stikonas>and we do have cc_x86 anyway
<theruran>that's the one written in M2-Planet?
<stikonas>no, that's the one written in M0 assembly
<stikonas>it's quite similar to M2-Planet in terms of algorithm
<stikonas>though a bit simpler
<stikonas>M2-Planet is then written in C
<stikonas>the good thing is that they can reuse the same C library (M2libc)
<stikonas>as I've said, for forth, you would need to write your "forth library"
<stikonas>that implements stuff like file i/o, process calls, etc in assembly
<theruran>right. sounds like a lot of work :) I've never written Forth before. I was curious, and maybe I'll get into it
<theruran>fun path to go down
<stikonas>well, if you want to learn Forth then maybe
<stikonas>but in terms of benefit, it would be slower than C
<stikonas>and might even end up harder to maintain due to lack of forth programmers
<theruran>how can I test stage0 forth? I don't see a test tape
<stikonas>you can run it in vm
<stikonas>build stage0-vm and then it's something like ./vm ROM tape1 tape2
<stikonas>but I don't think we have any test inputs written in forth for tape1
<bauen1>stikonas[m]: the conflicts between packages would interest me too, an example would be the automake packages (at least the two i encounter early on have a conflicting automake binary)
<stikonas[m]>bauen1: that's kind of the reason I asked
<stikonas[m]>Although early packages are not xbps based