COMP 3351 Programming Languages, Fall 2007

General Information


The prerequisites for this class is a good understanding of imperative languages and object-oriented programming, as well as computer organization. You must be able to write and debug non-trivial programs in either C/C++ or Java. You must have a good understanding of basic data structures such as lists, stacks, trees and hashtables.

This is a class on concepts of programming languages. There will be programming assignments designed to make you use and implement various concepts. Programming assignments may involve writing code in C, C++, Java, ML, Prolog and other languages. You do not need to know these languages already.

Lecture Hours and Location

The lectures will be held Wednesdays from 6-8pm and Fridays, 2-4pm in John Greene Hall 219.
The Debian GNU/Linux lab is in John Greene Hall 216. In order to get a door code for the Computer Lab please visit the labcode webpage (after signing up for an account). The code is updated on weekly basis.

Office Hours

Christian Grothoff - JGH 108
Tuesday, Wednesday, Thursday 2-3:30pm and by appointment.
Yan Mayster - JGH 325
Tuesday 10am-12pm, Friday 12-2pm and by appointment, phone extension x13302

Textbook and Syllabus

"Modern Programming Languages: A Practical Introduction", by Adam Brooks Webber, Franklin, Beedle & Associates. This will be the main textbook for the class covering most of the material. The textbook also contains various suggested excercises.
"Version Control with Subversion", on-line book (no need to buy a copy). You must know how to use subversion as a developer (not as an administrator) in order to submit your assignments. Use this book as a reference if you encounter problems. Basic knowledge of chapters 1-3 should be sufficient.

Specific topics that will be covered:

Assignments and Grading

There will be individual assignments where you will need to answer some specific questions in prose or with small fragments of code as well as larger individual programming assignments that must be turned in for grading by a certain deadline. For some of the larger assignments, testcases will be provided. You are encouraged to write additional testcases and are specifically allowed to exchange those tests with other students.
Students will also be expected to research and present a programming language in class towards the end of the term. Details about these student presentations will be announced in class. The basic expectation is that you will learn enough about a less common language to give a presentation (with slides, examples and demonstration) on the advantages and disadvantages of that particular language.
Students are encouraged to discuss the materials, homework, and projects together. However, all written assignments and programs must be done individually. Academic dishonesty includes, but is not limited to: plagiarism, cheating in exams, unauthorized collaboration and falsifying academic records. Violation of any of these may result in a grade penalty on assignments, an "F" in the course, dismissal from an academic unit, revocation of admission, suspension from the University as well as being roasted over a slow fire.
There will also be suggested excercises that do not have to be turned in and for these excercises you should feel free to work with other students including exchange of solutions.
Generally, all assignments are due before class on the date specified with the assignment. Exceptions to this rule (allowing later submission) may be announced in class.

The different kinds of assignments are weighted as follows:

Programming assignments55 Pts
Exercises24 Pts
Midterm15 Pts
Final15 Pts
Class Participation10 Pts

There are theoretically a total of 119 Pts possible Grades will be given as follows:

A> 100 Pts
A-> 90 Pts
B+> 85 Pts
B> 80 Pts
B-> 75 Pts
C+> 70 Pts
C> 65 Pts
C-> 60 Pts
D≥ 45 Pts
F< 45 Pts


You will need various applications for the class, all of which are freely available for various operating systems. Personally, I'm using Debian GNU/Linux unstable. If you have any problems installing the software, you can always use the department's Debian GNU/Linux machines which have most of the necessary software installed (in order to get the rest, copy the provided JTB and JavaCC scripts and JAR files into your home directory, edit the shell scripts to contain the correct absolute path to the JAR file and make them executable. Finally, add the directory with the shell scripts to your PATH).
Here is a list of the software programs that you will need if you want to use your own system:

Java 6.0
I recommend using the Sun JDK 5.0 or 6.0
Do NOT download JTB from the page above. Instead, use either the version installed in the lab or the binaries provided here.
JavaCC 4.0
Again, please use the version provided here.
Any version should do.
Any version should do.
Any version greater than 1.4 should do.
Compilers and tools for C, C++
I recommend installing gcc 4.x from GNU.

Submission of Assignments

Each student will get access to a subversion repository. Assignments must be committed to that repository by the respective deadline. Students are encouraged to use the repository for version control while still working on the assignment. Only the last version commited before the deadline will be used for grading.
In order to access your subversion repository, you must first request an account. For this, you first need to generate an encrypted password. On any GNU/Linux or UNIX machine (or even a Microsoft system with Apache) enter

    $ htpasswd -nb $USER PASSWORD
where PASSWORD is your desired password. You will not be able to change the password later. Send the output of the command to to request an account. Once your account has been created, you should do an initial check out:
    $ svn checkout$USER
    $ cd $USER
You should then proceed to create a directory for the first project and commit it:
    $ mkdir P1
    $ svn add P1
    $ svn commit -m "comment"
