4 ms·
I would think that making a minimal forth or lisp would be the better path towards that goal, then use that to bootstrap a c compiler.
by adastra22 5y ago
I would think that making a minimal forth or lisp would be the better path towards that goal, then use that to bootstrap a c compiler.
- pabs3 5y agoA recent comment from LWN on that note: https://lwn.net/Articles/893608/ https://lwn.net/Articles/893608/ I asked about this on their IRC channel and got this response from oriansj: Well we did bootstrap a FORTH from hex: https://github.com/oriansj/stage0/blob/master/stage2/forth.s https://github.com/oriansj/stage0/blob/master/stage2/forth.s and we did bootstrap a garbage collecting Lisp from hex: https://github.com/oriansj/stage0/blob/master/stage2/lisp.s https://github.com/oriansj/stage0/blob/master/stage2/lisp.s but if you notice: https://github.com/oriansj/stage0/blob/master/stage2/cc_x86.s https://github.com/oriansj/stage0/blob/master/stage2/cc_x86.... writing a C compiler in assembly that supports structs, unions, arrays, inline assembly and a bunch more was done in less than 24 hours by an inexperienced C programmer. Who then after started doing bootstrapping speed runs to demonstrate how trivial of a problem it is to implement that level of functionality in a C compiler. In the decades for which Lisp and FORTH existed, why didn't they solve such a trivial problem? Or better yet, now that you can see how it is done. Could anyone actually produce a C compiler with the same level of functionality in Lisp or FORTH in the same amount of time (or less?). It is easy to talk a big game and words are cheap, we have the entire cc_* family of C compilers written in assembly for multiple architectures and in even cross-platform arrangements. If your language was any good at bootstrapping you'd be able to beat that. Then show your language written in less lines of assembly than cc_x86 to prove the point. Please prove me wrong with working code. Assembly and C have working code good enough to bootstrap GCC+Guile+Linux for more than a year now. https://github.com/fosslinux/live-bootstrap https://github.com/fosslinux/live-bootstrap https://github.com/oriansj/stage0-posix https://github.com/oriansj/stage0-posix It is time for Lisp and FORTH to either deliver or learn to stop talking about something they never were good at in the first place and learn to admit Assembly and C won not because "worse is better" but because objectively they are better languages for bootstrapping new and better tools.
- ducktective 5y agoI miss these technical provocative challenges. Nowadays, everyone tries to "not offend" people.
- samhw 5y ago'Nowadays' as opposed to ... 7 hours ago?
- adastra22 5y agoI mean there are Forths that fit inside a boot sector (<512 bytes). My reading of the goal was a minimal kernel of code from which the larger system can be bootstrapped. Here’s a C minimal compiler in forth for the next stage: https://groups.google.com/g/comp.lang.forth/c/lBYFfVJ1qhc/m/BxvaTHCX_JgJ?pli=1 https://groups.google.com/g/comp.lang.forth/c/lBYFfVJ1qhc/m/...
- mypalmike 5y agoThat an inexperienced C programmer wrote what appears to be 5000 lines of assembly in 24 hours implementing a fully working C compiler seems... a rather extraordinary claim. The file size of around 130K would indicate typing non-stop for 24 hours at something like 100 characters per minute.
- a9h74j 5y agoMaybe GitHub Copilot is that good already.
- Taniwha 5y agoI think they are talking about the later stages of boot strapping 'stage2' where they are writing a more functional, but still small, C compiler in a C subset that can be compiled by this one
- tralarpa 5y ago> typing non-stop for 24 hours at something like 100 characters per minute Not only that. It would be typing at that speed without testing anything. In assembly. Haha. In reality what would happen is that you would type 24 hours (not in one day, I assume) and then spend the next days finding the places where you wrote R5 instead of R4. And, of course, without losing any time on refactoring already written code (changing order of parameters, finding a better name for a function, etc.)