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 |
|
| PLAI2 1 / HtDP 2 | |
| 2 |
| 09/06 |
| Racket: Designing Programs, Functions, Conditionals, Structures, Lists, Natural Recursion |
|
| HtDP 3-6, 9 | |
| 3 |
| 09/08 |
| Racket: Recursive Structures / Higher-order Functions |
|
| HtDP 14 & 20 | |
| 4 |
| 09/13 |
| Parsing & Basic Interpretation |
|
| PLAI2 2-3 | |
| 5 |
| 09/15 |
| Basic Interpretation & Desugaring |
|
| PLAI2 3-4 | |
| 6 |
| 09/20 |
| Functions |
|
| PLAI2 5* | |
| 7 |
| 09/22 |
| Environments |
|
| PLAI2 6* | |
| 8 |
| 09/27 |
| First-class Functions |
|
| PLAI2 7 | |
| 9 |
| 09/29 |
| Mutation: Basics & The Store |
|
| PLAI2 8-8.1.8 | |
| 10 |
| 10/04 |
| Mutation: Variables |
|
| PLAI2 8.1.8-8.4 | |
| 11 |
| 10/06 |
| Recursion |
|
| PLAI2 9 | |
| 12 |
| 10/13 |
| Objects |
|
| PLAI2 10 | |
| 13 |
| 10/18 |
| Memory management: GC, Reference Counting, & Mark and Sweep |
|
| PLAI2 11, Wilson 1-2.3 | |
| 14 |
| 10/20 |
| Memory management: Stop and Copy & Generational Collection |
|
| PLAI2 11, Wilson 2.4-9 | |
| 15 |
| 10/25 |
| Representation Decisions and Church Encoding |
|
| PLAI2 12 | |
| 16 |
| 10/27 |
| Desugaring |
|
| PLAI2 13 | |
| 17 |
| 11/01 |
| Control: Web Basics & CPS |
|
| PLAI2 14.1-2 | |
| 18 |
| 11/03 |
| Control: CPS Interpreter |
|
| 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 |
|
| PLAI2 15.3.2 | |
| 25 |
| 12/01 |
| Types: Let-Polymorphism, Structural vs Nominal, Subtyping, Objects and Curry-Howard |
|
| PLAI2 15.3.2.3 & 15.3.4-5 & 15.3.7 & 15.3.7.3-15.3.8 | |
| 26 |
| 12/06 |
| Laziness |
|
| PLAI2 17 | |
| 27 |
| 12/08 |
| Prolog |
|
| 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 |
| 09/01 |
| 09/06 | |
|
| lists |
| 09/06 |
| 09/08 | |
|
| hof |
| 09/08 |
| 09/13 | |
|
| rinterp-java |
| 09/01 |
| 09/22 | |
|
| xinterp |
| 09/20 |
| 10/06 | |
|
| wlang1 |
| 09/01 |
| 10/20 | |
|
| gsurvey |
| 10/06 |
| 10/31 | |
|
| wgc |
| 10/18 |
| 11/01 | |
|
| gc |
| 10/18 |
| 11/10 | |
|
| webgsurvey |
| 11/01 |
| 11/15 | |
|
| wcont |
| 11/01 |
| 11/28 | |
|
| typec |
| 11/10 |
| 11/28 | |
|
| typei |
| 11/10 |
| 12/07 | |
|
| wtype |
| 11/29 |
| 12/08 | |
|
| lazy |
| 12/06 |
| 12/09 | |
|
| wlang2 |
| 10/20 |
| 12/13 | |
|
| wlazy |
| 12/08 |
| 12/13 | |
|
| prolog |
| 12/08 |
| 12/13 |
Assignments marked with a * are optional, extra credit. Assignments that are bold are required.
Out dates are suggestions—
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
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))))
> (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
> (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"]))
> (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:
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:
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.