CSCI.4430/6969 Programming Languages-- Fall 2003
Course Notes:
- Lecture 1, August 26, 2003 - Lambda calculus syntax, semantics;
Function composition; Scheme introduction (PDF)
- Lecture 2, August 28, 2003 - More Scheme; Currying; Free and
bound variables; Order of evaluation; Combinators (PDF, 0.ss)
- Lecture 3, September 4, 2003 - Eta-conversion; Currying combinator;
Recursion combinator (PDF, 1.ss)
- Lecture 4, September 8, 2003 - Scheme types; Lambda calculus
if statement (Chapter handout (see Prof. Varela for copy), 2.ss)
- Lecture 5, September 11, 2003 - More scheme types; Lists; Procedures;
Pairs; Vectors (Chapter handout (see Prof. Varela for copy), 3.ss)
- Lecture 6, September 15, 2003 - Recusive functions based on
grammars; Lexical Addresses (Friedman sections 1.1-1.2, 4.ss)
- Lecture 7, September 18, 2003 - Lexical Addresses; Data Type
Interfaces (Friedman sections 1.3-2.1, 5.ss)
- Lecture 8, September 22, 2003 - Abstract Syntax; Representation
Strategies, Environment Interface. To run the following examples, the book's
Scheme scripts must be avaliable in the directory where you run Scheme.
To get all these files, go to the Essentials of Programming Languages
web site and download and extract the code. Execute
(load "*-init.scm")
to access the book's defined functions, where * is the name of the Scheme
interpreter you are running. The code files are also avaliable on the CS
network in the folder /projects/proglang03/eoplcode. (Friedman sections 2.2-2.3,
6.ss, 2-3-2.scm,
2-3-3.scm, 2-3-4.scm
)
- Lecture 9, September 25, 2003 - Simple interpreter (Friedman
section 3.1, 7.ss)
- Lecture 10, September 29, 2003 - Conditional evaluation, Local
binding (Friedman sections 3.3-3.4, 8.ss)
Exercises:
- Modify the interpreter so only a certain value is considered true and
everything else is considered false.
- Modify the interpreter so it accepts if .. then statements without an
else clause.
- Lecture 11, October 2, 2003 - Procedures, Static and dynamic
binding (Friedman section 3.5, 9.ss - static binding,
9d.ss - dynamic binding)
Exercises:
- Change the representation of closures so you don't have to store the
environment (i.e. traverse the AST of the procedure body and replace free
variables with their bound values in the current environment).
- Lecture 12, October 6, 2003- Recursive procedures, imperative
programming paradigm, variable assignment (Friedman sections 2.4, 3.6-3.7,
9d-ex.ss, 10.ss,
10rib.ss, 3-7.scm
11.ss)
- Exercises:
- Change the cell implementation to include a "get-and-set" operation.
- Textbook exercises 3.39, 3.41, 3.43.
- Lecture 13, October 9, 2003-
3-7-lr.scm,
12.ss
3-8name.scm
3-8need.scm
3-8ref.scm
- Lecture 14, October 16, 2003- Friedman 4.1 and 4.2
4-2.scm,
13.ss
- Lecture 15, October 20, 2003- Friedman 4.3 (skip type
inferences).
4-3.scm
14.ss
Exercises:
- Enable type checking of variable-arity procedures (such as +(3,2,1)).
- Look over code for letrec and let-type type checking.
- Lecture 16, October 23, 2003-
15.ss
5-3.scm
5-4-1.scm
Exercises:
- Lecture 17, October 27, 2003- OpenJava,
see link on main non-WebCT course homepage for examples.
- Lecture 18, October 30, 2003- Friedman 5.3, 5.4,
Object and class implementations.
oop_impl.scm,
oop_impl.ppt,
5-3.scm,
5-4-1.scm,
5-4-2.scm,
5-4-3.scm,
5-4-4.scm,
- Lecture 19, November 3, 2003- Friedman 6,
Types in OOP.
16.ss,
6-top.scm,
6-grammar.scm,
6-interp.scm,
6-translator.scm,
6-checker.scm
Exercises:
- Change tree example so that it does not use cast or instanceof.
- Write programs that generate all possible errors in the OOP
type checker.
- Lecture 20, November 6, 2003- Prolog handout,
family.pl,
append.pl,
rainy.pl
- Lecture 21, November 10, 2003- Prolog handout,
if.pl,
loop.pl
- Lecture 22, November 13, 2003- Prolog handout,
tictactoe.pl
Exercises:
- Fix tic-tac-toe so it (1) checks whether the user wins and
(2) never loses.
- Lecture 23, November 17, 2003-
Pi-calculus,
Exercises:
- Describe the set of free names in (i) a(x).P, (ii) (vx).P,
(iii) -ax.P (where -a is a with a bar over it).
- Describe the set of bound names in the same expressions.
- Fully reduce the expression:
(\nu w)(-aw.-wu.-wv.P) | a(z).z(x).z(y).Q | a(z).z(x).z(y).R
to show that it will only send both u and v to either Q or R, not one
to each.
"\nu" is the Greek
"nu" character that represents creating a new channel (looks like a v).
- Fully reduce the expression:
Ref(r,w,i) | (\nu c)-w.c.(\nu d)-rd.d(e).Q
The following are defined:
Ref(r,w,i) = (\nu l) (-li | ReadServer(l,r) | WriteServer(l,w))
ReadServer(l,r) = !r(c).l(v).(-cv | -lv)
WriteServer(l,r) = !w(c,v').l(v).(-c | -lv)
- Lecture 24, November 20, 2003-
Actor model, SALSA,
HelloWorld.salsa
(needs to be in path examples/helloworld/, or just get rid of
"module" statement),
Continuation.salsa
(needs to be in path examples/language/, or just get rid of
"module" statement),
CurrentContinuation.salsa
(needs to be in path examples/language/, or just get rid of
"module" statement),
JoinContinuation.salsa
(needs to be in path examples/language/, or just get rid of
"module" statement),
Fibonacci.salsa
(needs to be in path examples/fibonacci/, or just get rid of
"module" statement).
Or better yet, go to the
SALSA
homepage and download and extract the source
file. It contains all the examples in the correct directories.
Exercises:
- Recreate the reference cell in actor language where the
cell sends an acknowledge message in the set operation.
- Recreate the reference cell in pi-calculus where the cell
does not send an acknowledge message in the write operation.
- In JoinContinuation.salsa, make the code more readable by
creating three named tokens and having multiply() take three
arguments.
- Lecture 25, November 24, 2003-
Distributed Programming with SALSA, World-Wide Computer
SALSA Examples (Directory information is significant; remove "module" line if you want to test in current directory)
- Lecture 26, December 1, 2003-
Type Inference, SALSA Environment Variables
17.ss
EnvironmentVariables.salsa
WriteLine.salsa
File.salsa
(Directory information is significant; remove "module" line if you want to test in current directory)
Last Updated -- December 1, 2003.