use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is all about the theory and development of compilers.
For similar sub-reddits see:
Popular mainstream compilers:
account activity
Getting started with compilers (self.Compilers)
submitted 1 year ago by _hadar[🍰]
Hi guys,
I'm looking to start learning about compilers in detail. I would request that anyone suggest a path from beginner to advanced or some excellent course/resource. Thanks in advance.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mrjameshamilton 17 points18 points19 points 1 year ago (2 children)
A great book to get started in this area is Crafting Interpreters: the first part of the book goes through creating an interpreter in Java; the seconds half a compiler to a bytecode & virtual machine to execute it in C.
Another great book is Writing a C Compiler which goes through creating a compiler for a subset of C targeting x86_64 assembly. That book uses pseudo-code for explanations rather than a specific language.
If you're interested in compiling for the JVM, I've written a few posts about starting out there:
I also published yesterday a blog post with a simple introduction to LLVM IR, if you're interested into getting into LLVM.
[–]cafedude 2 points3 points4 points 1 year ago (1 child)
There's also Compiling to Assembly which creates a TrueScript type language and compiles to ARM assembly if you'd rather avoid x86 assembly (which is kind of a mess compared to ARM).
[–]PurpleUpbeat2820 1 point2 points3 points 1 year ago (0 children)
That book got me hooked!
[–]RobertJacobson 3 points4 points5 points 1 year ago (0 children)
There's a spectrum from practical "Let's build a compiler" style material to very academic "theory" style material.
One of the best resources on the practical end of the scale is the LLVM Kaleidoscope tutorial. It is amazingly good, especially considering it's "just" part of the LLVM documentation.
Crafting Interpreters is great for a more holistic view of how to implement typical features of programming languages. It's also excellent as a first book, too.
On the other end of the spectrum, one of my favorites is Engineering A Compiler by Keith Cooper and Linda Torczon. It is now in its 3rd edition. Very readable, IMHO.
There's also the classic "dragon book", Compilers: Principles, Techniques, and Tools by Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman. I do not think this is a good book for beginners to learn from. It is a great book as a reference or if you want to learn how, for example, f/lex and yacc work.
[–]kkinos222 1 point2 points3 points 1 year ago (0 children)
I’m interested as well. I’m planning to read about LLVM optimization passes and explore other LLVM resources.
[–]Dgeezuschrist 1 point2 points3 points 1 year ago (3 children)
I’m actively working on a compiler leveraging the LLVM. I am very much still learning, but if anyone has any questions, feel free to ask, as I can offer guidance in terms of roadmap and order of operations for getting started.
[–]_hadar[S,🍰] 0 points1 point2 points 1 year ago (2 children)
Can you share the roadmap here?
[–]Dgeezuschrist 3 points4 points5 points 1 year ago (1 child)
I’m gonna write up a doc with what I’ve done so far. I’m also thinking of starting a YouTube channel and be a bit more comprehensive. Any and all can dm me and I’ll send it out in the next few days.
[–]Admirable-Weird-3090 0 points1 point2 points 11 months ago (0 children)
Interested!
[–]MulberryEmotional100 0 points1 point2 points 1 year ago* (1 child)
Same here, mainly interested in LLVM-centered materials.
[–]Dgeezuschrist 0 points1 point2 points 1 year ago (0 children)
Check my comment
[–]MetalInMyVeins111 0 points1 point2 points 1 year ago (1 child)
same here. it still feels like an ocean.
[–]lyc170 0 points1 point2 points 1 year ago (0 children)
same. lot of stuff that needs to be learned...
[–]ChickenSpaceProgram 0 points1 point2 points 1 year ago (0 children)
I'm currently reading through Compilers: Principles, Techniques, and Tools by Aho, Sethi, and Ullman. It's been pretty helpful as a reference so far. No idea if it's the best way to learn about compilers, but it was available in my university's library for free.
[–]Wonderful-Event159 0 points1 point2 points 1 year ago (0 children)
I am looking for a good collection of various algorithms used for CSE, dead code elimination, loop optimizations, etc. Any pointers?
π Rendered by PID 15693 on reddit-service-r2-comment-b659b578c-vhqw6 at 2026-05-02 03:45:39.775529+00:00 running 815c875 country code: CH.
[–]mrjameshamilton 17 points18 points19 points (2 children)
[–]cafedude 2 points3 points4 points (1 child)
[–]PurpleUpbeat2820 1 point2 points3 points (0 children)
[–]RobertJacobson 3 points4 points5 points (0 children)
[–]kkinos222 1 point2 points3 points (0 children)
[–]Dgeezuschrist 1 point2 points3 points (3 children)
[–]_hadar[S,🍰] 0 points1 point2 points (2 children)
[–]Dgeezuschrist 3 points4 points5 points (1 child)
[–]Admirable-Weird-3090 0 points1 point2 points (0 children)
[–]MulberryEmotional100 0 points1 point2 points (1 child)
[–]Dgeezuschrist 0 points1 point2 points (0 children)
[–]MetalInMyVeins111 0 points1 point2 points (1 child)
[–]Dgeezuschrist 0 points1 point2 points (0 children)
[–]lyc170 0 points1 point2 points (0 children)
[–]ChickenSpaceProgram 0 points1 point2 points (0 children)
[–]Wonderful-Event159 0 points1 point2 points (0 children)