Sergey Bratus, Fall 2024
Syllabus
X-hour (used only if previously announced)
3:30-4:30pm in ECSC room B10
TAs
J. Peter Brady, john.p.brady.gr [at] dartmouth.edu;
Office hours: Wednesdays 8-9 pm on Zoom. I can do other times on Zoom, just send an email. I’ll use the same ID for this term.
Quick link: https://dartmouth.zoom.us/j/93383812305?pwd=rXViv9le6vhzYX6yd2H6a8WD30iG6t.1 (Meeting ID: 933 8381 2305; Passcode: 250672)
Zeph Lucas, Zephyr.S.Lucas.GR [at] dartmouth.edu;
Office hours: Saturday from 1pm to 3pm in ECSC 214
What this class is about
The history of programming languages is about enabling programmers to write the least amount of code to do what they wanted, and then to spend the least amount of time debugging it before or after it got shipped. Many approaches to achieving these goals were tried over the years, and several styles of programming were invented, including functional programming, object-oriented programming, and type-driven programming. Each one advanced our understanding of how to program more concisely and with fewer errors caught as early as possible—and each one fell somewhat short of the intended perfection.
As these ideas about programming styles and languages evolved, the concepts of recursion, closures, lambdas, continuations, strong and weak typing, polymorphism, reflection, inheritance, pattern matching and destructuring, dependent types, memory safety, and many others have crossed from theory to everyday programmer discussions, meetups, and interviews. Lately, memory safety was directly referenced in the US Presidential Executive Orders and government policy documents, as a way towards enhancing cybersecurity and resilience of the US national infrastructure.
Long story short, this is an interesting time for learning about programming languages and joining PL research both in industry and in academia.
Class materials
Lecture notes, examples, and assignments will be posted here.
When posted, new materials will be announced on the course mailing list. Please make sure you are on it! Also please make sure emails from me don’t fall into your spam folder. If so, please let me know, so that I can take it up with the college IT.
C and Assembly (ARMv8/Aarch64)
A very detailed tutorial for ARMv8 assembly of Apple’s M1–M3 laptops: https://mariokartwii.com/armv8/. Function stack frames are explained in https://mariokartwii.com/armv8/ch27.html
Examples from Lecture 1: c-and-armv8
ARMv8 Instruction Set Overview — search in this document for assembler commands like TBNZ or SUBS. The latter search works better as “SUBS “. One exception: conditional branches are all glommed under B.cond (p.22), with the “cond” variants explained in the table on p.16.
Armv8-A Instruction Set Architecture – Read pages 12, 15, 22-23, 24-25, 26 (top half), 27-30, 33-35.
Cheat sheets on LLDB vs GDB: https://lldb.llvm.org/use/map.html, https://aaronbloomfield.github.io/pdr/docs/gdb_vs_lldb.html, https://stackoverflow.com/questions/9707883/gdb-vs-lldb-debuggers (I had all three opened). Unfortunately, GDB is not supported on M{1,2,3} Apple silicon.
Examples from Lecture 2: c-and-armv8 – Read my annotations in .s files, marked with “SB:”
Examples from Lecture 3: c-and-armv8 – LLBD log with annotated examples, memory corruption log
Examples from Lecture 4: c-and-armv8 – LLBD log of resolving a global C variable linked across compilation units
A note on Aarch64 Linux virtual machines
LISP
LISP in-class logs from the language introduction and recursion classes
An interlude on making systems safely and quickly changeable
Obarray in-class examples, lambda and let examples, eLisp bytecode disassembly
eLisp VM bytecode examples and links
Currying and closure notes: 1 2 3
Tail call optimizations (TCO) notes (see “named-let”)
Lambda calculus
Lambda calculus notes: intro and booleans more pair S combinator Y combinator
Scheme, continuations
Scheme, Continuation passing style, and CALL/CC notes
Continuations from the ground up
OOP
Object oriented programming, deconstructing C++
Haskell
Haskell and Hindley-Milner type system
Project
Materials from past years can be found in https://www.cs.dartmouth.edu/~sergey/cs59/.