CSE 428: Lectures
WEEK 1 (Jan 10)
- Tue.
Introduction. Administrativia. Overview
of the course. (Sethi, 1.3)
-
Thu.
The formal definition of Programming Languages.
Example: a subset of the English sentences.
Syntax: Context Free Grammars,
derivations, language generated by a grammar. [Lecture
notes] (Sethi, 2.1-4)
WEEK 2 (Jan 17)
- Tue.
Syntax: Derivation trees. Ambiguity. A simple language
of expressions. Precedence and associativity.
[Lecture notes] (Sethi, 2.4-5)
- Thu.
Exercise: unambiguous grammars for the language of balanced
parentheses.
Expressions with a left-associative operator ("-").
Expressions with a right-associative operator ("^").
Dangling-else ambiguity.
Use of parse trees in language implementation.
[Lecture notes]
(Sethi, 2.6)
(Assignment 1 distributed)
WEEK 3 (Jan 25)
- Tue.
Extending the language of expressions
with identifiers and declarations.
Environment and scope
[Lecture notes].
A simple "eval" interpreter for the language of expressions.
[Lecture notes (interpreter for exp)].
- Thu.
Introduction to the Imperative paradigm. Environment
and State in Imperative
Languages. Assignment, Conditional, and While command.
Declarations of variables and blocks.
[Lecture
notes] (Sethi Ch. 3,
excluding Sections 3.5 and 3.6).
(Assignment 1 due, Assignment 2 distributed)
WEEK 4 (Jan 31)
- Tue.
An interpreter for a mini imperative language.
[Lecture notes (interpreter for imp)].
- Thu.
Introduction to procedures and functions.
Parameter-passing methods: Call by value,
by reference, by value-result, and by name
[Lecture notes].
(Sethi 5.1-3)
(Assignment 2 due, Assignment 3 distributed)
WEEK 5 (Feb 7)
- Tue.
Some issues about compilation.
Activation records.
Stack-based implementation for imperative languages.
Lexical scope and dynamic scope.
Lexical scope and nested declarations of
functions and procedures:
necessity of a static (access) link.
[Lecture notes].
(Sethi 5.3-7)
- Thu.
Allocation and deallocation of dynamic variables.
Pointers.
Dangling references and memory leaks.
[Lecture notes].
(Sethi, 4.7 and 4.8)
(Assignment 3 due, Test 1 distributed)
WEEK 6 (Feb 14)
- Tue.
Preparation for the midterm:
Explanation and discussion of solution of Test 1
- Thu.
MidTerm 1 exam (in class).
WEEK 7 (Feb 21)
- Tue.
Objects and classes in C++.
Data and methods.
Object creation in C++: as local/global objects, by using a
declaration, and as dynamic objects, by using "new".
Constructors and destructors methods.
The concept of "this".
Example: definition of a circular list in C++.
(Sethi 6.5-6)
- Thu.
Example of Programming in C++: The Erathostenes' Sieve.
Demand driven and data driven solutions.
[Lecture notes]
(Sethi 7.5)
(Assignment 4 distributed)
WEEK 8 (Feb 28)
- Tue. OO in Java.
Main differences between Java and C++.
Introduction to concurrency.
Creation of threads in Java.
Life-cycle of a thread. Example: the program PingPong.
[Lecture notes]
(Arnold-Gosling 9.1-2)
- Thu. The problem of Race condition and the
solution offered by Java (synchronization).
Suspension and resumption of threads
via wait() and notify().
[Lecture notes]
(Arnold-Gosling 9.1-2)
(Assignment 4 due, Assignment 5 distributed)
Spring break (Mar 6)
WEEK 9 (Mar 13)
- Tue.
The meaning of synchronized methods:
locks.
An extended example: Producers and consumers on
a common buffer
[Lecture notes]
(Arnold-Gosling 9.3-6)
- Thu. Java applets. The notion of Semaphore.
[Slides]
(Assignment 6 distributed)
WEEK 10 (Mar 20)
- Tue. Introduction to functional programming and to ML
[Lecture notes]
(Sethi Ch. 8)
(Assignment 5 due)
- Thu. Definition of functions by pattern matching.
Data types in ML
[Lecture notes , more notes]
(Sethi 9.1-9.5 excluding 9.3)
(Assignment 7 distributed)
WEEK 11 (Mar 27)
- Tue.
Preparation for the midterm:
Explanation and discussion of solution of Test 2
(Assignment 6 due)
- Thu. Higher Order in ML.
[Lecture notes]
(Sethi 9.3)
MidTerm 2 exam (after class).
WEEK 12 (Apr 3)
- Tue. MidTerm 2 exam (in class).
- Thu. Curried functions. Types in programming languages.
Type checking and type inference. Polymorphism.
The type system of ML.
[Lecture notes]
As another example of polymorphism, see
also: Templates in C++.
(Sethi 6.7)
(Assignment 8 distributed)
WEEK 13 (Apr 10)
- Tue.
Introduction to Logic Programming and Prolog.
Distinctive features: Unification and backtracking.
Applications: AI, fast prototyping, databases.
Syntax of Programs: facts and rules. Querying a program.
Example: a database representing the
matherhood relation. Deriving new relations:
grand_mother and ancestor.
[code]
Lists in Prolog.
Functions defined by predicates.
Example: Definition of append.
Comparison with ML.
Invertibility. Use of append
for splitting a list.
[code]
(Sethi 11-11.3)
(Assignment 7 due)
- Thu. Metaprogramming (Lecture given by Mike Nidel)
[slides]
(Assignment 8 due, Assignment 9 distributed)
WEEK 14 (Apr 17)
- Tue. Operational Semantics 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 the clauses in the program
affects the order of solutions,
and the presence/absence of infinite loops.
Examples: plus and ancestor.
(Sethi 11.4 and 11.5)
- Thu. Extra-logical features in Prolog:
(1) Arithmetics. Examples:
definition of predicates
computing the length of a list and the
sum of the elements of a list.
(2) Cut. Examples: Definition of
not and if_then_else
by using cut.
The ``guess and verify'' (aka ``generate and test'') technique.
Example: slow_sort. Example:
N_queens.
Use of Logic Programming in Artificial Intelligence.
Example: Solving intelligence tests.
(Sethi 11.4 and 11.6)
(Assignment 9 due, Test 3 distributed)
WEEK 15 (Apr 24)
- Tue. Logic Programming as a Metalanguage.
Examples: A parser for a mini-imperative language.
A type-system (with type-inference) for mini-ML.
- Thu.
Preparation for the final exam:
Explanation and discussion of solution of Test 3
Note: The above schedule is subject to change.