On this page:
Organization of Programming Languages (Fall 2016)
1 Introduction
2 Lectures
3 Assignments
4 Turn-In and Grading
4.1 Bitbucket
4.2 Preparation
4.3 Turn-in
4.4 Assignment Grading
4.5 Class Numeric Grade
4.6 Class Letter Grade
5 Help
6 Readings
7 Software
8 Fine Print

Organization of Programming Languages (Fall 2016)

This class is taught by Jay McCarthy. Call him Jay. Email him at first-name DOT last-name AT gmail DOT com.

We meet in Olsen 109 at 1230-1345 on TR.

Jay McCarthy’s office hours are TR 0800-1400 in Olsen 221.

There is a mailing list hosted at Google Groups. Use it to ask non-revealing questions and receive answers, as well as general course announcements. You are responsible for reading the content of this mailing list.

1 Introduction

Analytical approach to the study of programming languages. Description of the salient features of the imperative, functional, logical, and object-oriented programming paradigms in a suitable metalanguage such as Scheme. Topics include iteration, recursion, higher-order functions, types, inheritance, unification, message passing, orders of evaluation, and scope rules. Elementary syntactic and semantic descriptions. Implementation of simple interpreters.

2 Lectures

 

Day

 

Date

 

Topic

 

Links

 

Notes

 

1

 

09/01

 

Introduction / Racket: Numbers, Symbols, Expressions, Check Expect

 

code

 

PLAI2 1 / HtDP 2

 

2

 

09/06

 

Racket: Designing Programs, Functions, Conditionals, Structures, Lists, Natural Recursion

 

code

 

HtDP 3-6, 9

 

3

 

09/08

 

Racket: Recursive Structures / Higher-order Functions

 

code

 

HtDP 14 & 20

 

4

 

09/13

 

Parsing & Basic Interpretation

 

code

 

PLAI2 2-3

 

5

 

09/15

 

Basic Interpretation & Desugaring

 

code

 

PLAI2 3-4

 

6

 

09/20

 

Functions

 

code

 

PLAI2 5*

 

7

 

09/22

 

Environments

 

code

 

PLAI2 6*

 

8

 

09/27

 

First-class Functions

 

code

 

PLAI2 7

 

9

 

09/29

 

Mutation: Basics & The Store

 

code

 

PLAI2 8-8.1.8

 

10

 

10/04

 

Mutation: Variables

 

code

 

PLAI2 8.1.8-8.4

 

11

 

10/06

 

Recursion

 

code

 

PLAI2 9

 

12

 

10/13

 

Objects

 

code

 

PLAI2 10

 

13

 

10/18

 

Memory management: GC, Reference Counting, & Mark and Sweep

 

code

 

PLAI2 11, Wilson 1-2.3

 

14

 

10/20

 

Memory management: Stop and Copy & Generational Collection

 

code

 

PLAI2 11, Wilson 2.4-9

 

15

 

10/25

 

Representation Decisions and Church Encoding

 

code

 

PLAI2 12

 

16

 

10/27

 

Desugaring

 

code

 

PLAI2 13

 

17

 

11/01

 

Control: Web Basics & CPS

 

code

 

PLAI2 14.1-2

 

18

 

11/03

 

Control: CPS Interpreter

 

code

 

PLAI2 14.3-4

 

19

 

11/08

 

Control: Tail Calls and call/cc and others

 

 

PLAI2 14.5-6

 

20

 

11/10

 

Types: Basics

 

 

PLAI2 15.1-15.2.1

 

21

 

11/15

 

Types: Conditionals and Recursion

 

 

PLAI2 15.2.2-15.2.3

 

22

 

11/17

 

Types: Data

 

 

PLAI2 15.2.4-15.2.5 & 15.3.3 & 15.3.6

 

23

 

11/22

 

Types: Mutation and Parametric Polymorphism

 

 

PLAI2 15.2.6-15.3.1

 

24

 

11/29

 

Types: Type Inference

 

code

 

PLAI2 15.3.2

 

25

 

12/01

 

Types: Let-Polymorphism, Structural vs Nominal, Subtyping, Objects and Curry-Howard

 

code

 

PLAI2 15.3.2.3 & 15.3.4-5 & 15.3.7 & 15.3.7.3-15.3.8

 

