3 ms·
I guess the full bootstrapping process would start with writing a basic compiler in assembly?
by williamdclt 2y ago
I guess the full bootstrapping process would start with writing a basic compiler in assembly?
- atq2119 2y agoThe full bootstrapping process starts with entering instructions in binary (or hex or octal) to build an assembler in the first place :)
- swiftcoder 2y agoThe full bootstrapping process starts with a soldiering iron and a reel of copper wire.
- pabs3 2y agoThat is correct the path chosen by the Bootstrappable Builds project indeed: https://bootstrappable.org/ https://bootstrappable.org/ https://lwn.net/Articles/983340/ https://lwn.net/Articles/983340/
- mbreese 2y agoAssembly? Ha! In my day, we would have considered ourselves lucky to have had assembly, let alone a C compiler. No, we had to bootstrap our computers using switches and paper tape. You probably want a terminal too! In all seriousness, the bootstrap process is fascinating to me. At some point, it did all start with switches and manually loading commands directly into memory. And over time, we’ve slowly kept this thing going and growing. Also… I’m old enough to have seen a Altair with toggle switches, but I’m not old enough to have had to toggle in a boot loader on one. :)
- norir 2y agoIt depends on definition of full bootstrapping process. At some point, someone has to bootstrap in raw assembly but we don't need to do that in 2024. If I write a bootstrap compiler in c on a machine that can run c, I can write an alternate backend for any assembly language (that supports the necessary compilation features) and thus produce a compiler implemented in any assembly language without directly writing any assembly. Taking this process to the extreme, no one could ever bootstrap anything because eventually you're bootstrapping mineral extraction.
- pabs3 2y agoThese folks say that you do need that in 2024 (commented machine code actually): https://bootstrappable.org/ https://bootstrappable.org/ https://lwn.net/Articles/983340/ https://lwn.net/Articles/983340/
- wqweto 2y agoUsually it’s easier to just cross-compile for the new target. No need to start from ground zero.
- tetha 2y agoBack in university, we took the steps of: - Breadboarding some CPU components - Breadboarding a very, very minimal CPU. More like a simple Adding + Multiplication machine with 4 registers or so, with a few premade components. - Eventually moving up to microcoding a simulated CPU - Eventually writing binary code to control the microcoded CPU - At that point I kinda cheated and wrote my own assembler because I got sick of checking so many bits. - This project then stopped at an assembly level. - But then we implemented our own ML-variant interpreter and later on ML-variant compiler in OCaml - And later on we had that ML-Compiler compile itself and extended it from there. Pick your poison where to start. Just be aware that breadboarding stuff becomes very... messy very quickly[1]. And I do include Hardware in this, because you needed simpler CPUs to design more complex CPUs. In practice, you want to pick the best combination of a familiar language that is as high level as it can be. But back in the day, that would've been assembly, binary. In the case of C, it went from BCPL, in which a compiler for B was written, in which a compiler for New B (NB) was written, which then turned into C. 1: https://www.youtube.com/watch?v=l7rce6IQDWs&t=78s https://www.youtube.com/watch?v=l7rce6IQDWs&t=78s