[HN Gopher] 'Writing a C Compiler' is a book (2022)
       ___________________________________________________________________
        
       'Writing a C Compiler' is a book (2022)
        
       Author : luu
       Score  : 24 points
       Date   : 2024-07-11 21:33 UTC (4 days ago)
        
 (HTM) web link (norasandler.com)
 (TXT) w3m dump (norasandler.com)
        
       | trealira wrote:
       | The post is from 2022.
       | 
       | However, looking at the table of contents [0], she seems to spend
       | a lot of the book on types and pointers. That's cool, since the
       | compiler books that I've seen don't cover languages with pointers
       | and pointer arithmetic (and the analyses that come with that), or
       | representations of types.
       | 
       | [0]: https://nostarch.com/writing-c-compiler
        
       | jimsimmons wrote:
       | Advertising it as Writing a C Compiler is misleading. This is no
       | where near C's speed. It's just an implementation of a C like
       | language. And honestly there are better books or tutorials for
       | something like that.
       | 
       | C's selling point is performance and portability and this book
       | covers neither
        
         | Raminj95 wrote:
         | Please can you suggest those better resources as this is
         | something I'm trying to learn
        
           | sneed_chucker wrote:
           | Consider taking a look at chibicc and simply working forward
           | through the commits:
           | 
           | https://github.com/rui314/chibicc
           | 
           | > Each commit of this project corresponds to a section of the
           | book. For this purpose, not only the final state of the
           | project but each commit was carefully written with
           | readability in mind. Readers should be able to learn how a C
           | language feature can be implemented just by reading one or a
           | few commits of this project.
        
         | MaxBarraclough wrote:
         | > This is no where near C's speed. It's just an implementation
         | of a C like language.
         | 
         | I don't understand this criticism. It seems reasonable for the
         | end-result compiler to support only a 'significant subset of
         | C', rather than total compliance with the standard. It also
         | seems reasonable for the performance of its generated code to
         | be nowhere near that of the major optimising C compilers.
         | 
         | How could it possibly be otherwise? A serious modern C compiler
         | is the result of millions of dollars of specialised software
         | engineering.
         | 
         | > C's selling point is performance and portability and this
         | book covers neither
         | 
         | I've not read the book, but it apparently does cover
         | optimisation.
        
       ___________________________________________________________________
       (page generated 2024-07-15 23:02 UTC)