Detailed schedule and class resources

Class 1: Monday, August 26

Lecture notes for classes 1--3 are available.

Class 2: Thursday, August 29

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: Monday, September 2

See the above lecture notes.

Class 4: Thursday, September 5

Lecture notes: Basics of the C programming language (version 3) -- note, this version of the notes uses %p for printing a pointer, which is more correct than %x.

hello-world.c

out-params.c

C for Java Programmers by Niranjan Nagarajan.

Class 5: Monday, September 9

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 6: Thursday, September 12

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: Monday, September 16

Lecture notes: Multiple inheritance and polymorphism

polymorphism.cpp

multiple-inheritance.cpp

java-style-interface.cpp

Class 8: Thursday, September 19

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 read and 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 9: Monday, September 23

Class 10: Thursday, September 25

Lecture notes on scanning.

Files for working with scanning: cup.jar, example.cup, example.lex

Files for JFLex demo: LexTest.java, input-for-LexTest.txt, sym.java

Class 11: Monday, September 30

Lecture notes on parsing.

calculator.zip for running JFlex and CUP on the calculator example.

Class 12: Thursday, October 3

Exam 1.

Class 13: Monday, October 7

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 14: Thursday, October 10

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.

Class 15: Monday, October 14

Please read textbook sections 15.5.12-14.

For more detailed examples, see the tail recursion handout.

Class 16: Thursday, October 17

Please take the CS majors' survey, if you haven't done so already.

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 17: Monday, October 21

Fall pause -- no class.

Class 18: Thursday, October 24

Please take the class survey.

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".

This class will also include some 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.

Class 19: Monday, October 28

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 some lab time to work on and ask questions about homework assignment 7.

Class 20: Thursday, October 31

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.

Class 21: Monday, November 4

Exam 2.

Class 22: Thursday, November 7

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: Monday, November 11

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

Class 24: Thursday, November 14

Lecture notes on prolog and first-order logic.

Class 25: Monday, November 18

Some very brief notes on unification.

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

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

Class 26: Thursday, November 21

Instructions for using tracing facilities with XGP:

The main topic for today is covered in section 16.7 of the textbook. Some brief additional notes on Prolog are provided. The accompanying file tree.pl demonstrates a non-trivial Prolog data structure.

Class 27: Monday, December 2

Continue working on final project in class.

Earlier in the semester, I briefly discussed the recently-published paper from a bunch of MIT researchers: Towards Optimization-Safe Systems: Analyzing the Impact of Undefined Behavior, by Xi Wang, Nickolai Zeldovich, M. Frans Kaashoek, Armando Solar-Lezama. Some slides used by the first author when presenting the paper are also available. Note the puzzle on the last page of the slides -- it is highly relevant to this class! A file containing the relevant code from the puzzle is available: puzzle.c.