Class M/W 9:30 - 10:50 a.m. in GHC 4102
Recitation F 10:00 - 10:50 a.m. in GHC 4211
Fall 2024
12 units
Jonathan Aldrich
aldrich at cs dot cmu dot edu
TCS 422
Office hours: Friday 3:30-4:30pm
For appointments outside of office hours, email the instructor.
TA Anrui Liu
Office hours: Wednesday 5-6pm, TCS 4th floor
Course Description
This course provides a broad and pragmatic foundation in the most basic tool of the programmer: programming languages. It starts with the fundamentals of syntax, parsing, and binding, the core structural concepts in programming languages. The course will then cover program semantics and type systems, and students will learn to relate them with a type soundness theorem. Finally, a coverage of intermediate optimization and code generation offers the opportunity to discuss both producing efficient code and reasoning about the correctness of program transformations. Assignments involve a combination of tool-assisted formal reasoning and proofs about programming languages, and implementing these language constructs in a compiler.
New for 2024: a Rust emphasis! 17-363 is being revised to center the Rust programming language. Rust is fast, safe, and growing quickly in popularity in industry--it's like the next "systems" language in many organizations. In addition to the core material on programming languages described below, you'll learn about Rust features like ownership, traits, safe concurrency. The implementation assignments in the course (about 4 of 8) will involve building a compiler in Rust, so you'll get plenty of hands-on experience with the language.
Prerequisites. Programming maturity and knowledge of reasoning about programs equivalent to passing 15-150, and mathematical maturity equivalent to passing either 15-251 or 21-228). Students with substantial math and programming experience who have not satisfied the specific prerequisites can contact the instructor for permission to enroll.
Requirements Satisfied.This course fulfills the Logic and Languages constrained elective category for the Computer Science major.
Why take this course?
- Programming Languages and Compilers are fundamental to programming, and you can learn about both in one course. By understanding the semantics of languages, you become a better programmer. After understanding how languages are compiled, you will be able to use them better. And it's not unlikely that you'll need to design a little language yourself someday--a scripting language or configuration for your application, for example--so it's good to know how to do it well!
- Learn the theory of languages, with the help of an educational tool. Programming language semantics and type theory is beautiful and fundamental not only to programming but even to the foundations of mathematics. While it sometimes has a reputation for being inaccessible, I've designed a tool called SASyLF that is easy to use and helps you get your proofs right. It's been used successfully at several universities--students like it and we believe it helps make these topics easier and more rewarding!
- Our pragmatic approach positions language and compiler concepts in the setting of industrial languages. We'll cover foundational ideas like the lambda calculus, but we understand that many students want to apply those ideas to languages familiar to them. This course will focus on covering fundamental ideas as they come up in widely-used languages, both making the ideas concrete and also ensuring that what you learn is relevant to your career as a computer scientist or software developer.
How does this course compare to CMU's other PL/compilers courses?
First of all, CMU has an amazing selection of courses in this area-you can't go wrong! But this course has some differences that make it a particularly great match for some students:
- Compared to 15-312 Foundations of Programming Languages, this course includes the use of a proof assistant (SASyLF), and takes as its point of departure Rust rather than Standard ML. It gives up some depth specifically on type theory but in exchange includes more content on compilers.
- Compared to 15-411 Compiler Design, this course involves less programming and more proofs (this is true of all Logic and Languages courses, since learning about rigorous proofs is one of the goals of the category). It gives up some depth specifically on compilation, but in exchange includes more programming language and type system content. And don't worry, half of the assignments are programming-you'll still build a compiler!
Course Syllabus and Policies
The syllabus covers course learning objectives, supplemental textbooks, assessments, late work policy, and policies.Schedule
Date | Topic and Slides | Additional Reading or Code | Assignments Due |
---|---|---|---|
Aug 26 | Course Introduction | PLP, chapter 1; handout | |
Aug 28 | Names, Scopes and Bindings | PLP, chapter 3 | |
Aug 30 | RecitationIntroduction to Rust | HW0: Adder | |
Sep 2 | Labor Day - no class | ||
Sep 4 | Inductive definitions and proofs | 04-formal.pdf; in-class exercise | |
Sep 6 | RecitationThe SASyLF Proof Assistant | 04-formal-sasylf.pdf | HW1: Boa |
Sep 9 | Dynamic semantics: Big-step | lecture05-big-step.pdf; in-class exercise | |
Sep 11 | Dynamic semantics: Small-step | small-step.pdf; in-class exercise and solution | |
Sep 13 | RecitationDynamic semantics practice | HW2: Inductive proofs | |
Sep 16 | Control Flow | PLP chapter 6 | |
Sep 18 | Semantic Analysis | PLP chapter 4, lecture notes on typing | |
Sep 20 | RecitationCompiling control flow | HW3: Dynamic Semantics | |
Sep 23 | Ownership in Rust | ||
Sep 25 | Functions | ||
Sep 27 | Recitation | HW4: Cobra | |
Sep 30 | Type Soundness | lecture notes on soundness | |
Oct 2 | Type Checking | PLP chapter 7 | |
Oct 4 | RecitationStatic semantics practice | HW5: Diamondback | |
Oct 7 | Mid-semester exam 1 | ||
Oct 9 | Allocation and composite types | ||
Oct 11 | No recitation | ||
Oct 21 | Garbage collection | ||
Oct 23 | No class | HW6: Static semantics | |
Oct 25 | No recitation | ||
Oct 28 | Local optimization and correctness | PLP chapter 17; value num example soln; in-class exercise soln | |
Oct 30 | Lexical analysis | PLP chapter 2 | |
Nov 1 | Optimization and correctness practice | HW7: Egg Eater | |
Nov 4 | Dataflow analysis | PLP chapter 17; example 1 soln, example 2 soln, in-class exercise solutions | |
Nov 6 | Top-down parsing | PLP chapter 2 | |
Nov 8 | RecitationGarbage collection, program analysis | HW8: Translation correctness | |
Nov 11 | Safe Concurrency in Rust | PLP chapter 13 | |
Nov 13 | Functional programming and error handling in Rust | HW9: garbage collection or lexing/parsing | |
Nov 15 | RecitationProject discussion | Project Proposal | |
Nov 18 | Instruction scheduling and and register allocation | ||
Nov 20 | Dataflow analysis, global optimization, and SSA form | ||
Nov 22 | Recitation2nd midterm review | ||
Nov 25 | Midterm exam 2 | ||
Nov 27 | No class - Thanksgiving break | ||
Nov 29 | No RecitationThanksgiving break | ||
Dec 2 | Packages, Crates, and Macros in Rust | ||
Dec 4 | Programming Languages Research | ||
Dec 6 | Project help/advice | ||
Finals week | Project presentations | Project presentations and final deliverables |