26

 

12/06

 

Laziness

 

code

 

PLAI2 17

 

27

 

12/08

 

Prolog

 

code

 

PLAI1 32-34

 

28

 

12/13

 

Final (no exam, but due date for project)

 

 

Jay will not be present on days marked with a * in the Notes column.

This schedule is likely to change.

3 Assignments

 

Assignment

 

Code

 

Out

 

Due

 

Basic Racket*

 

basic

 

09/01

 

09/06

 

Lists and Trees

 

lists

 

09/06

 

09/08

 

Higher-order Functions*

 

hof

 

09/08

 

09/13

 

Rudimentary Interpreter

 

rinterp-java

 

09/01

 

09/22

 

Extended Interpreter*

 

xinterp

 

09/20

 

10/06

 

Language Analysis the First

 

wlang1

 

09/01

 

10/20

 

Game Survey

 

gsurvey

 

10/06

 

10/31

 

Analysis: Garbage Collection

 

wgc

 

10/18

 

11/01

 

Garbage Collectors

 

gc

 

10/18

 

11/10

 

Web Game Survey

 

webgsurvey

 

11/01

 

11/15

 

Analysis: Continuations*

 

wcont

 

11/01

 

11/28

 

Type Checker*

 

typec

 

11/10

 

11/28

 

Type Inferrer

 

typei

 

11/10

 

12/07

 

Analysis: Type Systems

 

wtype

 

11/29

 

12/08

 

Laziness and Infinite Data

 

lazy

 

12/06

 

12/09

 

Language Analysis the Second

 

wlang2

 

10/20

 

12/13

 

Analysis: Laziness*

 

wlazy

 

12/08

 

12/13

 

Prolog*

 

prolog

 

12/08

 

12/13

Assignments marked with a * are optional, extra credit. Assignments that are bold are required.

Out dates are suggestions—you may need to start earlier—but we ensure that the course will have covered everything necessary by that date.

This schedule may change.

4 Turn-In and Grading

I highly recommend that you read this article about grading. I also recommend you read this article about the stress that you may experience in a computer science program. Please try to make healthy productive choices in your life. I would love the opportunity to help you in any ways I can.

4.1 Bitbucket

You should do all your work for the course in a single private Bitbucket Git repository. (You can use Github if you want, but the private repositories there are limited, so don’t feel like you have to spend that resource on me.) When you start the class, you should go through the following process:
  • Create a Bitbucket account if you do not have one.

  • Create a repository named 2016-Fall-91.301.

    Ensure it is configured as a Git repository that is private. You can configure it with No forks, if you want.

  • Click on Settings and then click on Access management then add me (username: jeapostrophe) to the repository with the Read permission.

  • Initialize the repository by following the instructions on the Bitbucket site.

As you work on assignments, you should create a directory in the repository with the name of assignment and do all your work in that directory. You should commit and push often. I will watch over your shoulder and try to give you advice as you work. Thus, the more you push, the easier it will be for you, because you’ll get more attention from me. This video is a good tutorial on Git.

4.2 Preparation

When you do an assignment, you’ll create various files and commit them to your repository. Each assignment should have its own directory named code with all of its files in that directory.

Your main file should be named "main.EXT" where "EXT" is the appropriate extension. (For example, the Basic Racket assignment should be "basic/main.rkt".)

Every programming assignment should come with a text file containing the expected output of the program named "output.txt".

Every programming assignment should come with a "Makefile" that, when invokes with no arguments, produces an output text file named "actual.txt" and then displays the difference between this file and "output.txt" using diff -u.

Every programming assignment should come with a file named "README.txt" or "README.md". This prose document should explain how you know that your program is correct. Generally, the only acceptable argument is one based on connecting each part of the program specification to one or more test cases that verify that the program meets the specification. Almost all students receive 0s in their first few assignments because they do not adequately test their code or explain why their tests are good. Most of the later assignments require over one hundred tests to adequately verify.

Every written assignment should only contain the main file with an extension of either ".txt" or ".md", depending on whether you would like to use formatting.

For all types of assignments, only plain-text files in UTF-8 encoding with 80 column lines are accepted with Unix (\n) line endings. If you would like use formatting in writing, please use Markdown.

4.3 Turn-in

