About this website
Welcome to David’s PL Notes! This website contains a bunch of notes on topics on programming language (PL) implementation and theory. This site might be useful for you for a few reasons:
- You’re currently studying for the UC Berkeley PL Prelim, and you’re looking for topics to study, resources for those topics, and general notes on the relevant topics.
- You’re interested in PL generally, and are looking for readings & notes on a survey of different PL-related topics.
In either case, this site has a bunch of resources that might be helpful for you! Specifically, we have:
- A syllabus (see below) of different topics and readings that cover a broad range of PL topics.
- Reading notes on individual readings with respect to these topics.
- Topic notes that synthesize multiple (some of the reading notes do this as well)
- Study guides that summarize all of the different topics mentioned here (good as a guided index into the rest of the notes).
I originally wrote these notes in preparation for the Berkeley PL Prelim, so they’re provided as-is; I basically haven’t changed them since I copy-pasted them here, so a lot of them might make reference to Prelim-related things.
If you have any questions, feel free to email me (it’s on my website linked above).
Formatting caveats
As a consequence of me manually copy-pasting my notes to this site, there might be missing pages; this is unintentional, and you should let me know if you run into this!
Additionally, type judgments/derivations will look weird---they’re missing the horizontal line dividing consequence and consequent, because of LaTeX rendering weirdness with the static site generator I’m using. They’ll look like this:
Apologies in advance :^)
Extra Prelim-related notes
If you’re taking the PL prelim, there are a number of things to keep in mind. The syllabus suggests that, even though it lists a bunch of different topics and readings for those topics, those alone won’t be sufficient to cover the material needed:
Keep in mind that some topics---for example language design and implementation---are rather broad. It is expected that students can answer reasonable open-ended questions that go beyond the content of papers listed below.
But don’t let this intimidate you! For the most part, the PL prelim isn’t designed around memorization of specific vocabulary or parts of specific papers; rather, it’s about understanding and internalization of concepts. So while the reading serves as a useful resource and starting point to ground your understanding in each of the topics, you’ll probably find yourself naturally looking for other resources to help supplement your understanding of the topics!
As for how you can find these other resources, the short answer is: Google! A lot of the topics have extensive Wikipedia pages, along with lecture slides and notes from other folks who have helpfully uploaded their course materials online. When I studied for the test, a lot of how I acquired these extra bits of information was through these other auxiliary resources: lecture notes, StackOverflow answers, that sort of thing. I also used notes from other folks who had taken the PL prelim beforehand (see the extra resources in the section below this). If you’re looking for pointers to what kinds of readings are helpful for building understanding, all of the resources I used for each reading or topic are linked within the notes for those readings/topics, respectively. But this proecss will necessarily look different for everyone, and the readings that work for me might not necessarily work for you!
In general, these notes are meant to be a supplement, helpfully summarizing and explaining concepts that might have more dense explanations in other readings. Most of the studying and learning you’ll do is in taking your own notes though: internalizing and building intuition for these concepts yourself!
To give you an idea of how much reading and studying I did leading up to this test, the topics/readings listed below have checkboxes according to this legend:
- Uncomplete reading or topic
- Completed (or skimmed) reading or topic
- Missing reading
- % Optional reading (prepended with a
%
)
If you’d like to follow along with my study schedule, here’s the order I went in:
- First, I created the scheduled study notes, corresponding to the PL Prelim Study schedule provided by past students.
- Next, I created extra topic notes for topics that weren’t covered by this scheduled study.
- Finally, I created study guides in the week before the test to go over my old notes and figure out the key ideas to retain.
Extra resources
This folder from Manish contains past resources, including the CS 164 course reader, past schedules, past notes, and textbook PDFs.
These links also have some more readings if needed:
- https://dr.lib.iastate.edu/entities/publication/44b6d741-2fb8-4094-88ff-f7baa4ce7042
- http://www.cs.cmu.edu/afs/cs.cmu.edu/user/mleone/web/language-research.html
Scheduled study
Schedule from Notion
- 2024-06-17 • lambda calc 🔁 every week on Wednesday ⏳ 2024-06-19T14:30 ✅ 2024-06-19
- 2024-06-26 • type system extensions 🔁 every week on Wednesday ⏳ 2024-06-26T14:30 ✅ 2024-06-26
- 2024-07-03 • denotational semantics and fancy types 🔁 every week on Wednesday ⏳ 2024-07-03T14:30 ✅ 2024-07-05
- 2024-07-10 • optimizations and gc ✅ 2024-07-24
- 2024-07-17 • axiomatic semantics, domain theory ✅ 2024-07-18
- 2024-07-24 • dependent & effect types ✅ 2024-07-25
- 2024-07-31 • attribute grammars, ssa, cps ✅ 2024-07-26
- 2024-08-07 • control flow analysis & abstract interpretation ✅ 2024-07-30
- 2024-08-14 • program dependence graphs, program slicing, lazy abstraction ✅ 2024-08-06
- 2024-08-21 • auto-parallelization ✅ 2024-08-13
Study guides
One-page (ish) summaries of all the topics.
- 2024-08-20 • Prelim review - STLC and friends ⏳ 2024-08-20 ✅ 2024-08-22
- 2024-08-22 • Prelim review - type-checking and inference ✅ 2024-08-22
- 2024-08-23 • Prelim review - imperative semantics ✅ 2024-08-23
- 2024-08-24 • Prelim review - program analysis
- 2024-08-25 • Prelim review - language design and features
- 2024-08-25 • Prelim review - compiler innards
- 2024-08-26 • Prelim review - testing and verification ✅ 2024-08-26
Extra topics
Extra notes on topics that weren’t explicitly scheduled, or that aren’t explicitly mentioned in the syllabus but are things we’re expected (?) to know.
- continuations
- parsing ✅ 2024-08-09
- SAT and SMT solving
- program synthesis
- Datalog ✅ 2024-08-21
- egglog maybe ✅ 2024-08-21
- register allocation ⏳ 2024-08-20 ✅ 2024-08-21
- the general compiler pipeline ✅ 2024-08-22
- semantic analysis and implementing type-checking and inference ✅ 2024-08-22
- interprocedural analysis
- dataflow programming
- concurrency, memory consistency?
- proof assistants??
Syllabus
Languages
Goal
Know syntax, major features, and implementations of these languages. Be able to critique features (see Topics/features to know) and program and give examples in several of these languages.
- C
- C++ (classes, inheritance, templates)
- Java (reflection, generics)
- Python, Ruby
- Prolog and Datalog
- ML (type inference)
- Scheme (continuations, dynamic typing, macros)
The art of language design
Lightweight intro to (complexity of) PL design, broad motivating ideas behind (and critiques of various langs.
- Functional programming
- Can programming be liberated from the von Neumann style? ✅ 2024-08-06
- Backus’ “functional programming” is actually functional, point-free, and data parallel programming. He’s talking about APL!
- Hints on Programming Language Design ✅ 2024-08-06
- Why Functional Programming Matters ✅ 2024-08-05
- Lisp: Good News, Bad News, How to Win Big ✅ 2024-08-05
- Can programming be liberated from the von Neumann style? ✅ 2024-08-06
- Relevance:
Additional language design notes from Sarah’s 294
- 2024-01-30 • CS 294, 3Tu ✅ 2024-08-20
- 2024-03-12 • CS 294, 7Tu – Cognitive dimensions of notation ✅ 2024-08-20
- 2024-03-14 • CS 294, 7Th – How to design languages
Topics/features to know
- Macros (syntactic abstraction):
- The Swine Before Perl (regex extensions) ✅ 2024-08-06
- Higher-order abstract syntax (HOAS)
- https://beautifulracket.com/explainer/hygiene.html ✅ 2024-08-06
- Continuations (control abstraction)
- On implementing Prolog in functional programming
- usage of continuations in web frameworks
- Coroutines in Lua ✅ 2024-08-10
- Data abstraction and object oriented languages
- declarative (i.e., search-based) programming
- Datalog
- Max’s 294 course notes ✅ 2024-08-21
- Better Together: Unifying Datalog and Equality Saturation ✅ 2024-08-21
- data parallelism
- dataflow programming
Semantics & types
Readings
3 TAPL chapters ~ 1 paper; do memos accordingly
- TAPL: ch. 1-15 (skip 4, 7, 10), 20, 22-24 ✅ 2024-07-17
- Winskel: ch. 2, 3, 6, 7 (skip 7.1, 7.3) ✅ 2024-07-18
- see also denotational semantics and domain theory
- Winskel 5: The denotational semantics of Imp ✅ 2024-07-17
- Winskel 6, 7, 8: Axiomatic semantics and domain theory ✅ 2024-07-18
- Necula, CS 263: Introduction to Denotational Semantics ✅ 2024-07-18
- ATTAPL: ch. 2 (dependent types), 3 (effect types) ✅ 2024-07-25
- ATAPL 2: Dependent types ✅ 2024-07-23
- ATAPL 3: Effect types ✅ 2024-07-25
Optional
- % Girard, LaFont, and Taylor’s Proofs and Types chapters 2-7 are a remarkably compact presentation of the basic proof theory that makes types work.
- % Frank Pfenning’s Computation and Deduction covers similar ground, but in much greater detail. His webpage has a number of exceptionally readable papers on computational logic.
- % The explanation of denotational semantics in John C. Mitchell’s Foundations for Programming Languages is extremely clear and comprehensible. If you find Winskel to be frustrating, try this.
Implementation, program analysis, & optimization
See Dragon Book for general readings. See also discussion on HN about it for alternatives.
Basics
- Know techniques needed to implement a modern PL compiler
- Parsing
- Syntax-directed translation
- Semantic analysis (i.e., type-checking)
- Optimization
- Register allocation & code generation
- Readings
- Dragon Book (out of date ish)
- CS 164?
Extra topics
- Parsing (see CS 164 notes for first three items)
- Recursive-descent parser (in Prolog) ✅ 2024-08-09
- Packrat parsing ✅ 2024-08-09
- CYK parser (how to express this in Datalog) ✅ 2024-08-09
- Earley parser ✅ 2024-08-09
- % GLR parser
- Single Static Assignment
- Paper
- Dragon Book 5, 6.2.4: grammars & SSA ✅ 2024-07-30
- SSA is functional programming ✅ 2024-07-30
- Continuation-passing style (CPS)
- How it’s used in compiler intermediate languages ✅ 2024-07-26
- The essence of compiling with continuations ✅ 2024-07-26
- % Andrew W. Appel, Compiling with continuations
- Relationship between SSA and CPS ✅ 2024-07-25
- SSA is functional programming ✅ 2024-07-25
- How it’s used in compiler intermediate languages ✅ 2024-07-26
- Attribute Grammars and Syntax-directed Translation
- Dragon Book 5, 6.2.4: grammars & SSA ✅ 2024-07-18
- Control Flow Analysis, the Control Flow Graph, and its use in optimization
- Dependence Analysis & the Program Dependence Graph
- Polyhedral analysis its uses in locality optimizations and automatic parallelization
- Dragon Book 10, 11: Parallelism (§11.9)
- “Basic optimizations”
- e.g. constant propagation, dead code elimination, global value numbering, loop invariant code motion, inlining
- Brief overview in Dragon Book 2nd Ed, 9.1 ✅ 2024-07-18
- See also program optimization
- Run-time optimizations (e.g. Java Hotspot)
- Java Implementation and HotSpot Optimizations ✅ 2024-07-24
- See also program optimization
- Garbage collection vs manual memory management
- Uniprocessor garbage collection techniques ✅ 2024-07-23
- % This survey covers a wide breadth of material.
- Language tooling (and its implementation)
- e.g., refactoring, syntax completion, code generators
- 2024-04-11 • CS 294, 12Th – Projectional Editors
- deprioritize
- FFI issues
- e.g., incompatible memory management
- Automatic parallelization
Static analysis
- Data Flow Analysis
- paper
- Dragon Book 9: Machine-independent optimization
- % and one of the original papers.
- Abstract Interpretation
- Graph Reachability and CFG-Reachability
- Expression equivalence as in Value Numbering
- Type inference based analysis
- TAPL §22: Type reconstruction
- semantic analysis ✅ 2024-08-22
- Alias analysis
- Alias Analysis for Object-Oriented Programs ✅ 2024-07-29
- See notes for additional resources/links
- Alias Analysis for Object-Oriented Programs ✅ 2024-07-29
- Control-flow analysis (k-CFA). Tradeoffs between flow-(in)sensitive, path-(in)sensitive, and context-(in)sensitive analyses.
- Principles of Program Analysis 3: Constraint-based analysis ✅ 2024-07-27
- See notes for additional resources/links
- Principles of Program Analysis 3: Constraint-based analysis ✅ 2024-07-27
Extra
- % Gruene, Jacobs book on parsing, a veritable encyclopedia, but unlike the Dragon book it includes the last 30 years’ innovations (like GLR). It also has the classics, including FSAs for lexing.
- % Abstract Interpretation in a Nutshell (incorporated into abstract interpretation) ✅ 2024-08-06
- % parallelizing compilers (eg kennedy and allen)
Algorithmic verification, testing, and debugging
- A survey of program slicing techniques ✅ 2024-08-05
- https://www.ssw.uni-linz.ac.at/General/Staff/CS/Research/Publications/Ste99a.html, chapter 3 (CS 294) ✅ 2024-08-05
- % http://www.r-5.org/files/books/computers/compilers/writing/Keith_Cooper_Linda_Torczon-Engineering_a_Compiler-EN.pdf (in general)
- Lazy abstraction
- Software model checking. Ranjit Jhala and Rupak Majumdar. ACM Comput. Surv. 41, 4, Article 21 (October 2009), 54 pages. http://doi.acm.org/10.1145/1592434.1592438
- Hybrid dynamic data race detection
- DART: directed automated random testing
- % James C. King. 1976. Symbolic execution and program testing. Commun. ACM 19, 7 (July 1976), 385-394. DOI=10.1145/360248.360252 http://doi.acm.org/10.1145/360248.360252 (superceded? by dart)
- % Leo suggests there is a recent OAKLAND survey/overview: All You Ever Wanted to Know About Dynamic Taint Analysis and Forward Symbolic Execution.
- SAT and SMT solving
- Satisfiability Modulo Theories
- % Solving SAT and SAT Modulo Theories (superceded by the above)
- % Greg Nelson, Derek C. Oppen: Simplification by Cooperating Decision Procedures. ACM Trans. Program. Lang. Syst. 1(2): 245-257 (1979) (extra)
- Verification tools for finite-state concurrent systems
- Construction of abstract state graphs with PVS
Optional
- % C. Flanagan, K. R. M. Leino, M. Lillibridge, G. Nelson, J. B. Saxe, R. Stata Extended Static Checking for Java Proceedings of the ACM SIGPLAN 2002 Conference on Programming language design and implementation (PLDI 2002) Tool publicly available at http://research.compaq.com/SRC/esc/
- % S. Malik and L. Zhang, Boolean Satisfiability: From Theoretical Hardness to Practical Success, Communications of the ACM, vol. 52, no. 8, August 2009.
- % E.A. Lee and S. Seshia, Introduction to Embedded Systems, A Cyber-Physical Systems Approach, 2nd Edition. Chaps. 13 and 15. http://LeeSeshia.org.
- % Clarke, Grumberg, and Peled. Model Checking (MIT press). Chapters: 1. Introduction, 2. Modeling Systems, 3. Temporal Logics, and 4. Model Checking
- % Symbolic model checking: 10^20 States and beyond. J.R. Burch, E.M. Clarke, K.L. McMillan, D.L. Dill, L.J. Hwang, Information and Computation, Volume 98, Issue 2, June 1992, Pages 142-170, ISSN 0890-5401.http://www.sciencedirect.com/science/article/B6WGK-4DX44C6-6T/2/fe89ddab72b8634621ce5d293f3a8660
- % A machine program for theorem-proving (DPLL paper). Martin Davis, George Logemann, and Donald Loveland. 1962. Commun. ACM 5, 7 (July 1962), 394-397. http://doi.acm.org/10.1145/368273.368557
- % Chapters on constraint-solving based, and type/effect systems found in Nielson et al.’s Principles of Program Analysis http://www.amazon.com/Principles-Program-Analysis-Flemming-Nielson/dp/3540654100
- % Greg Nelson: Techniques for Program Verification.Ph.D. Thesis. 1980.
- % Randal E. Bryant. Graph-Based Algorithms for Boolean Function Manipulation, IEEE Transactions on Computers, Vol. C-35, No. 8, August, 1986, pp. 677-691
- % Manuvir Das, Sorin Lerner and Mark Seigle. ESP: Path-Sensitive Program Verification in Polynomial Time. PLDI 2002.
- % Something on abstraction (say one of the early SLAM/Blast papers or Graf-Saidi).
- % Static checking of assertions/annotations, maybe ESC/Java paper (Extended static checking for Java, Flanagan, et al., PLDI 2002)
- % Specification inference, invariant generation, eg DAIKON.
Mock prelims
Random with Justin
- 2024-08-12 • Prelim, Justin grab bag 🔁 every week on Monday ⏳ 2024-08-12T12:30—13:30 ✅ 2024-08-12
- 2024-08-05 • Prelim, Justin grab bag 🔁 every week on Monday ⏳ 2024-08-05T12:30—13:30 ✅ 2024-08-06
- 2024-07-29 • Prelim, Justin grab bag 🔁 every week on Monday ⏳ 2024-07-29T12:30—13:30 ✅ 2024-07-29
Targeted with Justin
- 2024-08-14 • Prelim, Justin targeted - auto-parallelization 🔁 every week on Wednesday ⏳ 2024-08-14T14:00—15:00 ✅ 2024-08-14
- 2024-08-07 • Prelim, Justin targeted - program slicing 🔁 every week on Wednesday ⏳ 2024-08-07T14:00—15:00 ✅ 2024-08-08
- 2024-07-31 • Prelim, Justin targeted - abstract interpretation 🔁 every week on Wednesday ⏳ 2024-07-31T14:00—15:00 ✅ 2024-07-31
Parker one-off
- 2024-08-09 • Prelim, Parker grab bag - axiomatic semantics ⏳ 2024-08-09T13:00 ✅ 2024-08-10
Federico one-off
- 2024-08-21 • Prelim, Federico grab bag ⏳ 2024-08-21T12:00—13:00 ✅ 2024-08-22