CSE 428: Lectures
The following is the summary of lectures given so far. For each lecture
you find the list of topics covered, and the reference material. The books
are indicated by the name of their author(s).
WEEK 1 (Jan 11)
- Tue.
Introduction. Administrativia. Overview
of the course. (Sethi, 1.3)
The formal definition of Programming Languages. Syntax: Context Free Grammars,
derivations, language generated by a grammar. [Lecture
notes] (Sethi, 2.1-4)
Thu. Class canceled due to bad weather.
WEEK 2 (Jan 18)
- Tue.
Syntax: Derivation trees. Ambiguity. A simple language
of expressions. Precedence and associativity.
[Lecture notes] (Sethi, 2.4-5)
- Thu.
Examples of syntax of programming languages:
The syntax of C (Sethi, Figure 3.16 at page 91 and figure at page 588).
The syntax of Pascal (Sethi, Figure 3.3 at page 65).
Dangling-else ambiguity.
Use of parse trees in language implementation.
Exercise: Adding parentheses to the language of expressions.
[Lecture notes]
(Sethi, 2.6)
WEEK 3 (Jan 25)
- Tue.
Extending the language of expressions
with boolean expressions and if-then-else.
The Operational Semantics of expressions.
A simple "eval" interpreter for the language of expressions.
Adding identifiers and declarations.
Environment and scope
[Lecture notes].
The Operational Semantics is treated also in (Sethi, 13.3).
where it is called "Natural Semantics".
- Thu.
Introduction to the Imperative paradigm. Environment and State in Imperative
Languages. Assignment, Conditional, and While command.
Declarations of variables and blocks.
The notion of scope
[Lecture
notes] (Sethi Ch. 3,
excluding Sections 3.5 and 3.6).
See also John Hannan's lecture notes
on the semantics of imperative programming.
WEEK 4 (Feb 1)
- Tue.
Introduction to procedures and functions.
Parameter-passing methods: Call by value,
by reference, by value-result, and by name.
(Sethi 5.1 and 5.2)
(There are no lecture notes: this material is treated
well enough in the book.)
- Thu.
Static (lexical) and dynamic scope.
(Sethi 5.3 and 5.4)
Recursion.
Handling of formal parameters in recursive procedures.
The expressive power of recursion.
[Lecture notes]
WEEK 5 (Feb 8)
- Tue.
Activation records.
The stack-like discipline in the management of the
activation records (e.g. Algol, Pascal, C).
Lexical scope and nested declarations of
functions and procedures (e.g. Pascal):
necessity of a static link.
Lexical scope and dynamic
creation of functions (e.g. ML):
necessity of using the Heap
and garbage-collection.
Tail recursion and optimization of tail-recursive
procedures and functions.
(Sethi 5.5-7)
- Thu.
A brief overview of data types
in modern (high-level) programming languages.
Pointers. Dynamic memory allocation and deallocation.
Dangling references and memory leaks.
(Sethi Ch 4, excluding Sections 4.5, 4.6 and 4.9)
WEEK 6 (Feb 15)
- Tue.
Abstract Data Types.
The concept of abstraction from implementation.
Definition of ADT in C and in Pascal. Example:
implementation of the ADT "list" in Pascal
[Lecture notes].
Protection and information hiding.
Lack of protection mechanisms in C and Pascal.
Modules in Modula 2.
Classes in C++.
Protection in C++: private, protected,
and public members.
(Sethi Ch 6.1-5, excluding Section 6.3)
- Thu.
Structures and classes in C++.
Data and methods. Constructors and destructors members.
Object creation in C++: by using a
declaration, and dynamically by using "new".
The concept of "this".
Example: definition of a circular list in C++.
(Sethi Ch 6.5-6)
WEEK 7 (Feb 22)
- Tue. Exercises of preparation for the Midterm exam.
- Thu.
Example of Programming in C++: The Erathostenes' Sieve.
demand driven solution,
data driven solution.
(Sethi Ch 7.5)
WEEK 8 (Mar 1)
- Tue. Polymorphism in C++: templates
(Sethi Ch 6.7).
Example: parametric lists in C++.
More about destructor methods on C++.
When are descructors activated (delete, variables
going out of scope) and not activated (change of value of a
pointer, returning the value of a function.)
- Thu.
Java. Creation of objects in Java,
comparison with C++.
Threads in Java.
The methods start() and run().
Example: the program Ping-Pong.
Need for synchronization.
Example: two holders of the same bank account.
Synchronized methods.
(Arnold-Goslin Ch 9.1-2)
WEEK 9 (Mar 15)
- Tue. Process communication in Java:
the methods wait() and notifyAll().
Example: a one-position buffer shared by
producer and consumer processes.
[Lecture notes]
(Arnold-Goslin Ch 9.3-4).
A brief explanation of interfaces in Java
(Arnold-Goslin Ch 4).
- Thu.
Interrupts and Interrupted Exceptions in Java. The problem of deadllock.
(Arnold-Goslin Ch 9.5-7).
The Erathostenes' Sieve:
multithreaded solution.
WEEK 10 (Mar 22)
- Tue. (Lecture given by Prof. Dale Miller)
Introduction to functional programming and ML.
Expressions and declarations.
Recursive functions.
Definition by pattern-matching.
Lists in ML. Examples.
Considerations about memory management and sharing.
[Lecture notes]
(Sethi Ch 8, excluding 8.1 and 8.6..
Sethi 9.1 and 9.2)
- Thu. (Lecture given by Prof. Dale Miller)
Types in ML.
Concrete types.
Polymorphic types.
[Lecture notes (Adapted from John Hannn's LN
for 428, Fall 98.)
Note: The datatype for bynary trees considered in these lecture notes is
different from the one of Assignment #7, because the base case is a leaf
instead of the empty tree. The empty tree cannot be represented in
this definition.]
(Sethi 9.4 and 9.5)
See also [Additional lecture notes by Dale
Miller]
WEEK 11 (Mar 29)
- Tue.
Answers to some questions about ML: use of parentheses,
non-exhaustive matchings, and equality types.
Examples of programs on binary trees.
[Lecture notes]
- Thu.
Higher Order in ML. Higher-order types. Functions as argument
of other functions.
Example: the function "map"
fun map(f,[]) = [] | map(f,x::l) = (f x)::(map(f,l));
Expressions denoting a function (anonymous functions).
Functions as result of other functions.
Example: the function "accumulate"
fun accumulate(v,f)= fn x => if x=0 then v else f(x,accumulate(v,f)(x-1));
(Sethi 9.3).
For further reading, see
(Reade Ch 2.2).
WEEK 12 (Apr 5)
- Tue.
Preparation for the midterm.
Review of the concepts related to thread synchronization in
Java. Exercises in ML: representation of sets as lists, and
definition of the operations of union, intersection, occurrence.
Breadth-first visit of a binary tree.
- Thu.
Currying.
Introduction to Types.
The type system of ML.
[Lecture notes]
(Sethi 8.6 and 9.4)
WEEK 13 (Apr 12)
- Tue.
Deriving the type of a given expression. Examples.
Deriving an expression for a given type. Examples.
Most general type.
Expressions without type.
Types without expression ("not inhabited").
A necessary condition for
types to be inhabited.
Function declarations. How to derive the type of a
recursive function.
[Lecture notes]
- Thu.
Introduction to Logic Programming and Prolog.
Distinctive features: Unification and backtracking.
Applications: AI, fast prototyping, Databases.
Programs: facts and rules. Querying a program.
Example: a database representing the
matherhood relation. Deriving new relations:
grand_mother and ancestor.
[code]
(Sethi 11.1 and 11.2)
WEEK 14 (Apr 19)
- Tue.
Lists in Prolog.
Functions defined by predicates.
Example: Definition of append.
Comparison with ML.
Invertibility. Use of append
for splitting a list.
Example: Permutation of a list.
Negation.
Example:
Eliminating all the
occurrences of a certain
element from a list.
Arithmetics in Prolog.
[code of examples]
(Sethi 11.2 and 11.3)
- Thu.
Discussion about Exercise #4 in Assignment #9 (queens).
A possible approach: "generate and test"
(also called "guess and verify" in Sethi).
Syntax and Operational Semantics of (the core of) Prolog.
Unification. SLD-trees (also called Search trees in Sethi).
Leftmost selection rule. Depth-first visit of the tree.
The order of atoms in a body (or query)
and the order of clauses affects the order of solutions,
and the presence/absence of infinite loops.
(Sethi 11.4 and 11.5)
WEEK 15 (Apr 26)
- Tue.
Information about the
final exam.
Example: a Prolog program to solve
intelligence tests based on analogies
of figures
[code].
Example: a Prolog program for the invisit of a binary tree
[code].
- Thu.
Public discussions about questions, relevant for the
final, asked by the students.