Programming Languages
(CS-329 and CS-389, Autumn 2000)

Staff

Time and place

Evaluation for CS-329

Evaluation for CS-389

Hardware resources

Software resources

Lecture calendar

2000-07-24
2000-08-01
2000-08-02
2000-08-04
2000-08-09
2000-08-11
2000-08-16
2000-08-18
2000-08-30
2000-09-05
2000-09-06
2000-09-08
2000-09-13
2000-09-15
2000-09-20, 22
2000-09-27
2000-09-28
2000-09-29
2000-10-04
2000-10-06
2000-10-11
2000-10-13
2000-10-18
2000-10-20
2000-10-25
2000-10-27
2000-11-01
2000-11-10
2000-11-10

Assignments to supplement lectures

You can form groups and turn in only one writeup per group. All group members will get the same score in a homework.

Programming assignments

Please coordinate with your friendly CR and TAs to decide on a uniform submission format.

Assignment 1 (Due 2000-08-18)
  1. Find out if Scheme follows applicative order or normal order by writing a suitable simple program using the infinite expression shown in class. Make available to the TAs a short Scheme program and a one-line answer.
  2. Design the environment data structure with the accessor functions discussed in class for storing name-to-value bindings. Call the functions empty-env, extend-env, and lookup-env. Make the Scheme code available to the TAs.
Assignment 2 (Due 2000-08-25)
Write a program in Scheme that will read a file with a lambda expression in free format and turn it into an abstract syntax tree (AST). To avoid confusion with the scheme lambda keyword, we will use Lambda. The AST should have nodes called ID, ABS and APP. Having constructed the AST, number the nodes in left-to-right depth-first order. Having done that, for each node, print out if it is a free variable. If it is a bound variable, print the node number of the binding ABS.
Assignment 3 (Due 2000-10-01)
  1. Implement a substitution routine called ast-subst which will accept an AST for E1 and E2 and output a AST corresponding to [E2/I]E1, with variables renamed as necessary.
  2. Implement a normal order and an applicative order lambda execution engine. Write code to print steps of evaluation in a readable manner.
Assignment 4 (Due 2000-10-08)
  1. Use the lambda engine to run recursive factorial and list-length functions using various forms of the Y-combinator.
  2. Modify your interpreter to use an environment rather than ast-subst. Is this easier or harder to code than using substitution? Is it more or less efficient at runtime?
Assignment 5 (Due 2000-10-31)
  1. Try running the expressions involving callcc given as examples in class using Scheme. Some syntax such as new and write will need to be changed to run as Scheme code.
  2. Write a FLK to FLCPS translator using the codebase you already have. You can choose the simpler subset of FLK as in class. Consider the following code:
    (+ 1 (label EXIT (+ 2 (* 3 (/ 4 (goto EXIT 5))))))
    Hand-translate this to use FLK and callcc. Translate in turn to FLCPS using your program and execute the FLCPS using the lambda engine you have implemented.
  3. Implement FLOP (as in the midterm exam) using the FL/FLK interpreter code you have built so far. You need not implement the store.

Copyright statement

The copyrights to documents and software referred to herein remain with the respective copyright holders. The copyright to this specific course organization, course handouts, and exams is owned by IIT Bombay.