I do value both correct high quality AI usage and non-AI works, would be nice if we could have a bar for the AI stuff that makes sense instead of dismissing peoples work blindly.
> This book offers a one semester introduction [...] enabling the reader to build a simple compiler that accepts a *C-like language*
Not really. I was webdev who then switched into compilers job with LLVM being foundation
LLVM itself is huge, it is not trivial to be familiar with every it's areas/mechanisms, but writing not-complex passes, bug fixing, regression fixing does not require some fancy knowledge
Which is to say: no shame in just settling for that simple C backend!
Both compilers and language design are as old as this industry, and have too much knowledge for a single course.
This one is ok, better than most similar courses based on, say, the dragon book.
While I agree that simply calling something "AI slop" is not constructive, it is not my job to voluntarily review LLM-extruded crap. In the past I would provide constructive criticism because there was an actual conversation taking place. The producer had put at least enough thought into it such that my engagement didn't feel like replying to a chatbot, but that's what it feels like now, so unless I see some considerable effort and original thought on the author's part, I am likely to drop a "slop" comment and move on with my day.
It adds a little bit of complexity (you need to be very clear on how you handle registers) but it worked surprisingly well, and it makes it easy to built up the complexity step by step.
It also meant I could bootstrap the compiler itself with just an assembler.
Sadly I lost the source decades ago.
(Making assembler an integral construct of a higher-level language is also not a unique approach - there's Randall Hyde's High-Level Assembly[1] and others.)
Here's a comical one:
https://news.ycombinator.com/item?id=48445529
> The discussion on Spanish traders set the standa raises interesting points. In practical applications, the key challenge is balancing performance with maintainability. Would be valuable to see more concrete examples of trade-offs. [emphasis added]
They glob out part of the submission title (and took too much and cut off in the middle of a word) generating a delightful nonsense descriptor (the italicized bit). The title being:
> Spanish traders set the standard for GnuCash database design
How do you guarantee it, exactly? AI told you in an authoritative tone?
I've been searching for something challenging and found some very random post on programming forums about how compilers are hard etc and decided to give it a try.
I had kind of advantage that I accidentally had some significant amount of experience with handwritten parsers (at first job we were doing custom-markdown-like-language renderer as PoC or even when doing apprenticeship in high school I was rolling out csv parser instead of using libs, because... I'm not sure why, I probably didnt know how to use package manager or something)
I started reading about it a lot like dragon book (but it wasnt that useful tbh, too much math heavy)
or https://www.cs.cornell.edu/courses/cs6120/2020fa/self-guided...
or playlist like this: https://www.youtube.com/watch?v=wgHIkdUQbp0
And after year of jumping into it from time to time I've implemented small, custom-lang to LLVM IR to webassembly (via LLVM) compiler.
Then I had to find new job (we were very poorly paid) and I was interested in semiconductors industry because it was gaining traction (e.g chip war book) and it felt way more engineering oriented unlike web dev. Web dev tech decisions felt for me very religious, like fancy-conferences/blogposts oriented.
And since semiconductor industry often touches compilers, then that was opportunity for: better salary, interesting projects and in future transition to compilers
I've joined semico company as C# dev and then due to project cancellations/lay offs I managed to join compiler team and stress hard during first months since I had to learn new lang, new ecosystem, tools, approaches, techniques (e.g debugging) and only familiar thing was LLVM, which I was very beginner at.
but after that initial shock things were better, but I feel like I still need to improve my knowledge related to modern hardware, modern computer architecture, etc.
Debugging is very, very useful, cross-stack skill :)
The last 3 years was a paradigm shift. How do you know if a comment was generated by AI? If it's written Better than a human comment... if it's too good.
I'm the one who vouched it. I don't check commenters' history before doing it. Maybe I should. My LLM-detector is apparently broken (especially on short posts). At face value I saw nothing wrong with it, so I vouched it.
But I still have hope that I will make it. Maybe coding agent will help me but I dont like the idea that I need help from AI to build this. I want to create compilers through my own hands.
Anyway, I hope you will make it anyway. :)
1. There's a problem with the account (and then inform them and maybe notify the mods myself). Sometimes people get shadowbanned without good reason (usually the result of automoderation, not an explicit human moderator action) or for something that happened years ago, but their history is pretty clean since.
2. To see if the person is just a spammer (as is the case here).
Though I only do this if the comment seems like something that oughtn't be dead (as this one does on a first glance). The comment is shallow, but not necessarily wrong or bad. It just adds little to the discussion since it boils down to "The book is an introductory text." which we also get from reading the submission title.
This is a free online textbook: you are welcome to access the chapter PDFs directly below. If you prefer to hold a real book, you can also purchase a hardcover or paperback below. The textbook and materials have been developed by Prof. Douglas Thain as part of the CSE 40243 compilers class at the University of Notre Dame. Join our mailing list to receive occasional announcements of new editions and other updates.
A compiler translates a program written in a high level language into a program written in a lower level language. For students of computer science, building a compiler from scratch is a rite of passage: a challenging and fun project that offers insight into many different aspects of computer science, some deeply theoretical, and others highly practical. This book offers a one semester introduction into compiler construction, enabling the reader to build a simple compiler that accepts a C-like language and translates it into working X86 or ARM assembly language. It is most suitable for undergraduate students who have some experience programming in C, and have taken courses in data structures and computer architecture.
The author grants permission to download, print, and use these PDFs for personal and academic use. Commercial printing or distribution is prohibited. Instead of copying PDFs locally, please point students to this page (compilerbook.org) so that they can access the latest version.
| Complete Book | Single PDF Download |
| Chapter 0 | Front Matter |
| Chapter 1 | Introduction |
| Chapter 2 | A Quick Tour |
| Chapter 3 | Scanning |
| Chapter 4 | Parsing |
| Chapter 5 | Parsing in Practice |
| Chapter 6 | The Abstract Syntax Tree |
| Chapter 7 | Semantic Analysis |
| Chapter 8 | Intermediate Representation |
| Chapter 9 | Memory Organization |
| Chapter 10 | Assembly Language |
| Chapter 11 | Code Generation |
| Chapter 12 | Optimization |
| Appendix A | Sample Course Project |
| Appendix B | The B-Minor Language |
| Appendix C | Coding Conventions |
Code Resources. The compilerbook-examples github repository contains additional resources that correspond to the book, including several scanners and parsers, a starter code structure for the project compiler, and sample test cases for each stage of the scanner, parser, typechecker, and code generator.
Errata. Found a typo or mistake? Please send an email to the author `dthain@nd.edu` with the title "Compiler Book Errata" and I'll be happy to correct it and acknowledge you in the next edition.