COMP 3351 Programming Languages, Fall 2006

General Information


The prerequisites for this class is a good understanding of imperative languages and object-oriented programming, as well as computer organization. You should be able to write 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 Mondays and Wednesdays from 4pm to 6pm in John Greene Hall 316. I will be unable to hold office hours during the week of 10/23/06-10/27/06.

Office Hours

Christian Grothoff - JGH 214
Monday, Wednesday, Friday 2-3:30pm and by appointment.
Yan Mayster - JGH 325
Tuesday, Thursday 3-4pm, Friday 3-5pm 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. 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.
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> 90 Pts
B> 75 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 solaris machines which have all of the necessary software installed. Copy the provided bashrc into your home directory (under .bashrc) in order to set the paths correctly (only works if you use bash). Here is a list of the software programs that you will need (possibly incomplete):

Java 5.0
I recommend using the Sun JDK; earlier Java versions (including gcj) should also work, but you may have to use an older version of JTB
Pick a version that works with your Java installation. You should also write a shell script to invoke JTB (something along the lines of java -classpath jtb.jar EDU.purdue.jtb.JTB "$@")
JavaCC 4.0
Again, other versions may work just fine.
Any version should do.
Any version should do.
Any version 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.


Note that existing assignments may still be corrected. Only the assignments up to and including Class 15 have been finalized at this point. 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/11/06)

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

Class 2: Syntax (09/13/06)

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/18/06)

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

Class 4: ML (09/20/06)

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/25/06)

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/27/06)

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/02/06)

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

Class 8: Scope (10/04/06)

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/09/06)

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/11/06)

Class 11: References and Pointers (10/16/06)

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/18/06)

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: General Purpose Scripting Languages (10/23/06)


Class 14: Prolog (10/30/06)

Material from the textbook
Chapter 19 and Chapter 20
Useful links
Prolog Tutorial

Class 15: Domain Specific Scripting Languages and Prolog Practice (11/01/06)

  1. Chapter 20, Exercise 6 (due: Class 20, 3 Pts)
Useful links
Unification Theory

Class 16: Cost Models (11/06/06)

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

Class 17: Formal Semantics (11/08/06)

Material from the textbook
Chapter 23

Class 18: Type Systems Revisited (11/13/06)

Useful links
Featherweight Java

Class 19: Review (11/15/06)

Material from the textbook
Chapter 24

Class 20: Final Exam (11/20/06 - 3pm (!))


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: Thu Jan 25 15:44:28 MST 2007