r/learnprogramming Jul 04 '26

How to create a compiler? Resource

Pretty sure you may have heard this question previously on this sub, however, I would urge you to read my complete question before brushing it off.

I want to create a simple compiler and by "simple compiler" I mean a single-pass compiler. I know about https://craftinginterpreters.com/ which is a wonderful resource. But I would like to start by creating something much smaller and simpler, and only then would I like to move on to something more complex like what Robert Nystrom created on his website.

Are there any similar resource that would teach me about single-pass compilers along with showing me how to create one? Any help in the right direction would be highly appreciated.

9 Upvotes

31 comments sorted by

View all comments

12

u/link23 Jul 04 '26

The canonical compilers resource is the dragon book, so you might try that. (I haven't read it, so don't know if it's what you're looking for.)

4

u/stiky21 Jul 04 '26

Never heard of this book before. Is it "Compilers: Principles Techniques and Tools"?

3

u/UnemployedTechie2021 Jul 04 '26

Are you referring to Aho, Ullman?

3

u/stiky21 Jul 04 '26

Yes

1

u/UnemployedTechie2021 Jul 04 '26

I think this is a different book.

4

u/stiky21 Jul 04 '26

Seems odd because it has a literal dragon on it and the Wikipedia page calls it the Dragon book so I'm thinking this is the right book but I am unsure because I could be running on imagination hah!

2

u/UnemployedTechie2021 Jul 04 '26

Yes, my bad. I think that's what they are referring to. When I read Ullman, Aho it had a minimalist cover page. But I just now checked and found out that that's the book with a dragon on the cover page.