4 ms·
I'm going back to basics and learning to write a compiler in the dumbest way possible. I'm starting with a basic assignment (a = 3) and reverse engineering what
by PainfullyNormal 4y ago
I'm going back to basics and learning to write a compiler in the dumbest way possible. I'm starting with a basic assignment (a = 3) and reverse engineering what it would take to turn that into a working executable. Then I'll add more features, lather, rinse and repeat. I'm hoping to eventually turn it into a series of blog posts so everyone can see just how little I remember from college.
- fikama 4y agoI like it so much, reading your comment make exited to reading your blogpost. In moments like this I wish there was sth in hacker news that would allow tracking progress of e.g. your project. In twitter you can just follow people, reddit has remindme thing.
- PainfullyNormal 4y agoIf you're interested, I created a substack I'll be publishing the first few posts to. You should be able to subscribe there. https://painfullynormal.substack.com/ https://painfullynormal.substack.com/
- fady123 4y agoI am not a computer science graduate and have always been fascinated by programming languages and how they work. i am currently reading a book called crafting interpreters (https://craftinginterpreters.com https://craftinginterpreters.com) which i think is a very good introduction to the topic plus it's very practical without getting too deep into theory.
- creativemonkeys 4y agoI've built a C compiler and have read the dragon book. I wish I read Crafting Interpreters before reading Compilers by Aho. It's good, and there's no nonsense. The author knows what he's talking about. Plus it's free to read online. 10/10 would recommend.
- 11235813213455 4y agofor an interpreted language like JS, this project is really nice https://github.com/engine262/engine262 https://github.com/engine262/engine262. More or less 2 parts: parser and evaluator
- sankha93 4y agoThis is exactly how Compilers are taught at the University of Maryland. The class CMSC430 (https://www.cs.umd.edu/class/fall2021/cmsc430/ https://www.cs.umd.edu/class/fall2021/cmsc430/) actually starts off with a Scheme (limited subset of Racket) and gradually grows the language to include more features. The first class compiles just numbers to x86 code, followed by arithmetic operations for numbers, building up to higher level features like function calls, pattern matching, and so on. See the notes at: https://www.cs.umd.edu/class/fall2021/cmsc430/Notes.html https://www.cs.umd.edu/class/fall2021/cmsc430/Notes.html This style of building compilers is called the Nanopass style (https://legacy.cs.indiana.edu/~dyb/pubs/nano-jfp.pdf https://legacy.cs.indiana.edu/~dyb/pubs/nano-jfp.pdf), making it much easier to teach. Source: I was a TA for the earlier iteration of the class.