22 ms·
Advanced Compilers: Self-Guided Online Course
- abdullahkhalids 6y agoThis course is asynchronously delivered. Question for students: how do you find synchronous courses with some discussions during class, vs asynchronous courses where discussions are limited to an online written forum or office hours?
- the_arun 6y agoAsynchronous discussions are durable as content (in the internet). They are also very useful for working students. But they need focus to retain them in memory.
- kyawzazaw 6y agoNot a problem at all. For non-introductory courses, this works well. But needs to have at least some sort of synchronous at some point. In my one class, we use Notion for discussing so it has a live sense of discussion.
- mhh__ 6y agoListening to a Russian theoretical physicist mumble about how trivial various results are over a zoom call really makes my day, put it that way.i
- chrisseaton 6y agoIt's great that there's a lecture on dynamic compilation - so often overlooked.
- 37ef_ced3 6y agoDomain-specific compilers are a bigger field, where there's more opportunity to do something interesting Take C (or some other language) and its mature optimizing compilers as a foundation, and write a program that compiles a high-level description of a domain-specific program into C For example, NN-512 (https://NN-512.com https://NN-512.com) is a compiler that takes as input a simple text description of a convolutional neural net inference graph and produces as output a stand-alone C implementation of that graph GNU Bison (https://www.gnu.org/software/bison/ https://www.gnu.org/software/bison/) is another example, where the output is a parser: Bison reads a specification of a context-free language, warns about any parsing ambiguities, and generates a parser (either in C, C++, or Java) which reads sequences of tokens and decides whether the sequence conforms to the syntax specified by the grammar Halide (https://halide-lang.org/ https://halide-lang.org/) is a language for fast, portable computation on images and tensors, and it originally generated human-readable C++ code as output (but not anymore, now it feeds directly into LLVM) Can anyone provide other examples? (Code generators for network packet processing?)
- chrisseaton 6y ago> Take C (or some other language) and its mature optimizing compilers as a foundation, and write a program that compiles a high-level description of a program into C. Don't you still need many of the techniques taught in this class to build something like that? The material doesn't look inherently targeted at low-level languages or machine-code as a target.
- dbcurtis 6y agoOne way to think of it is to split the "compiler" problem into three big pieces. 1) Front-end, 2) back-end, 3) tooling. Front end is lexing, parsing, building the AST (in whole or just keeping pieces of it around), semantic analysis. When that is done, you can say "Yup, valid program. It is possible to generate code." So, to your question, yes. Those techniques from the course are 100% in play. Back-end is turning the AST into something you can optimized and generate code from. (Sometimes there is a "middle-end" in there....) High-level optimizations, low level optimizations, memory allocation, register allocation. Tooling is everything that keeps your life from being miserable as a user -- starting with debug symbols and these days people expect library and package management, etc, etc. So if you are interested in exploring the Next Great Syntax or some semantic problems that can be re-written into C, then doing a C-front is a great way to do that. Let the C compiler handle all the really-really-really-hard back-end issues for you, and avoid all that distraction. But.... expect that getting debug symbols from your spiffy language into the ready-to-link object file is going to be, as they say, "non-trivial". So... great for experiments and a great learning exercise, but it's hard to do a production compiler that way.
- samps 6y agoHi! This course is about the "middle end," FWIW. We do not do parsing or codegen in 6120, and there is no goal (as there is in many undergrad-level compilers courses) of making a complete, end-to-end compiler for a C-like language.
- kodoque2 6y agoDo you have a structured course for Domain-specific compilers available online?
- richardjennings 6y agoA fantastic submission, very much appreciated. I find the presentation style of subtitles with surrounding context extremely helpful. I often lose the ability to listen when concentrating; the subtitle context provides a superior recovery mechanism to the usual, try to work out what was missed. I look forward to purchasing augmented reality glasses at some point in the future which add this advantage to in-person interactions.
- CalChris 6y agoI too appreciate the subtitles and I tend to have them on when I watch+listen to a DVD. You can even click on the sentence and the video jumps to that point. However ... a little proof-reading would help here. To get things started gets transcribed into Ticketing, sir.
- loosetypes 6y agoYes! It’s the complete opposite of, and significantly more user friendly than, how zoom recordings synchronize meeting subtitles with audio/video playback. In their case they only show the current line in a text message-like sidebar. As the content plays, it snaps the scroll position of the messages to current, hiding the rest. This breaks scrolling ahead or back while listening and you lose any context. Hopefully I’m just missing a setting - I try to minimize the time I spend in there. Is there a way I can take their damn horse blinders off?
- rhendz 6y agoWhat would be some cool use cases to design your own compiler?
- MaxBarraclough 6y agoThere are various weird and wonderful niche languages out there, if you appreciate programming languages as an end in themselves. Two examples: Sentient [0] and Factor [1][2]. [0] https://sentient-lang.org/ https://sentient-lang.org/ [1] https://factorcode.org/ https://factorcode.org/ [2] Factor's home-page does a poor job of presenting examples to give a flavour for the language, so here's one on GitHub: https://github.com/factor/factor/blob/master/basis/roman/roman.factor https://github.com/factor/factor/blob/master/basis/roman/rom...
- caditinpiscinam 6y agoSentient looks neat! Does it use the same strategies as Prolog under the hood?
- MaxBarraclough 6y agoGood question, I'm afraid I don't know enough about either language to answer that. The Sentient pages mention Prolog, for what that's worth: https://sentient-lang.org/intro/declarative https://sentient-lang.org/intro/declarative
- satthrow 6y ago> The MiniSat solver is Sentient’s default. It is a version of MiniSat that has been compiled to JavaScript with Emscripten. This means that it can run in a web browser and it does not have any dependencies when run from the command-line.
- sethhovestol 6y agoA (not)compiler can be made to look for issues in your codebase that already exists. It would need all the tools of a compiler, just that the target is the same as the source language.
- mathattack 6y agoI love this line... “Real 6120 also has an end-of-semester course project—in the self-guided version, your end-of-semester assignment is to change the world through the magic of compilers”
- yla92 6y agoOn the related note, what would you guys recommend as an introduction to compilers, say for beginners?
- deleted 6y ago[deleted]
- diehunde 6y agoStanford Compilers Course
- matt_d 6y agoCompilers books: I'd start with "Engineering a Compiler" by Keith Cooper and Linda Torczon. http://craftinginterpreters.com/ http://craftinginterpreters.com/ is also a pretty great, programming-oriented intro, which may be good to work through alongside. For more on the analysis & compiler optimization side, "SSA-based Compiler Design" (http://ssabook.gforge.inria.fr/latest/; http://ssabook.gforge.inria.fr/latest/; GitHub Mirror: https://github.com/pfalcon/ssabook https://github.com/pfalcon/ssabook) is a good follow-up. Further readings: Book recommendations in https://github.com/MattPD/cpplinks/blob/master/compilers.md#books https://github.com/MattPD/cpplinks/blob/master/compilers.md#... as well as program analysis resources (in particular lattice theory, type systems and programming languages theory, related notation): https://gist.github.com/MattPD/00573ee14bf85ccac6bed3c0678ddbef#program-analysis-resources https://gist.github.com/MattPD/00573ee14bf85ccac6bed3c0678dd... Courses: I can recommend the following: https://github.com/MattPD/cpplinks/blob/master/compilers.md#courses https://github.com/MattPD/cpplinks/blob/master/compilers.md#... Particularly (in alphabetical order--I think these are all great, so including highlights of what I've liked about them): - IU P423/P523: Compilers (Programming Language Implementation) - Jeremy Siek, with the course book "Essentials of Compilation: An Incremental Approach" (pretty interesting approach, with programming language features developed incrementally having a fully working compiler at each step, cf. http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf; http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf; implementation language Racket), - KAIST CS420: Compiler Design - Jeehoon Kang (good modern treatment of SSA representation itself, including the use of block arguments, https://mlir.llvm.org/docs/Rationale/Rationale/#block-arguments-vs-phi-nodes https://mlir.llvm.org/docs/Rationale/Rationale/#block-argume..., as well as SSA-based analysis and optimization; Rust as an implementation language), - UCSD CSE 131: Compiler Construction - Joseph Gibbs Politz, Ranjit Jhala (great lecturers, both Haskell and OCaml edition were interesting; fun extra: one of the Fall 2019 lectures (11/26) has an interesting discussion of the trade-offs between traditional OOP and FP compiler implementation), - UCSD CSE 231: Advanced Compiler Design - Sorin Lerner (after UCSD CSE 131: for more on analysis & optimization--data flow analysis, lattice theory, SSA, optimization; fun extra: the final Winter 2018 lecture highlighted one of my favorite papers, https://pldi15.sigplan.org/details/pldi2015-papers/31/Provably-Correct-Peephole-Optimizations-with-Alive https://pldi15.sigplan.org/details/pldi2015-papers/31/Provab...), - UW CSE CSEP 501: Compilers - Hal Perkins (nice balanced introduction, including x86-64 assembly code generation, with the aforementioned "Engineering a Compiler" used as the course textbook).
- mcguire 6y agoThe course materials look good. But what is a "PhD level course"? All I've seen is undergrad and graduate, and the difference between masters and PhD has nothing to do with classes.
- jcelerier 6y ago> the difference between masters and PhD has nothing to do with classes. huh ? what's your education system ? in europe it's generally 3 year bachelor, then 2 year masters, then 3 years phd so when you have classes during your phd hopefully they are different that the one you get during your masters
- Jarwain 6y agoIn the US, it's typically a 4 year undergrad, 2 year masters, and a ~5-7 year PhD depending on the program itself. From what I understand, while there are some classes you take as a PhD student, a majority of your work is doing research
- butterthebuddha 6y agoFor PhD students, the masters is integrated into the 5 years they spend doing their PhD. They are expected to take courses as a "pre-candidate" and do primarily research after they pass their qualifying exams and become candidates.
- mrtranscendence 6y agoThis is usually true but not always. I attended an economics program with a terminal master’s offering, and we spent a year and a half as master’s students before moving on to PhD work.
- cinntaile 6y agoJust for completeness sake. In the EU a bachelor's is 3 years, a master 1 or 2 (2 being the standard) and a PhD 3-5 years. It depends on the country, so it's possible to get 3+2+5.
- tomcam 6y agoWhat a treat. Thanks for this submission.
- cmrdporcupine 6y agoWell, I don't feel like cleaning the basement or finishing my yard work before the snow, so I might just do this course over the holiday instead.
- jcq3 6y agoI'm interested by the topic but I'm a junior backend/data eng, do you think it could be helpful for my profile to dig into the concepts of compilers other than for the culture itself?
- mdergosits 6y agoI took the undergraduate version of this course while at Cornell. It was a wonderful course. I taught me a lot how computers work, and how to organize a large (for me at the time) software project. One of the most painful parts of the the project was using Scala which had ridiculously long compile times which made iterating quite a pain. My favorite memory was that for one project we had to submit a program written meant to stress test everyone's parser.
- mhh__ 6y agoNo code generation?
- helloycombinat 6y agoThat doesn't sound difficult? if (x86) write byte X, Y, Z else if arm write byte J K L
- glouwbug 6y agoIt looks like its more about generating IR. The professor wrote his own LLVM like tool called Brill, and use of the tool seems to be the focus of the course.
- jtlienwis 6y agoThey should renumber it CS 6502.
- glouwbug 6y agoFunny you mention 6502, because as wonderful as its assembly is, its not that friendly for higher level languages. I tried writing a basic C like language for it with 16 pointer support (see LDA ($ZP),Y), and came to the haunting realization that function calls require pushing the de-reference of zero page pointers to the stack which change their de-referencing address space from 0-255 (eg. main) to 256-512 for subsequent stack frames. I then realized that at a speed of 1MHz, that the pointer de-referencing, the stack frame magic, and endless copies to just parse basic expressions just made 6502 a pointless target for a C like language. It was fun though.
- fermentation 6y agoAny idea if I can jump right into this after my only experience being Crafting Interpreters?
- johntortugo 6y agoOf course. Why not?
- nandaja 6y agoAnyone interested in following the course together during the holidays? To keep each other motivated etc.
- mrtranscendence 6y agoI’m interested. I may not have the most relevant background, though — I’m a data scientist with an econometrics education. The topic really does interest me, though.
- nandaja 6y agoI'm a devops engineer. So not very related either!
- lanius 6y agoYes! How should we organize this? Maybe start with an IRC channel?
- nandaja 6y agoYes! an IRC channel would be great! Do you want to start it and post the info here? Or else I can start
- archi42 6y agoOh, compiler construction :) I really enjoyed that lecture during my M.Sc. "parallelization, just-in-time compilation, and garbage collection" sound fun, too. Especially JIT.
- pfdietz 6y agoNice, although I'd have wanted a segment on compiler testing.
- samps 6y agoIndeed; I previously had these papers on the list but had to take them out for time this semester: - Finding and understanding bugs in C compilers. Xuejun Yang, Yang Chen, Eric Eide, and John Regehr. PLDI 2011. https://dl.acm.org/citation.cfm?id=1993532 https://dl.acm.org/citation.cfm?id=1993532 - Compiler validation via equivalence modulo inputs. Vu Le, Mehrdad Afshari, and Zhendong Su. PLDI 2014. https://dl.acm.org/citation.cfm?id=2594334 https://dl.acm.org/citation.cfm?id=2594334
- pfdietz 6y agoThere are just too many fun things to teach. More recent paper: yarpgen https://github.com/intel/yarpgen/blob/main/papers/yarpgen-ooplsa-2020.pdf https://github.com/intel/yarpgen/blob/main/papers/yarpgen-oo...
- ibains 6y agoI’ve worked on multiple compilers (optimizations expert) at MSFT on VS and CUDA and gave developed a DSL and worked on Database Compilers. I can’t hire compiler people with right skills. We’re building an IDE and those parsers are written differently, and we use Scala packrat parser combinators. These courses teach very little judgement or industry relevant stuff. When do you use packrat parser vs LALR vs LL? Good luck hiring an engineer with advanced compiler courses knowing any of this. I’d like to sit down all university professors who teach compiler courses and teach them a course on what’s relevant.
- Ambroisie 6y agoWhat ressources do you recommend I read, or what I can do, to learn more about applicable compiler knowledge?
- throwaway_pdp09 6y agoPrev post by me, if it's any help https://news.ycombinator.com/item?id=25210523 https://news.ycombinator.com/item?id=25210523
- deleted 6y ago[deleted]
- cinericius 6y agoDo you think it is the responsibility of academia to teach "industry relevant stuff"? I agree that courses generally don't teach judgement well, but I do think that it is the workplace/industry's responsbility to train their engineers and not expect fresh grads to be fully equipped to work on something that specific.
- nicoburns 6y agoI definitely think there ought to be courses on such things available. There should be an educational route that is between pure academia which focusses on esoterica that is only relevant to research and vocational courses that don't include much innthe way of theory at all. The idea that industry ought to pay for it presumably comes from a background where universities are private an expensive. But I'd like to live in a world where these kind of courses were government subsidised and available for free or cheap.
- prando 6y agoHas anyone taken Compilers course from David Beazley: https://www.dabeaz.com/compiler.html https://www.dabeaz.com/compiler.html. I'd love to hear your feedback, please
- pbiggar 6y agoEven if you don't do the course, the first paper they list is a fascinating must-read: Producing Wrong Data Without Doing Anything Obviously Wrong! Todd Mytkowicz, Amer Diwan, Matthias Hauswirth, and Peter F. Sweeney. ASPLOS 2009. https://dl.acm.org/doi/10.1145/2528521.1508275 https://dl.acm.org/doi/10.1145/2528521.1508275 I happened to be at that ASPLOS and I thought it was fascinating. Good to see it recognized as one of the most important papers in compilers.
- nojvek 6y agoI wish they’d be more courses on compilers that also serve as language servers. The current world is moving towards a phase where a language needs IDE tooling such as compilers, linters, formatters, REPL, language servers, debuggers and profilers. Would love to see a high level course that covers how to build the tooling for a great developer experience.
- petr_tik 6y agoAs i mentioned in another thread, a uni course that has students work on an existing codebase instead of writing something from scratch might be even better - though harder to grade. Imagine if one could do a major feature contribution to clangd/pyls/rust-analyzer as part of their advanced compilers course. The student gets a better understanding of (open-source) software development practices, gains a deeper proficiency in the language (not just the APIs), the project brings new contributors and users (including the student herself) benefit from the new feature. Double bubble!
- weakfish 6y agoMy uni, NC State, has a course (CSC 326) called Software Engineering that has students contribute to an existing project created by the staff in teams, with the best contributions being merged into master for the next semester students to work on.
- petterparker 6y agoSame here in Munich, we've had a course on software-testing in OOP-languages and had to write unit-tests for some modules of jenkins which were graded and eventually merged into master.
- petr_tik 6y agoThat sounds pretty cool. Do you get a choice of what kind of project you want to contribute to?
- 6y ago
- Serious_Cheese 6y agoThis is amazing. Thank you for sharing.