9 ms·
Stanford Compilers Course
- dhawalhs 9y agoMore Stanford free online courses/MOOCs(over 150) here: https://www.class-central.com/university/stanford https://www.class-central.com/university/stanford
- 2_listerine_pls 9y agoToo bad Stanford doesn't care much about free material as MIT does.
- sn9 9y agoCheck out Stanford's Lagunita.
- 2_listerine_pls 9y agoThey have very few courses.
- sn9 9y agoThey have the Compilers course, though.
- amelius 9y agoThey still reference the Dragon book, but how relevant is it still? I recall that a lot of it deals with parsing (which nowadays seems an almost trivial problem), and it doesn't treat garbage collected runtime systems, or JIT compilers. Or type inference with any of the newer typesystems as used by e.g. Rust, or even Hindley Milner.
- virgilp 9y agoThis is an undergrad-level course. Of course it needs to teach parsing - a lot of people are going to have to write some form of parser during their career, so it's good to have some fundamentals. (and the Dragon book doesn't exclusively talk about parsing, either)
- megaman22 9y agoMan, it's really unconscionable the way that textbooks juice people. There is no reason that book ought to cost $190 (what I just saw on Amazon for the hard-cover). It's across the board; once a book gets entrenched as one of these go-to textbooks for a subject, it can for some reason be marked up 400% over equivalent books.
- virgilp 9y agoBranding 101. Do you feel it's a phenomenon unique to textbooks? :) (but yes, I hear you: education & healthcare shouldn't be "industries").
- nerdponx 9y agoWell it kind of is unique to text books. Rarely does an entrenched product get such price privilege, except perhaps Apple devices. Usually if the price becomes too high, the product becomes un-entrenched people switch to something else. University students are uniquely locked in in a way that few other consumers are.
- virgilp 9y ago> if the price becomes too high, the product becomes un-entrenched people switch to something else Eventually, they do. You don't know that this isn't going to happen here. In fact, I'd argue that it already started (but yes, it's a slow process).
- mfe5003 9y ago
- virgilp 9y agoI hate it that you can't see the syllabus without signing in. How is someone supposed to know whether (s)he's interested? I've looked over it, it's not too dissimilar (on surface) with what I used to teach at the university. Might not be an accident since I remember at some point we switched from our own compiler skeleton to COOL, which is apparently what Stanford uses; so maybe I inspired my syllabus from Stanford's? I forget :) (for sure I did check the syllabi of several big US universities when building mine). Interesting that he recommends "Engineering a Compiler"; I don't doubt that it's a good book but I don't know it. The third on my list (though admittedly a bit advanced) was Muchnick's "Advanced Compiler Design and Implementation".
- deleted 9y ago[deleted]
- rayiner 9y agoMuchnik covers a lot of ground, so is pretty dense. Cooper & Torczon's book is more approachable, though it covers less ground. In some cases, Cooper & Torczon choose which algorithms to present because they're easier to understand. (E.g., they don't cover partitioning-based value numbering, but rather a simpler hash-based technique.)
- CalChris 9y agoMuchnick deserves a second edition. He’s retired but someone should take on the task.
- hawflakes 9y agoAs I recall, the same professor also taught a compiler class using COOL back in 1995-96 at Cal. I sat in on a session because a friend was taking it at the time.
- gfredtech 9y agoA few days ago I had to download this course (along with Stanford's course on Automata theory) from a torrent tracker because it was no longer available on Coursera...
- leadingthenet 9y agoAny idea why they're no longer on Coursera?
- gfredtech 9y agoSadly, no
- k4ch0w 9y agoThis happened to a linear algebra course I wanted to take. It was on Coursera and for some reason removed.
- rz2k 9y agoLink to the Automata course: https://lagunita.stanford.edu/courses/course-v1:ComputerScience+Automata+SelfPaced/about https://lagunita.stanford.edu/courses/course-v1:ComputerScie...
- sn9 9y agoThey're both on Stanford's Lagunita, along with excellent courses on Computer Networks and Databases.
- jcadam 9y agoMy compilers course was the single most difficult college course I've ever taken (it was an undergrad/graduate cross-listed course usually taken senior year, and at least at my school, UCCS in Colorado, was the cause of many a CS student not graduating on time -- putting a weed-out course that close to the end of the BSCS program wasn't cool, man). More all-nighters during that class than any other. It occurs to me, I've spoken to several Junior devs over the last few years with CS degrees that never had to take a compilers course. That just isn't right.
- Herald_MJ 9y agoIt was an optional course for me, and also one of the hardest I took. But also one of the most enlightening, rewarding, and enjoyable of my degree.
- kochthesecond 9y agoIt was optional in my degree, and I concur it was the single most difficult course I took. At least twice as much work as any other course, learned twice as much too.
- tombert 9y agoAs an autodidact, I really appreciate that the big "brand-name" universities do this. MIT OpenCourseware and the free Stanford lectures have been so incredibly valuable in making me an at-least-half-decent engineer. I've written a Scheme interpreter a few years back, but never a compiler, so this should be a pretty fun time-dump for the weekends.
- yodsanklai 9y agoI especially like when courses are not watered down. For instance, many coursera courses are simplified to be accessible to a broader audience with limited background. When I want to dig deeper, I really enjoy some of MIT opencourseware classes.
- jamestimmins 9y agoCan you recommend any MIT ocw courses that are challenging while being high quality? Some of them don't have video lectures or are quite hard to follow without TA/teacher help, that I've been hesitant to try them out again.
- yodsanklai 9y agoI did three graduate classes. - Distributed systems. 6.824 (There are two versions. the labs changed over the years). - Operating systems: 6.828. Operating systems I mainly did the labs. In 6.828, you program a full OS kernel (JOS, based on provided source code). In 6.824, one project was a user-space distributed file system in C++, another was a distributed reliable key-value store in Go. I agree that the course material is hard to follow without external help but it's definitely doable. They have automatic grading scripts and the labs are progressive.
- jamestimmins 9y agoOh man those both sound awesome. Thanks for adding the info! Especially the distributed systems course.
- 9y ago
- nfriend 9y agoI took this course for fun a few years ago - it was fantastic! I modified the project a bit to match my own interests - instead of compiling to an executable, my compiler generated browser-friendly JavaScript code. I built a small web application that uses my compiler and allows you to run COOL code in your browser: http://nathanfriend.io/cooltojs/ http://nathanfriend.io/cooltojs/
- dbrgn 9y agoI also did the course, in parallel to the "real" university course. Both had almost the same structure since they're both roughly based on the dragon book. I can strongly recommend it - really great material!
- bitL 9y agoFor those of you who took it - does it go into detail how to do advanced LALR languages, including handling semantics and types? Can I use the knowledge to make my own OOP + FP language right away (Scala/Kotlin-like), or do I need to study much much more than what is covered in this course? Thanks!
- jfoutz 9y agoI didn't take this course. I have taken compiler classes. Short answer, yes. Longer answer, compilers of any sort are hard, because there's both a lot of special cases and also pressure to be algorithmically efficient. Writing any kind of compiler is going to force you to do stuff with the parse tree. It's up to you to decide if float a = 1 is an error or not. doing things like constant value evaluation int a = 1 + 2 + 3 => int a = 6 will get you a feel for all the different ways you can transform the parse tree. It's going to feel frustrating, because it's not the language you want to work on. But building up the skills to shuffle ast nodes is really really helpful. Making your own language is hard. if your goal is a working language, i'd suggest building an interpreter first, so you can really nail down the semantics. at the end of that you're going to have a call that looks like eval(ast, context). you can do a simple compiler by just reimplementing eval, rather than doing the work, spit out the code that would do the work. also, if you have an adequate interpreter, you can you can write your compiler in your own language.
- tom_mellior 9y ago> Can I use the knowledge to make my own OOP + FP language right away I didn't take this course, but from the syllabus posted above it looks like garbage collection is not covered at all. That's pretty much a requirement for FP languages, and it makes OOP languages easier too. So you'd have to look at other resources for that. A simple semispace collector should be relatively easy to write even if you don't want to get too deep into the matter. For a very first version of your language, you can of course just allocate memory without ever freeing it. That's good enough to experiment with simple programs. Another point that I think isn't covered in this course, and that is relevant for (many) functional languages, is pattern matching and the representation of algebraic datatypes.
- 9y ago
- stevefan1999 9y agoYes! This is what I’m exactly looking for! By the way, what other free compiler courses would you hackers recommend?
- tdaniels 9y agoI have worked through the following, and found it quite good http://www.diku.dk/~torbenm/Basics/basics_lulu2.pdf http://www.diku.dk/~torbenm/Basics/basics_lulu2.pdf *Full disclosure that the following is mine https://troydaniels.github.io/diku/compiler/course/2017/01/03/building-a-compiler-p1.html https://troydaniels.github.io/diku/compiler/course/2017/01/0...
- zellyn 9y agoI did the Coursera version of this course a few years ago. I didn't read any book, but definitely watched parts of the videos more than once. Their scaffolding code is only available for C++ and Java, but (at least when I took it) many of the tests could be downloaded and reverse-engineered, so I was still able to adequately test my Go implementation. See https://github.com/zellyn/gocool https://github.com/zellyn/gocool for my working but probably quite nasty code :-)
- dochtman 9y agoI also took the Coursera version, and I have a Python version of the tooling for those who are interested: https://github.com/djc/cs143-python https://github.com/djc/cs143-python
- chmaynard 9y agoI believe this course was developed by Alex Aiken during his time at Berkeley. I assume he brought the material with him when he moved over to Stanford. The Cool language as a didactic tool seems a little dated now. When I took the Coursera version of the course a few years ago, Aiken distributed the Cool compiler development environment as a VirtualBox image, which was a nice cross-platform solution at the time. Today, Docker would probably be the preferred approach. I didn't get very far in the course because I lacked the necessary C++ skills (and the motivation to learn them).
- hiram112 9y agoCould someone who has taken a decent compiler course and been in the industry a few years comment on how / why this course would be beneficial? There are a lot of things I'd like to look into these days, but only so much time. And I do realize that some courses I took in University a decade ago were far more valuable than others (e.g. learning to program the m68K was extremely useful just to understand how stacks, interrupts, etc. work. OTOH, I haven't used anything from in my programming languages course since then).
- adam_gyroscope 9y agoI took this course a few years back when it was on Coursera and had taken a similar course many years ago in university; I've been a developer of some kind for 20+ years. This course brought together a bunch of stuff I understood but hadn't internalized so didn't use in my day-to-day job. If you've been programming for a few years and take this course, you're going to say "OHHH that explains <some weird thing that happened in your career>" a bunch.
- zmodem 9y agoI can't comment on this course specifically, but the argument for studying compilers, even if you don't end up working in that field, is that learning how programs are translated gives a deepter understanding of how computers are programmed. From a practical view-point, it's useful to know what a compiler can and cannot do with your program. Niklaus Wirth puts it like this: "It is the essence of any academic education that not only knowledge, and, in the case of an engineering education, know-how is transmitted, but also understanding and insight. In particular, knowledge about system surfaces alone is insufficient in computer science; what is needed is an understanding of contents. Every academically educated computer scientist must know how a computer functions, and must understand the ways and methods in which programs are represented and interpreted. Compilers convert program texts into internal code. Hence they constitute the bridge between software and hardware. Now, one may interject that knowledge about the method of translation is unnecessary for an understanding of the relationship between source program and object code, and even much less relevant is knowing how to actually construct a compiler. However, from my experience as a teacher, genuine understanding of a subject is best acquired from an in-depth involvement with both concepts and details. In this case, this involvement is nothing less than the construction of an actual compiler." (From http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf)
- dolguldur 9y agoSyllabus: Week Videos Quiz / Exam PA assigned PA due 1 Course Overview | Cool: The Course Project 2 Lexical Analysis | Finite Automata Quiz #1 PA1 3 Parsing | Top-Down Parsing Quiz #2 4 Bottom-Up Parsing I | Bottom-Up Parsing II Quiz #3 PA2 PA1 5 Semantic Analysis and Type Checking | Midterm 6 Cool Type Checking | Runtime Organization Quiz #4 PA3 PA2 7 Code Generation | Operational Semantics Quiz #5 8 Local Optimization | Global Optimization Quiz #6 9 Register Allocation | Garbage Collection PA4 PA3 10 Java | Final Exam
- towndrunk 9y agoThis is worth a look if you have not seen it. https://interpreterbook.com/ https://interpreterbook.com/
- DSingularity 9y agoI have wonderful memories coding the lexer, parser, runtime, and code generation support for OO aspects of COOL. Knowing how inheritance and polymorphism were implemented really does bring some clarity to programming. Compilers was one of my favorite courses. Definitely humbling and enlightening. Would recommend :D
- avarsh 9y agoI took a PL/Compilers course based on COOL with Wes Weimer at UVA. We built an interpreter and compiler for COOL using its manual (i.e. a document with a verbal/maths spec for the language) and virtually no skeleton code. It was the hardest class in the department and I consider it to be the most valuable class I took as an undergrad. Before that class I didn't really understand what happened when I 'hit go' on my programs. Weimer is at UMich now but still publishes course materials online: https://web.eecs.umich.edu/~weimerw/ https://web.eecs.umich.edu/~weimerw/