You turn in your assignments by tagging a revision on Bitbucket and then emailing me a link to the tag. Both of these things should be done before 6PM Lowell time on the due date listed. If either is late (even by a single second), it will not be graded. This is a real due date and due time. Please use this early due time to get a good night’s sleep and enjoy your evenings.

You should tag the revision with code of the assignment. You should email the link to me with [CS301] code as the subject (exactly), where code is the code listed on the assignment table under the Code column. Do not send multiple emails and do not make multiple tags.

Your email should contain nothing else in it.

Turn-ins that are not in the correct format will not be graded and you will get a 0 on the assignment. This precise format must be followed exactly or it will not be sorted correctly by my grading organization program.

4.4 Assignment Grading

All assignments will receive a grade from the closed interval between 0 and 1.

Your grade will start off at 1 and I will subtract 0.05 for every error or when a part of the specfication is unverified. For example, in the Higher-order Functions assignment, there are 12 functions that you have to write and it takes about three or four tests per function to verify its correctness, so there are about 48 instances where you could lose 0.05 points. Later assignments have many many more such instances.

4.5 Class Numeric Grade

I will take your various points and combine them with this function to get a numeric grade:

> (define easy 0.05)
> (define med 0.1)
> (define hard 0.2)
> (define (combine
           ; Required Assignments
           lists rinterp-java wlang1 gsurvey
           wgc gc webgsurvey typei wtype lazy
           wlang2
           ; Optional Assignments
           basic hof xinterp wcont typec
           wlazy prolog)
    (+ (+ (* easy lists) (* med rinterp-java)
          (* hard wlang1) (* easy gsurvey)
          (* med wgc) (* hard gc)
          (* easy webgsurvey) (* hard typei)
          (* med wtype) (* easy lazy)
          (* hard wlang2))
       (+ (* easy basic) (* easy hof)
          (* med xinterp) (* med wcont)
          (* med typec) (* med wlazy)
          (* hard prolog))))

Examples:
> (combine 0.0 0.0 0.0 0.0
           0.0 0.0 0.0 0.0 0.0 0.0
           0.0
           0.0 0.0 0.0 0.0 0.0
           0.0 0.0)

0.0

> (combine 1.0 1.0 1.0 1.0
           1.0 1.0 1.0 1.0 1.0 1.0
           1.0
           0.0 0.0 0.0 0.0 0.0
           0.0 0.0)

1.3

> (combine 1.0 1.0 0.0 1.0
           1.0 1.0 1.0 0.5 1.0 0.5
           1.0
           1.0 1.0 0.0 0.0 1.0
           0.0 0.0)

1.175

> (combine 1.0 1.0 1.0 1.0
           1.0 1.0 1.0 1.0 1.0 1.0
           1.0
           1.0 1.0 1.0 1.0 1.0
           1.0 1.0)

2.0

These weights are designed so that a "normal" good student will get 1.0. I assume that a normal student will not get 1.0 on all assignments, so the required assignments are weighted to add up to more than 1.0.

A wise student would do the Basic Racket and Higher-order Functions assignments no matter what to better learn to use Racket. Similarly, a wise student would do Type Checker, because it is so close to Type Inferrer, which is a required assignment. The others are just for particularly excited students. The best assignment for becoming an elite PL wizard is Prolog.

4.6 Class Letter Grade

I will then run the following function to convert it to a letter:
> (define (convert-to-letter ng)
    (cond
      [(> ng 0.93) "A"]
      [(> ng 0.9) "A-"]
      [(> ng 0.86) "B+"]
      [(> ng 0.83) "B"]
      [(> ng 0.8) "B-"]
      [(> ng 0.76) "C+"]
      [(> ng 0.73) "C"]
      [(> ng 0.7) "C-"]
      [(> ng 0.66) "D+"]
      [(> ng 0.6) "D"]
      [else "F"]))

Examples:
> (convert-to-letter 1)

"A"

> (convert-to-letter 0.94)

"A"

> (convert-to-letter 0.899999)

"B+"

> (convert-to-letter 0.81)

"B-"

> (convert-to-letter 0.74)

"C"

> (convert-to-letter 0.6999999)

"D+"

> (convert-to-letter 0.62)

"D"

> (convert-to-letter 0.57)

"F"

5 Help

My job is to help you.

