University of Toronto - Summer 2000
Department of Computer Science

CSC 324: Principles of Programming Languages

General Information

Eric Joanis
Office Hours:
T 3:30-4:30pm and R 5-6pm in SF3207
Day section: TW 2-3pm (LM158) / Evening section: Changed: R 6-8pm (SF1101)
Day section: W 3-4pm / Evening section: Changed: R 8-9pm (see below for TA and location)
Course Info:
Get the course information sheet here.
The course synopsis can be found here in the academic calendar.
Notes Online:
Most material for this course is available here.
Tutorials Online:
Most Tutorials for this course are available here.
News Group:
You must read the course newsgroup for announcements.
You can post to the course newsgroup from home.
Diana Inkpen, LM158, Day section, Last names A-Le
George Giakkoupis, LM155, Day section, Last names Li-Z
Anastasia Bezerianos, SF1101, Evening section, Last names A-Li
Sean Thompson, GB248, Evening section, Last names Lo-Z


Software Testing by Diane Horton. You are expected to test your programs with this document as a standard.

Use this cover sheet to submit all your assignments.

Remark requests must use this form.

We will be using Scheme for assignments 1 and 2. The Dybvig book is available online. You can download MIT Scheme for most platforms, but remember your code must work on CDF, and we will not support other environments. You're welcome to use the newsgroup to help each other with working-at-home issues, however.
The Chez Scheme home page also has useful resources.

Assignment 1: Basic Scheme. Solution.

Assignment 2: A Simple Expression Evaluator.
Download the starter code for A2.
Announced June 27: Extension for A2.
This marking script shows the test cases that we used to test your code. We ran it in the directory containing your code with the command "scheme < a2.script".

We will be using XSB Prolog for assignments 3 and 4.
You can download a version for your PC from the XSB Research Group home page. The usual disclaimer: I didn't test the PC version myself, and you're responsible to make sure your code works on CDF. Note also that the CDF version is not the latest, so recently added features (which you should not need anyway) may not work.
The XSB Prolog reference manual is also available on their home page, and will probably be a very helpful online reference.
You might prefer SWI-Prolog, Visual Prolog or Trinc-Prolog (usual disclaimer...) (thanks to W.L. Marks for these links).
Paul Brna, from the University of Leeds, has made his book Prolog Programming A First Course available online. It seems to be a good introduction to Prolog, and it covers pretty everything we did and a lot more.

Assignment 3: Prolog Basics.
How to do traces in Prolog, by Diane Horton.

Assignment 4: Prolog.
You will need the to do the assignment.

Assignment 5: Syntax. Partial Solution.


You will find test and quiz solutions here once they are marked.

Quiz 1 solutions: Day section, Evening section.

Quiz 2 solutions: Day section, Evening section.

Quiz 3 solutions: Day section, Evening section.

Midterm solutions: version 1 (with lower case csc324), version 2 (with upper case CSC324).
The original solutions has a mistake in question 1. They've been replaced with corrected versions.

Quiz 4 solutions: Day section, Evening section.

Quiz 5 solutions: Day section, Evening section.

Last fall's final.


You will find your grades here when some are available.

As of July 14: Day section Evening section

As of July 22, including A2, A3, the midterm and regrades so far: Day section Evening section

As of August 16, including all term work: Day section Evening section

Final grade files, including unofficial course grades: Day section Evening section.
Note that some grades are still outstanding. If yours is not on the list, please wait for the official results.


Watch this space for announcements throughout the term.

July 10: Extra office hour today 5-6pm in SF2304B.

July 4: Office hours this week (all in SF3207):

June 29: The midterms from last term (with solutions) and the previous term (solution) are available.

June 28: The midterm will be on July 6th in the evening for both sections.

There will be no tutorial on the midterm week.

The midterm covers everything done in lecture, tutorial and on the assignments by June 29th:

June 27: Extension for A2.

