198:515 - Programming Languages and Compilers I
Fall 2005

Lecture Notes


IMPORTANT: To be ecologically sensitive, I am posting the lectures in 2-up format;
please always use double-sided printing.

References to the Aho, Sethi, Ullman compiler book are marked as ASU.
Reference to the Sethi programming languages text are marked as S.

Lecture 1 (9/12/2005): Review of parsing notes 2-up for printing
Table-driven parsing techniques: LL, SLR. LR, LALR
Homework: ASU 4.39, 4.40, 4.44 (due in 2 weeks)
Readings: ASU Ch 4.4-4.5, 4.7-4.8
Slides covered: #1-44

Lecture 2 (9/19/2003): Attribute Grammars notes 2-up for printing
Sythesized and inherited attributes, syntax-directed translation,
S-attributed and L-attributed grammars, Grammar evaluation interleaved with parsing
Readings: ASU Ch 5.1-5.4, 5.6
Slides covered: Attribs #1-41; Prolog #1-10 (see Lecture 3)

Lecture 3 (9/22/2005): Prolog notes 2-up for printing
Logic programming, database examples, Prolog syntax and data structures,
Models of execution, Prolog search trees, treewalk example
Prolog II notes 2-up for printing
Readings: S Ch 11
Slides covered: Prolog #11-33; Prolog II #1-14
Slides corrected: Prolog #13,33

Lecture 4 (10/7/2005): Prolog, cont.
Generate and test paradigm; factorial, use of the cut
Parsing with Prolog notes 2-up for printing
Warren SPE'80 paper shows how to prototype a compiler's parsing, relocatable code generation,
and assembly passes using properties of logical variables in Prolog.
Reading a Prolog Trace notes 2-up for printing
Readings: D.H.D. Warren, "Logic Programming and Compiler Writing",
Software Practice and Experience, vol 10, 1980
(BRING YOUR COPY OF THIS PAPER TO CLASS)
Slides covered: Prolog II #15-23; Prototyping Compiler #1-23; Prolog Trace #1-7;
Slides corrected: Prototyping Compiler #8,9,15,20

Lecture 5 (10/10/2005): Types notes 2up for printing
Type reconstruction, Type safety, type checking, polymorphism,
typing functions using unification
Types Handout (Please bring this to class.)
Readings: S Ch 4.1,4.2,4.5,4.9; ASU Ch 6.1, 6.3-6.6
Slides covered: Types #1-34

Lecture 6 (10/17/2005): Non-standard Types
Using types to embody safety properties of pointer usage notes 2-up for printing
Typing pointer usages in C programs
(CCured project, G. Necula's research group at University of California at Berkeley)
Notes on our Prolog project
Slides covered: PrologProjectNotes #1-3; Non-standardTypes #1-19
Slides corrected: Non-standardTypes #3

Lecture 7 (10/24/2005): Lambda Calculus notes 2-up for printing
Basic definitions, function abstraction and application, substitution rules,
Readings: S Ch 13.6, 14.1-14.4;
on reserve: exerpts from Glaser et.al, Principles of Functional Programming, Ch 3.1-3.3
Slides covered: Lambda Calculus #1-38

Lecture 8 (10/31/2005): Intro to SML
primitive datatypes, variables, let expressions, lists,
functions and control expressions
Slides covered: SML #1-17
Slides corrected: SML #23,26
Readings: S Ch 8,9
MIDTERM EXAM -- OPEN BOOK, OPEN NOTES

Lecture 9 (11/7/2005): SML, cont.
pattern matching param-arg associations, higher order functions,
exceptions, mutually recursive functions
A parser in SML using exceptions and higher order functions
(Please bring this to class.)
More SML
higher-order functions: reduce
Readings: please also consult the Syllabus for additional resources on SML
Slides covered: SML #18-32; SML-II #1-9

Consult How to run SML and try programs on paul in directory ~ryder/sml/programs/*
and look at traces in ~ryder/sml/traces/*
Here is our streams example program for you to try out.

Lecture 10 (11/14/2005): More SML, cont.
user defined types in SML, functions associated with these types,
higher-order functions: foldl, using function abstraction to build streams
Here is a trace of the use of the streams example program posted last
week. Please bring the program and the trace to class tonight.
Lambda Calculus II notes 2-up for printing
Programming in Lambda Calculus, simulating natural numbers,
Readings: Glaser (see week 7); G. Michaelson, "An Introduction to
Functional Programming Through Lambda Calculus",
Addison-Wesley, 1989, Ch 4 on recursion;
Slides covered: SML-II #10-26, Lambda Calculus II #1-10.

Lecture 11 (11/20/2005): Lambda Calculus II, cont.
Defining recursive functions as fixed points, Y combinator
OOPLs-Data Abstraction/Iterators notes 2-up for printing
Introduction to data abstraction in CLU, mutability, equality checking,
kinds of operations (mutators, observers, constructors), iterators
Readings: B.Liskov and J.Guttag, "Abstraction and Specification in
Program Development", out of print but copy of Ch 4 on reserve in Rutgers online library system)
See also, Barbara Liskov, Alan Snyder, Russell Atkinson, Craig Scheffert,
"Abstraction Mechanisms in CLU", CACM August 1977,
available in the ACM Digital Library
Slides covered: #1-22

Lecture 12 (11/28/2005): OOPLs-Call Graph construction notes 2-up for printing
type-based and partially-flow-based analyses of reference
variables and fields, class hierarchy analysis, rapid type analysis,
Tip-Palsberg class analysis
SOOT notes 2-up for printing
Readings:1. J. Dean, D. Grove, C. Chambers, Optimization of
OO Programs Using Static Class Hierarchy, ECOOP'95
2. D. Bacon and P. Sweeney, "Fast Static Analysis of C++ Virtual
Functions Calls", in Proceedings of ACM SIGPLAN Conference
on Object-oriented Programing Systems, Languages and Applications (OOPSLA'96),
pp 324-341, October 1996
3. F. Tip and J. Palsberg, "Scalable Propagation-based Call Graph Construction
Algorithms" in Proceedings of the ACM SIGPLAN Conference on Object-oriented
Programming Systems, Languages and Applications (OOPSLA'00), pp 281-293, October 2000.
(The last 2 are available in the ACM Digital Library)
Slides covered: CallGraph #1-33; Soot #1-16
Slides changed: Soot #13
More CLU examples

Lecture 13 (12/2/2005): OOPLs-Points-to Analysis notes 2-up for printing
points-to analysis of C, Steengaard's and Andersen's algorithms,
FieldSens analysis and Object-sensitive analysis for Java
OOPLs-Method Resolution notes 2-up for printing
How to deal with dynamic dispatch? Overriding and Overloading,
Java's rules for overloading
Slides covered: Points-to: #1-20; MethodResol: #1-41

Lecture 14 (12/12/2005): OOPLs-Models of Inheritance notes 2-up for printing
Properties of inheritance, models: class-based, delegation, mixins
as code reuse versus as subtyping
Slides covered:

Last updated by Barbara Ryder at 3:23pm on December 12, 2005