4 ms·
Ask HN: Online Compiler Courses?
Compilers are one of the few major topics that was never covered in my CS education, but I've really taken an interest in them lately. They also seem like something that really would benefit from a structured curriculum.
Any recommendations for an online course?
- nijaru 6y agoI’m on mobile, but three recommendations for books/resources are: 1. Crafting interpreters. There’s plenty of hn discussion on it and it was recently completed. 2. Writing a compiler in go. There’s also a book on interpreters that goes along handily with it from Thorsten ball as well. 3. Build your own lisp There’s also plenty of traditional textbooks such as the dragon book. I don’t have any lectures or videos on hand, but I’m sure teach yourself CS has a recommended course on it.
- _bxg1 6y agoI saw Crafting Interpreters but I wasn't sure if it really covered compilers or focused mainly on interpretation (I know there's a lot of overlap, but still). I have done basic Lisp interpreters before in JS/Python and even did a bit of compilation from Lisp to JS, but those feel like they're only scratching the surface because a) Lisp is so easy to parse it almost feels like cheating, and b) using a dynamic language as a target means you can lean on several of its built-in features instead of implementing them from scratch So for example, I'd really especially like to learn more about representing ASTs and parsing an arbitrary context-free grammar, and maybe even some basic type-system stuff if that isn't too far out of scope Edit: Turns out what I'd seen before was "Essentials of Interpretation", a Udemy course. I will say I tend to prefer the course format over a book.
- signaru 6y agoI just recently finished Crafting Interpreters. The third part of the book covers a bytecode virtual machine and overlaps with compiler concepts. Perhaps Bob didn't put "compiler" in the title since the bytecode VM still requires the source code to be present during runtime. Even if it doesn't teach how to produce a "compiled file" in some form, it is still valuable as an approachable transition from simpler tree walk interpreters.
- kipply 6y agoNot already mentioned include the llvm tutorials, graalvm tutorials for building a truffle language and david beazely runs a paid, expensive course that seems pretty good!
- _bxg1 6y agoWow, Beazley's course appears to be live, not a video series I'm okay with paying, but my schedule wouldn't allow for a full-time middle-of-the-day course
- cellularmitosis 6y agoI took both his SICP course and compilers course back-to-back, and I highly recommend both of them. Also, sometimes people need something to get them hooked, and kickstart a habit of working on a project. A compilers book is too heavy there. For that I would recommend what got me started down this rabbit hole, which was Gary Bernhardt’s “Compiler from scratch” screencast (paid, not free, but his half dozen “from scratch” casts are well worth it). In 20 minutes you’ll be taught how to build a regex-based lexer, a recursive descent parser, and do some very basic output generation. I wrote a series of blog posts about using those techniques to implement an alternative syntax for C: https://gist.github.com/cellularmitosis/d4f8d92886061f1629b150dd36619890 https://gist.github.com/cellularmitosis/d4f8d92886061f1629b1... If interpreters is your thing, I’ve hacked around with those a bit as well: https://gist.github.com/cellularmitosis/a46efbf32544cde3a1d156e4903e051f https://gist.github.com/cellularmitosis/a46efbf32544cde3a1d1... https://gist.github.com/cellularmitosis/d8d4034c82b0ef817913a01138b115bf https://gist.github.com/cellularmitosis/d8d4034c82b0ef817913... I also maintain a list of links to simple CPU designs, simple compilers, and simple interpreters (for study): https://gist.github.com/cellularmitosis/1f55f9679f064bcff02905acb44ca510 https://gist.github.com/cellularmitosis/1f55f9679f064bcff029... Edit: ah I forgot the compiler from scratch link! I also forgot that particular video is free!!! https://www.destroyallsoftware.com/screencasts/catalog/a-compiler-from-scratch https://www.destroyallsoftware.com/screencasts/catalog/a-com... Edit: also, a (broken) math interpreter which demonstrates how to use graphviz to visualize the AST https://gist.github.com/cellularmitosis/fa41234f641ce55a737460e9f7ba0c30 https://gist.github.com/cellularmitosis/fa41234f641ce55a7374... Edit: also, don’t be afraid to skip the lexer and parser and just start working with an AST data structure. Whatever it takes to get started! https://gist.github.com/cellularmitosis/074730ddde770f4ac694825ca3fbfaec https://gist.github.com/cellularmitosis/074730ddde770f4ac694...
- fallennode 6y agoThere is a GitHub project I've used as reference a couple of times, written in JS. https://github.com/jamiebuilds/the-super-tiny-compiler https://github.com/jamiebuilds/the-super-tiny-compiler
- ryanmccullagh 6y agoFor a great introduction tutorial, check out "Let's build a compiler". It's an excellent and simple introduction to compiling and emitting code. You can also check out my implementation in C at https://github.com/rmccullagh/letsbuildacompiler https://github.com/rmccullagh/letsbuildacompiler
- insertnickname 6y agohttps://www.edx.org/course/compilers https://www.edx.org/course/compilers
- _bxg1 6y agoUpdate: feel free to continue adding recommendations but I started reading Crafting Interpreters and it seems like the perfect difficulty/depth balance, so I'll probably stick with that.
- langitbiru 6y agoHere is the garbage collector course from the FB engineer. http://dmitrysoshnikov.com/courses/essentials-of-garbage-collectors/ http://dmitrysoshnikov.com/courses/essentials-of-garbage-col... Garbage collector is a part of compiler technology.
- ken 6y agoThe final chapter of SICP builds a simple compiler.
- nils-m-holm 6y agoJust a book, not a full course: http://t3x.org/t3x/book.html http://t3x.org/t3x/book.html Or dig around a bit on http://t3x.org http://t3x.org in general!
- signaru 6y agoAs for video courses, I have Alex Aiken's compilers course on my list. It seems a bit more advanced, and I'm still on introductory material, so I haven't started with it yet.
- galoisgirl 6y agoThe curriculum from Open Source Society University at https://github.com/ossu/computer-science https://github.com/ossu/computer-science lists those: - https://www.edx.org/course/compilers https://www.edx.org/course/compilers - https://www.youtube.com/playlist?list=PLDcmCgguL9rxPoVn2ykUFc8TOpLyDU5gx https://www.youtube.com/playlist?list=PLDcmCgguL9rxPoVn2ykUF...
- Nelkins 6y agoHere's a great YouTube series where a developer codes, step-by-step, a pretty fully-fledged programming language: https://www.youtube.com/watch?v=wgHIkdUQbp0&list=PLRAdsfhKI4OWNOSfS7EUu5GRAVmze1t2y https://www.youtube.com/watch?v=wgHIkdUQbp0&list=PLRAdsfhKI4... Not too much theory but from a nuts and bolts perspective I found it extremely approachable.
- celnardur 6y agoAlthough not exactly an online course, my compilers professor released his book for free online. It walks you through all the steps of building a compiler and is an invaluable resource for me. You can find it at www.compilerbook.org