Detailed schedule and class resources

Class 1: Tuesday, September 2

Lecture notes for classes 1-2 are available.

Class 2: Thursday, September 4

See the above lecture notes.

A BNF for Java from the official Java specification.

A BNF for the C programming language appears in Annex A (page 476 forward) of this publicly-available draft of the ANSI C spec.

Warning: the example BNF grammars for Java and C above do not use exactly the same conventions as our class.

Class 3: Tuesday, September 9

Please see this temporary workaround for Tome mac permissions issues, especially for unzipping .zip files.

Lecture notes: Basics of the C programming language.

hello-world.c

out-params.c

C for Java Programmers by Niranjan Nagarajan.

Class 4: Thursday, September 11

Lecture notes: Data types

Very long but important background reading: Java to C++ Transition Tutorial, maintained by the CS123 TA staff at Brown University. Start reading this in preparation for today's class, and keep reading it over the next few days.

enum-struct-union.c

new-and-delete.cpp

A brief discussion of why Java strings are immutable.

Class 5: Tuesday, September 16

lab day

Class 6: Thursday, September 18

Lecture notes: Abstract data types

Examples for separating code into header and implementation files: Location.cpp, Location.h, CityList.cpp, CityList.h, CityListMain.cpp, combined.cpp .

inheritance.cpp

destructors.cpp

templates.cpp

Class 7: Tuesday, September 23

Lecture notes: Multiple inheritance and polymorphism

polymorphism.cpp

multiple-inheritance.cpp

java-style-interface.cpp

Class 8: Thursday, September 25

Lab day.

Class 9: Tuesday, September 30

There are no lecture notes for today. Please take your own notes in class. You need to understand the basics of references and goto statements in C++, even though none of the programming assignments requires these. You also need to understand what operator overloading means, but you aren't required to learn the syntax. Please see the example code below for references, goto statements, and operator overloading:

In addition, you should be aware of the content of Dijkstra's 1968 discussion of go to statements and structured programming, Go To Statement Considered Harmful (available on Moodle). We will discuss this famous letter to the editor in class. Wikipedia has an excellent article on the goto statement. Interestingly, there is a separate Wikipedia page devoted to the phrase "considered harmful".

Class 11: Tuesday, October 7

Lecture notes on scanning.

Files for working with scanning: cup.jar, example.lex, sym.java, LexTest.java, input-for-LexTest.txt. These five files are also available as a single zip file: scanning.zip.

Class 12: Thursday, October 9

Lecture notes on parsing.

calculator.zip for running JFlex and CUP on the calculator example. Also available as individual files: cup.jar, example.lex, example.cup, input.txt.

Class 13: Tuesday, October 14

Exam 1.

Class 14: Thursday, October 16

Please take the class survey.

Lecture notes will not be provided for most of this topic. We will stick reasonably closely to the textbook (Chapter 15, sections 0-5 and section 11 are the only ones we will cover).

Instructions for editing and running Scheme programs:

Class 16: Thursday, October 23

This class involves interactive exercises using lambda expressions, lists, quote, let, and recursion. Please read textbook sections 15.5.8-15.5.11 and 6.9.

Responses to midsemester survey and resulting action plan.

Class 17: Tuesday, October 28

Please read textbook sections 15.5.12-14.

For more detailed examples, see the tail recursion handout.

Class 18: Thursday, October 30

Lecture notes on the implementation of Scheme.

Do you find Scheme's use of parentheses are little excessive? Check out the contents page of the book Introduction to Scheme, by Jerry Smith.

Class 19: Tuesday, November 4

Most of the class will be a discussion of section 15.11 in the textbook. It may also be useful to browse a few of the hits on a web search for "functional versus imperative".

Class 20: Thursday, November 6

This class covers non-examinable topics: assignments in Scheme, object-oriented approaches in Scheme, vectors and hash tables in Scheme, and delegates and lambda expressions in C#. Some example Scheme code is available (note that this uses the Racket language, not the Advanced Student language we used for all our previous work).

This class will also include lab time to work on and ask questions about homework assignment 7. If you have finished the homework, I recommend working on the optional exercises, taken from Dybvig's book, The Scheme Programming Language.

Some inspiration for the tail recursion homework: http://xkcd.com/1270/.

Class 21: Tuesday, November 11

This class covers sections 5.1-5.4 and 6.12-6.14 of the textbook.

Contrast the textbook's definition of strongly typed with the discussion given in the first answer on the following page: http://stackoverflow.com/questions/430182/is-c-strongly-typed.

The example code type-equivalence-examples.c provides some examples of type equivalence and inequivalence in C.

Class 22: Thursday, November 13

This class covers sections 5.5-5.8 of the textbook, but sections 5.5.6 and 5.5.7 are excluded. (These sections cover dynamic scoping, which we will discuss in class, but which will not be included in any homework or exam questions.)

The brief code examples used in class are available as scope-examples.zip.

Class 23: Tuesday, November 18

Exam 2.

Class 24: Thursday, November 20

For running Prolog programs:

We will follow the textbook closely for this topic. Separate lecture notes will not be provided (mostly). However, the examples used in class today are available as course.pl.

The textbook uses unusual notation for some of the propositional logic operators (and, or, implies). We will use the standard notation as taught in the Dickinson discrete math course.

Some of the in-class examples are taken from http://en.wikibooks.org/wiki/Prolog. In particular, this online book contains a good section on Prolog lists, which will help to amplify the textbook's coverage: http://en.wikibooks.org/wiki/Prolog/Lists.

Class 25: Tuesday, November 25

Lecture notes on prolog and first-order logic.

Some very brief notes on unification.

Some notes on additional topics, including negation---these notes will help with the homework. The accompanying file tree.pl demonstrates a non-trivial Prolog data structure.

We do not study the use of arithmetic in Prolog (so you can skip the book section 16.6.6).

Class 26: Thursday, November 27

[Thanksgiving]

Class 27: Tuesday, December 2

The file course-inference.pl contains the example used to explain inference in Prolog.

Instructions for using tracing facilities with XGP: