[HN Gopher] Bootstrapping a simple compiler from nothing (2002)
       ___________________________________________________________________
        
       Bootstrapping a simple compiler from nothing (2002)
        
       Author : sph
       Score  : 72 points
       Date   : 2024-01-16 09:02 UTC (1 days ago)
        
 (HTM) web link (web.archive.org)
 (TXT) w3m dump (web.archive.org)
        
       | o11c wrote:
       | For a more modern and complete approach see
       | https://www.gnu.org/software/mes/manual/mes.html and links
       | therefrom.
        
         | rollcat wrote:
         | The problem with GNU is that whenever faced with a trade-off
         | between simplicity and comprehensiveness, they chose the
         | latter; in doing so, they made their software harder to
         | understand and modify, and thus for their users to exercise the
         | freedoms they were promised.
         | 
         | mescc has one job, and one job only - why does it even have a
         | flag for picking the optimization level? Optimize for output
         | readability, nothing else.
        
       | tromp wrote:
       | > What next?
       | 
       | I really like how Ben Lynn went from a C like language to
       | building a complete Haskell compiler in umpteen steps, starting
       | with building a virtual machine for running programs written in
       | Combinatory Logic. He also condensed this journey into a winning
       | IOCCC entry [2].
       | 
       | [1] https://crypto.stanford.edu/~blynn/compiler/
       | 
       | [2] https://www.ioccc.org/2019/lynn/hint.html
        
       | sylware wrote:
       | What's important when bootstrapping, it is to have a set of
       | easily audit-able code generator binaries with several
       | alternatives (to avoid dev/vendor lock-in). _That_ is a thing of
       | the past. Anybody bringing on the table gcc or clang for this is
       | only laughable matter, unfortunately.
        
         | rekado wrote:
         | See also this for a description of the chain of small tools
         | that get us from a binary/source hybrid to a full system:
         | https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-...
        
       | redleader55 wrote:
       | I like to imagine the following nightmare scenario: we write a
       | compiler from scratch that it can bootstrap itself (like this
       | one, or Stage0), then we do the same bootstrapping process for
       | hardware - eg. write a FPGA that for a simple CPU that can run
       | the compiler and build other stuff, we do all of this and then
       | start building reproducible builds of everything we use today -
       | gcc, clang, Linux, etc. Eventually we build an 100% open source
       | machine where to run everything. After this step is done, we
       | start running in parallel all the tools and compare the outputs
       | between the reproducible builds on the open source stack and
       | semi-open one. And we discover slight differences ...
        
         | tekknolagi wrote:
         | You might enjoy
         | https://www.teamten.com/lawrence/writings/coding-machines/
        
           | withinboredom wrote:
           | Wow. That was pretty epic...
        
           | bossyTeacher wrote:
           | do you mind summarising the article?
        
             | KineticLensman wrote:
             | It's a near-future SF, written in 2009. Sort of a riff on
             | Ken Thompson's classic Reflections on Trusting Trust [0]
             | 
             | (spoilers)
             | 
             | Some programmers spot a bug that after a lot of
             | investigation seems to be a case of a rogue machine
             | intelligence inserting its own code into software used by
             | humans.
             | 
             | [0] https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_198
             | 4_Ref...
        
         | withinboredom wrote:
         | There was some children's (as in teen-targeted) book I read
         | back in the late 90's or early 00's where the main informant
         | was a dude who got a backdoor, via a supply chain attack, into
         | the generic mouse drivers installed on almost every machine.
         | 
         | Good times.
        
       | nickpsecurity wrote:
       | People interested in this topic should check out Miraheze, esp
       | Past Research, below:
       | 
       | https://bootstrapping.miraheze.org/wiki/Main_Page
       | 
       | We dumped all kinds of bootstrapped and gradual projects on that
       | site. Everything from assembly to type-safe languages to macros
       | to formal verification. Take your pick!
        
       | dang wrote:
       | Related:
       | 
       |  _Bcompiler - Bootstrapping a simple compiler from nothing
       | (2002)_ - https://news.ycombinator.com/item?id=8576237 - Nov 2014
       | (4 comments)
        
       | zellyn wrote:
       | The text refers to bcompiler.tar.gz, and indeed, changing .html
       | to .tar.gz and keeping the rest of the archive.org URL the same,
       | you can download
       | http://web.archive.org/web/20121030222527/http://www.rano.or...
        
       ___________________________________________________________________
       (page generated 2024-01-17 23:01 UTC)