Programming Language Design (Fall 2011)
This class is taught by Jay McCarthy. Call him Jay.
We meet in 3712 HBLL at 2pm and 3pm MWF.
Jay McCarthy’s office hours are 9am to 4pm, except during classes and lunch, in 3328 TMCB.
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.
The fundamental tool of a computer scientist and software engineer is the programming language. Programming languages of all shapes and sizes are found under every rock in computing. There are large, mainstream languages that everyone uses regularly. But, there are also small, domain-specific languages that are like feudal lords: well-known to their subjects, but anonymous in the wider world.
Few of us will design a large mainstream language during our careers, but almost all of us will (need to) design and implement a small language. This design will be implicit and ad-hoc if we’re not educated.
This course will prepare you to understand the design of all languages and to design and implement small ones. In contrast to other courses of this nature, we will not treat programming languages like fish and try to make little boxes for them to fit in. Programming languages are not fish. Instead, we will explore the “periodic table” of languages features and concepts. In particular, this course will not teach you to program in many languages. There is too much noise in that approach that distracts from the real differences.
Overview / Racket: Numbers, Symbols, Expressions, Check Expect
Racket: Designing Programs, Functions, Conditionals, Structures
Racket: Lists, Natural Recursion
Racket: Recursive Structures / Higher-order Functions
HtDP 14 & 20
Code Review: Lists and Trees
Code Review: Rudimentary Interpreter
Code Review: Extended Interpreter
Code Review: Laziness and Infinite Data
Web Programming, cont.
Web Programming, cont. and CPS
PLAI 21, Wilson 1
GC: Reference Counting and Mark&Sweep
GC: Stop&Copy and Generation Collection
GC: Generational, Low-level, New features
Macros: Compiler Extension
Macros: Compiler Extension
Final @ 11:00am
Final @ 11:00am
Jay will not be present on days marked with a * in the Notes column.
This schedule may change.
All assignments are due by 5 PM (Provo time) on the day listed. (Why? No, really.)
Late assignments will receive no credit.
This schedule may change.
My job is to help you. Please ask for help. (But read section this first.)
Sign up for the Google Group, I may have already answered questions about the assignment.
If you are having trouble understanding the basics of Racket, read the tutorial that comes with DrRacket.
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.)
5 Turn In Policy
Assignments are to be emailed to email@example.com.
The subject line must be: "BYU - Fall 2011 - CS 330 - x", x is the contents of the “Code” column for the assignment.
Only one email should be sent per team. If more than one is sent, I will grade the oldest one. The message body should be the names of the team members one per line.
You should attach a zip archive of your work. The archive should contain a folder with the same name as the “Code” of the assignment. Even assignments with one file should create a folder. Each assignment specifies the names of files.
The only file formats that will be accepted are files produced by DrRacket (for code) and PDFs (for written assignments).
Assignments that do not have the correct format will receive no credit.
For example, if my name were Joseph Smith, I would submit the Rudimentary Interpreter assignment as follows. I would send an email with the subject “BYU - Fall 2011 - CS 330 - rinterp”. The email would contain “Joseph Smith” as the first line. The email would have an attachment named "rinterp.zip". When extracted, it would create a directory named "rinterp" that contained two files, "wae1.rkt" and "wae2.rkt".
In the beginning of the course, we will use the free online textbook How to Design Programs (HtDP), by Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi, to introduce the Racket programming language.
For the majority of the course, we will use the free online textbook Programming Languages: Application and Interpretation (PLAI), by Shriram Krishnamurthi. 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.)
We will use DrRacket v5.1.2 (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, 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.
There is no midterm. There will be a final in class during the scheduled time. It is one question. It isn’t that scary though.
Each assignment is graded with a number between 0 and 1.
A presentation receives a 0 if you do not do it, a 0.5 if you do it poorly, and a 1 if you do it well.
9.2 Written Assignments
Each question on a written assigment receives a grade from 0 to 1, based on its correctness and your ability to show that you understand it is correct.
The entire written assignment receives the average of these grades.
9.3 Coding Assignments
Every program has a set of features that it must provide. For example, in the early assignments, each function is one of these features. However, once we start writing interpreters, each form in the language (arithmetic expressions, conditionals, etc) is its own feature. The set of features is consciously only implicitly specified in the assignment texts. If you have questions or doubts about a specific assignment, feel free to ask.
Each feature of a program receives a grade from 0 to 1, depending on (a) whether it is implemented correctly, (b) whether you adequately show (through tests) that the feature is implemented correctly, and (c) whether it is correctly documented (for example, in the contract and purpose statement and in explanations of what the tests show.)
If any of these missing for a given feature, you will receive no credit. This means that if you implement it correctly, but do not document that it is correct, you will receive no credit. This means you can do it correctly, but forget a simple test, and you will receive no credit.
The entire coding assignment receives the average of these grades.
10 Your Final Grade
Recall that each assignment is graded with a number between 0 and 1.
The table of assignments has weights for each assignment (and the final).
Each assignment’s grade times its weight and summed is your final numeric 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.63) "D"] [(> ng 0.6) "D-"] [else "F"]))
11 Team Work
Most assignments for this class will be done in teams (pairs, with a single triple if enrollment is an odd number). Our assignments tend to be short on code but long on thinking, so this will give you the opportunity to fully discuss a solution with another person. You will work with three different people over the course of the semester.
Programming in teams does not mean each person writes part of the code and the team simply pastes together these contributions. Each person is responsible for every line of code, documentation, etc. turned in. This responsibility extends over written assignments as well. It includes getting or losing points for quality, being able to explain the work, and also incurring penalties in case of plagiarism or other violations. That said, we will sometimes ask you questions individually and, if you are unable to answer them, we may give you less credit than your teammates. In short, working in teams is meant to help you learn material better, not to enable you to do less work than you would have if the assignment had to be done individually.
For team projects, you may not discuss the assignment with a student not on your team.
We recommend that teams develop the software together using pair-programming techniques (of the form preached by Extreme Programming) though this is a suggestion, not a requirement. Pair-programming in a nutshell:
Both programmers share a single computer, monitor, and keyboard.
One person is the typist, the other watches what is being typed and critiques it.
Programmers switch roles at regular intervals. (Note that this is also good for preventing RSI!)
Both programmers jointly own every single line of code, no matter who typed it.
While this does require that you schedule times to work with your team, we think that pair-programming will increase your productivity and aid you in taking responsibility for all of your code.
You may not work with the same partner on multiple teams.
Once you have selected a partner please inform the course staff. If you are having difficulty finding someone to be your partner, please contact us and we will attempt to match you with another student.
We will use codewalks, a common practice at software companies, to evaluate some of your programs. A codewalk is a presentation where you, the programmer, convince us, a jury, of specific properties of your program. You accomplish this by presenting your program and answering questions about it. We are most interested in
correctness: does it do the right thing?,
extensibility: how adaptable is it to related tasks?,
robustness: is it built like a house of cards?, and
performance: does it avoid poor implementation decisions?.
Each program will receive about 30 minutes of scrutiny. The code you present must the be the same code you turned in electronically. We will not tell you if we will conduct a codewalk for an assignment until after you have turned in a solutions for it. No excuses or exceptions; you read it here.
Here is some advice from past students in the class:
“Go see Jay early when they are stuck on a project. Starts the projects early. Don’t get discouraged!”
“Don’t despair. It gets better. If you do the assignments and try to understand them, you will do better than you think you’re doing.”
“Don’t be afraid to ask for help, ’cause Jay is quite willing to answer questions.”
“Notes are not so very helpful in most of the class. Focus on understanding first.”
“Go to Jay’s office a lot.”
“Start early and ask good questions.”
“Be prepared to spend far more time on this class than you were expecting to.”
“Start projects earlier and take it from Jay McCarthy!!!”
“Learn to talk to Jay. Go up to his office. He’s unbelievably helpful.”
“Be prepared to sacrifice a lot of time for this class if you really want to understand the topics well, and to do well on the assignments.”
“Give yourself enough time to adequately finish the assignments, and use Jay!”
“Talk to the teacher! Don’t go it alone, you’ll get lost.”