If you need a "shallow" amount of help, then look at the Google Group. First, see if I have already answered your question. Then, send your own email.

Only send me personal email if you need to talk about something private, such as your grades. Anything else is best discussed in public, so others can benefit. If you do send personal email, put [CS301] as a prefix in the subject.

If you need a "deep" amount of help, please come to my office or call me (801-361-0732) and we’ll talk and try to resolve whatever ails you.

If you are having trouble understanding the basics of Racket, read the tutorial that comes with DrRacket and maybe Teach Yourself Racket.

If you are having trouble knowing what library functions will be useful in Racket, read the following sections of the Guide to Racket: Racket Essentials, Symbols, and Pairs and Lists. Late in the course you will find Continuations, Web Interaction, and Pattern-Based Syntax Matching useful.

If you are having trouble knowing where to start, use the design recipe from How to Design Programs.

DrRacket comes with an extensive manual and help system. The documentation is available by clicking the Help|Help Desk menu item. This will open up a browser window to your local copy of http://docs.racket-lang.org. Use the search box to find function and syntax documentation. (Everything the search box returns is clickable.)

PLAI. Most assignments are written with a library specifically designed for this class. It is documented in a separate manual that is available by clicking the plai in the #lang instructions for each assignment. Try it:

#lang plai

6 Readings

(HTDP) In the beginning of the course, we will use the free online textbook How to Design Programs, by Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi, to introduce the Racket programming language.

(PLAI) For the majority of the course, we will use the second edition of the free online textbook Programming Languages: Application and Interpretation, by Shriram Krishnamurthi. (In one instance, we will use the first edition.)

(Wilson) Eventually we will look at Paul Wilson’s survey of Garbage Collection methods later in the course.

We will not be using the textbook in the traditional way. Think of the textbook as your lecture notes. Don’t read it before a class, but refer to it afterwards. The book is superb, so you won’t need to distract yourself from the discussion by taking copious notes. (You may want to take note of your ideas and insights, but the content of the lecture will be in the textbook.)

7 Software

We will use DrRacket v6.6 (or higher) for many programming assignments. Do not use an older version of DrRacket!

We will use three language extensions: Basic Student, Intermediate Student with Lambda, Typed PLAI, and PLAI.

To use Basic Student: Open DrRacket. From the Language menu, click Choose Language.... Expand How to Design Programs. Select Basic Student. Click OK.

To use Intermediate Student with lambda: Open DrRacket. From the Language menu, click Choose Language.... Expand How to Design Programs. Select Intermediate Student with Lambda. Click OK.

To use PLAI: Open DrRacket. From the Language menu, click Choose Language.... Select the Determine language from source. Type this at the beginning of your program:

#lang plai

The textbook and lectures uses another language called Typed PLAI, but we won’t use it for assignments.

To install Typed PLAI: Open DrRacket. From the File menu, click Install Package and type plai-typed.

To use Typed PLAI: Open DrRacket. From the Language menu, click Choose Language.... Select the Determine language from source. Then you can copy in the code from the book or class.

Finally, I’d like you to do all your work on a Bitbucket repository that you share with me, so make sure you get yourself set up with that.

8 Fine Print

In this course, all work is to be each student’s own. Students should therefore be familiar with the University’s rules on academic dishonesty, which can be found in the Bulletin of Undergraduate Studies and in the Schedule of Classes. In particular, plagiarism will not be tolerated! Any student caught plagiarizing another’s work will automatically receive a grade of F for the course. If you are unsure as to what constitutes plagiarism, it is your responsibility to check with the instructor. Other forms of dishonesty will result in similar actions. You may collaborate with your classmates on the design and results of the programs you will write in this course, but each student must implement these programs alone. Submission of shared student code is not permissible, and will result in a grade of F for the course. Help files are typically provided for each programming assignment, and students are encouraged to cut and paste useful code from these help files into their assignment submissions, but all other code must be the specific work of each student.

You are not allowed to post solution code to problem sets assigned in this class in public places (e.g. Github). This includes your own solutions as well as solutions that may be provided by the instructors. This policy is a courtesy to future students, who — to the fullest extent possible — should have the opportunity to struggle with the problems in the same way that you do. Non-compliance will be pursued rigorously per UMass Lowell’s academic integrity policy.