IRC channel logs

2022-06-24.log

back to list of logs

<GNU\Andrew>Noisytoot: Well, you lead me here through thr Website :)
<GNU\Andrew>An option for compiler writers: Write a manual describing how the compiler is compiled, and let the user compile the compiler
<GNU\Andrew>Which would only really work for minimal low-level languages but is good enough for my purposes
<GNU\Andrew>Theoretically no manual is really needed as they could read the source if it's well-written (and should be)
<GNU\Andrew>That's also the only way to completely avoid the bootstrapping problem
<stikonas_>GNU\Andrew: that's a lot of work for user
***stikonas_ is now known as stikonas
<unmatched-paren>why would that only work for minimal low-level languages?
<stikonas>and then it's not just compiler, you need to assemble and link it
<GNU\Andrew>But it's really the only way that doesn't depend on distributing prebuilt binaries
<stikonas>yes, but e.g. GCC is just too big
<GNU\Andrew>stikonas: Yup; being an assembler and linker is easier than being a compiler ... yeah
<stikonas>stage0-posix is basically doing something like that but for small compiler
<unmatched-paren>Anyway, how do you build GCC without GCC
<GNU\Andrew>unmatched-paren: Practically*
<unmatched-paren>a manual won't help there
<GNU\Andrew>unmatched-paren: Run through the GCC code, calculating things yourself, writing object files with a hexeditor
<stikonas>unmatched-paren: manual would help, you can theoretically compile it manually
<stikonas>but calculation is infeasibly long
<GNU\Andrew>gcc is too bad
<GNU\Andrew>too big, yeah
<unmatched-paren>GNU|Andrew: Oh, that's what you mean!
<GNU\Andrew>it's a \, not | btw
<GNU\Andrew>(my nick)
<GNU\Andrew>It makes sense to me (somewhat a purist i guess)
<unmatched-paren>It shows as a | for me
<GNU\Andrew>unmatched-paren: bad client :)
<stikonas>well, cc_x86 is much smaller but we build it with M0 which is again smaller
<unmatched-paren>Pretty much every compiler would be infeasible to build manually
<unmatched-paren>That'd perhaps work with e.g. M2 and cc_*
<stikonas>well, there cc_* would work
<unmatched-paren>but once you get to practical languages, it would just be too much
<stikonas>but it's easier to do it in steps
<stikonas>hex0->hex1->hex2->M0->cc_x86
<stikonas>for basically the same reasons why compilers don't build binaries
<GNU\Andrew>Assemblers would be easier, and probablytestuder-and-andrew's-new-language as it's very low level
<GNU\Andrew>stikonas: yup
<stikonas>compilers usually spit out assembly rather than machine code
<unmatched-paren>Well, I guess it's more often LLVM/QBE IR really
<stikonas>GNU\Andrew: well, try building https://github.com/oriansj/stage0-posix
<stikonas>well, IR is spit out just for optimization
<stikonas>for non-optimizing compiler IR is useless
<unmatched-paren>and portability
<stikonas>well, I guess IR lets you write a few languages and only worry once about assembly architecture
<GNU\Andrew>ill try after i wake up tomorrow
<stikonas>basically we can build GCC from 357 byte hex linker and 757 byte trivial shell
<stikonas>(assuming POSIX kernel)
<unmatched-paren>and a ~3KiB trivial kernel
<stikonas>well, that is partially true
<stikonas>we can build M2-Planet with 3KiB kernel
<stikonas>but not GCC
<unmatched-paren>oh, fair enough
<stikonas>we need another simple kernel written in C
<unmatched-paren>mhm.
<stikonas>actually in M2 subset of C
***stikonas_ is now known as stikonas
<oriansj>GNU\Andrew: well I was tempted to write a book on bootstrapping but I was hoping to solve the kernel problem fully first. (Time being sparse as it is for me)
<oriansj>based upon stage0-posix of course (probably doing one architecture per book) and covering everything from how to hand toggle in the first bits into memory all the way until you build M2-Planet and a kernel capable of running the remaining steps for the journey to Linux/GCC/Guile
<oriansj>with fun little bits like how to hand make a filesystem, manually populate it with source code for our binaries to build and of course details on all of the magic, how and why.
<oriansj>Oh and have a Media set of all of the source code needed to bootstrap everything for all architectures, along with all of the source code in Gnu Guix's package list
<oriansj>and after we solve the bootstrapping hardware/libre-lithography problem, I'll add book(s) that would cover everything one would need to make the chips to run the code in the previous books
<oriansj>and after we solve the matter compiler problem, I'll either be dead or pulling a Donald Knuth and add even more to what I thought would be a limited set