June 21: The due time for A2 and all subsequent assignments is now the beginning of the lecture on the day it is due, not the beginning of tutorial. So for the day section, the due time is 2:10, and for the evening section, the due time is 6:10. Similarly, grace days expire at the time corresponding to the beginning of your lecture section the next and second next day.

June 12: I've added two excellent additional references to the textbook list. They provide a deeper presentation of programming is Scheme and Prolog, respectively, than the language references I suggest. I recommend them for an alternative presentation, and for learning more on those two programming languages.

June 1: Sean's section of the evening tutorial will remain in GB248.

May 31: The evening section tutorial and class have been switched, so class is from 6 to 8, and tutorial is at 8. Anastasia's section will still take place in SF1101. I'm still waiting for the room booking for Sean's section.

May 23: More course accounts have been created.

May 18: If you don't have a course account yet, please send me e-mail with your name and student ID, so I can request one for you. Keep in mind, though, that there may be delays in the creation of your account, because I have to confirm that you are registered in the course before I can make the request.

May 15: Course accounts have been created.

Lecture Notes

Week 1: Admin and Introduction.

Week 2: Scheme, part 1.

Week 3: Scheme, part 2.

Week 4: Scheme, part 3.
Supplementary slide on equality in Scheme.

Week 5: Scope and Lifetime of Variables and Parameter Passing Methods.
Practice problems on parameter passing by Marsha Chechik. Solutions.

Week 6: Prolog, part 1.

Week 7: Prolog, part 2.

Week 8: Prolog, part 3.
Supplementary slides on Prolog cut.
Code for the Prolog slides.

Week 9: More Prolog, but no new slides.
Trace for query trip(ny,X), which I'll hand out in class, so you don't need to print it.
Last two slides of the supplementary slides on cut.
Two versions of flatten, the first using append as we did in class, the second without, and much more efficient.

Week 10, 11 and maybe 12: Syntax.
Cathy Jansen's slides on types clarify what an atom is in Prolog.

Week 13: Perl introduction. These are the links on the first slide:

If you want to learn more about Perl, these are reference books I recommend, all published by O'Reilley:

Tutorial Notes

Tutorial 1 slides on basic Scheme.

Tutorial 2 slides: more Scheme: apply, let, fast-fib.

Tutorial 3 slides: more Scheme: general lambda expressions and accumulators.

Tutorial 4 slides: Scheme examples about sets, and 2 extra slides on currying.

Tutorial 5 slides: Parameter-passing methods and scoping rules.

Tutorial 6 slides: Substitutions and Unification.

Tutorial 7: Midterm.

Tutorial 8 slides: Code using the Prolog cut.

Tutorial 9 slides: Natural Language Processing in Prolog.

Reading List

Required Text:

``A Student's Guide to CDF'', available for a couple of dollars from the UofT Bookstore.


M. Scott, Programming language pragmatics, Morgan Kaufmann, 2000.

R. Sethi, Programming languages: concepts and constructs, 2nd ed., Addison-Wesley, 1996.

R. Sebesta, Concepts of programming languages 4th ed., Addison-Wesley, 1999.

T. Pratt and M. Zelkowitz, Programming languages : design and implementation, 3rd ed., Prentice Hall, 1999.

Highly Recommended References:

K. Dybvig, The Scheme programming language : ANSI Scheme, 2nd ed., Prentice Hall, 1996.

W. Clocksin and C. Mellish, Programming in Prolog, 4th ed., Springer-Verlag, 1994.

Additional language textbooks, for more detailed explanations:

G. Springer and D. Friedman, Scheme and the Art of Programming, McGraw-Hill, 1989.

L. Sterling and E. Shapiro, The Art of Prolog : Advanced Programming Techniques, 2nd ed., MIT Press, 1994.

Computing Facilities

The programming assignments will make use of the CDF Unix facilities. Although you may do your work at your home PC, all assignments should be uploaded and run on CDF machines in order to receive credit for them. Those unfamiliar with CDF should find information in the CDF home page useful.