Re:'Writing a C Compiler' is a book
by trealira on Thursday July 11, 2024 @07:40PM
(#40941586)
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.
Re:'Writing a C Compiler' is a book
by jimsimmons on Monday July 15, 2024 @02:53PM
(#40970447)
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
Re:'Writing a C Compiler' is a book
by MaxBarraclough on Monday July 15, 2024 @03:51PM
(#40970915)
> 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.
> 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.
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
C's selling point is performance and portability and this book covers neither
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.
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.