Afterwards, you can add the files to submit just like you added the directory. Make sure to commit the final version with all files (hint: svn status) before the deadline. It is also a good idea to do a seperate checkout and verify that the result works.
If you already have a subversion account from a different class, you still must request a new account for this quarter. You can use the same username and password. Furthermore, when doing the checkout, make sure that the directory $USER does not already exist. You can rename the directory afterwards, for example using:
    $ mv $USER comp3351


Note that existing assignments may still be corrected. Feel free to look at the other assignments if you want to know what the plan looks like. Feedback is welcome.

Class 1: Introduction (09/12/07)

Material from the textbook
Chapter 1 and Chapter 4
Useful links
Subversion, Slides
Quiz 1
  1. Hello World! (due: Class 2, 1 Pt), P1/

Class 2: Syntax (09/14/07)

Material from the textbook
Chapter 2 and Ramki Thurimella's notes on Regular Expressions
Useful links
JTB, JavaCC, jtb.jar (mirror), jtb shell script, javacc.jar (mirror), javacc shell script
  1. Chapter 2, Exercise 2 (no turn-in)
  2. Expression parser (due: Class 5, 9 Pts), PrettyPrinter template, Grammar template, Makefile, test.tar.gz,

Class 3: Interpretation (09/19/07)

Material from the textbook
Chapter 3
Useful links
Visitor pattern
  1. Chapter 3, Exercise 1 (no turn-in)

Class 4: ML (09/21/07)

Material from the textbook
Chapter 5
  1. Chapter 5, Exercises 1-14 (no turn-in)
  2. Chapter 5, Exercise 15 (due: Class 5, 3 Pts)
  3. Interpreter for Operator Language (due: Class 8, 10 Pts), expressions.jj, expressions.html, tests.tgz,, Makefile

Class 5: Higher-order Functions (09/26/07)

Material from the textbook
Chapter 9
Useful links
Why Functional Programming Matters
  1. Chapter 9, Exercise 27 (no turn-in)
  2. Higer-order functions in C or C++ (same general problem statement as for the Java version; no turn-in)
  3. Higher-order functions in Java (due: Class 9, 5 Pts)

Class 6: Types (9/28/07)

Material from the textbook
Chapter 6 and Chapter 8
Useful links
  1. Chapter 6, Exercise 4 (due: Class 7, 3 Pts)
  2. Chapter 8, Exercise 3 (due: Class 7, 3 Pts)
  3. Chapter 8, Exercise 5 (no turn-in)

Class 7: Patterns (10/03/07)

Material from the textbook
Chapter 7
  1. Chapter 7, Exercise 7 (due: Class 8, 3 Pts)

Class 8: Scope (10/05/07)

Material from the textbook
Chapter 10 and Chapter 12
  1. Extended Interpreter (due: Class 11, 10 Pts), statements.jj, statements.html, Makefile,, tests.tgz
  2. Chapter 10, Exercise 5 (no turn-in)

Class 9: Calls (10/10/07)

Material from the textbook
Chapter 18
  1. Chapter 18, Exercise 1 (no turn-in)
  2. Chapter 18, Exercise 6 (due: Class 11, 3 Pts)
  3. Chapter 18, Exercise 7 (due: Class 11, 3 Pts)

Class 10: Midterm (10/12/07)

Class 11: References and Pointers (10/17/07)

Material from the textbook
Chapter 13 and Chapter 14
Useful links
Introduction to memory management
  1. Imperative Interpreter (due: Class 15, 10 Pts), functions.jj, functions.html, tests.tgz,, Makefile
  2. Chapter 13, Exercise 6 (no turn-in)

Class 12: Classes (10/19/07)

Material from the textbook
Chapter 15, Chapter 16 and Chapter 17
  1. Object-oriented Interpreter (due: Class 19, 10 Pts), objects.jj, objects.html,, Makefile, tests.tgz

Class 13: Prolog (10/24/07)

Material from the textbook
Chapter 19 and Chapter 20
Useful links
Prolog Tutorial, Unification Theory
  1. Chapter 20, Exercise 6 (due: Class 20, 3 Pts)

Class 14: Cost Models (10/26/07)

Material from the textbook
Chapter 21
  1. Chapter 21, Exercise 4 (due: Class 18, 3 Pts)

Class 15: Formal Semantics (11/01/07)

Material from the textbook
Chapter 23

Class 16: Type Systems (11/02/07)

Useful links
Featherweight Java

Class 17: Presentations: General Purpose Languages (11/07/07)


Class 18: Presentations: Domain Specific Languages (11/09/07)


Class 19: Presentations & Review (11/14/07)

C-- (slides)
Material from the textbook
Chapter 24

Class 20: Final Exam (TBA)


Grades will be e-mailed to the e-mail address given with the request for creating the subversion account. For how to interpret the e-mailed grades please contact the TA.

Christian Grothoff
Last modified: Fri Nov 16 20:04:37 MST 2007