CS 251: Programming Language Design and Implementation

Table of Contents

Course overview

Programming languages are the tools that we use to communicate with computers to get them to do our bidding. Of the four most well-known programming language paradigms, only object-oriented programming (such as in Python and Java) is commonly seen outside of this course here at Carleton. To better understand other programming language paradigms, we will program in two other main paradigms: functional programming (Scheme), and imperative programming (C). In doing so, the goal is to gain an understanding of characteristics from each, and to appreciate that each has made different trade-offs in design reflecting the creators’ goals. Additionally, practice at these dramatically different approaches to programming help making learn new languages easier to do. Moreover, we will develop in C an interpreter for Scheme, in order to see how a programming language interpreter can actually be constructed.

Course information

  • Instructor: Dave Musicant
  • Email: dmusicant
  • Prefect: Cole DiIanni (diiannic)
  • Lab assistants / graders: Tessa Newman-Heggie (newmant2), Shiyue Zhang (zhangs)

Textbook

None. We’ll be using a variety of online and reserved resources.

Communication

We’re online, so we’ve got a variety of ways of communicating with each other.

  • I will use Moodle announcements for all general purpose announcements to the entire class. You will get an email copy of those announcements, and they are also kept in the Moodle announcements forum if you want to see them again later.
  • Any questions you have about the course should be posted to the Moodle Questions & Answers forum. It’s a great way to get to see what each other are asking. Please pitch in and help each other out: if you know the answer to someone else’s question, please go ahead and answer it. I’ll sometimes follow up a simple “+1” response to indicate that I concur with the answer. If you wish, there is an option to post anonymously so that other students of the class can’t see who it was.
  • Office hours: I have a link on the Moodle page to my office hours schedule for the term. There are two different kinds scheduled: “Open office hours,” and “Waiting room office hours.” “Open office hours” is the default, and is an open Zoom meeting that anyone can attend. When you arrive, if I’m talking with someone else, drop your name in the chat window to indicate that you’re waiting. Feel free to listen and contribute to the conversation if what we’re talking about is of general interest! “Waiting room office hours” are better for discussions of a more personal nature. I have those also scheduled via Zoom, with a Zoom waiting room. That way I can talk to people one-on-one, and admit people from the waiting room.
  • Frequency of communication: you should check the course Moodle site and your email at least once a day. I’ll be checking the Moodle Q&A forum and my email, and responding to people three times a day: once early in the morning (likely before 7am CDT), once roughly in the middle of the day (sometime 11am-2pm), and once near the end of the working day (sometime 4pm-5pm). I’ll be less reliable on weekends. When engaging with course activities online, always use your Carleton Gmail/Google account rather than personal accounts.

What you will be doing

The key goal over this term is for you to first learn to program in Scheme, then for you to build a Scheme interpreter in C. It’s pretty fantastic: at the end of the term, your interpreter should be able to run all of the Scheme code that you will have written early in the term. To accomplish this, you’ll be doing a number of things.

  • Watching videos. I’ll be replacing course lectures with videos that I will have linked on Moodle. After each video, I’ll have a short quiz for you to do. I will have deadlines for those quizzes, in order to keep you on track with watching the videos. I’ll try to simulate a class rhythm by having these quizzes due three times a week.
  • Reading online materials. I’ll supplement my videos with online references for you to read. I will not be quizzing on these so I’ll consider them somewhat optional. Some of them, though, are really useful and will help you learn the course content better if you read them.
  • Doing assignments. I’ll have assignment posted to Moodle, with deadlines attached to them. You’ll need to submit those. Some of them will be individualized, and some of them will be done via (remote) pair programming. Either way, you can still talk with others about the assignment, and get help.
  • Doing take-home exams. These will seem pretty similar to assignments regarding what you’ll be asked to do. The key difference is that you’ll be working on them yourself, without collaborating with others.
  • Participating in real-time class sessions. We’ll be doing most of our interaction “asynchronously” (over Moodle forums, having you watch videos, etc.), but we’ll keep a portion of our scheduled class time so that we can do some discovery activities together. We will continue to meet together as a group on Mondays from 10-11am. I will record these sessions so you can see them later if you cannot attend. These Monday sessions are not required but are highly encouraged.

Grading

Grading for this course will be based on your performance on:

  • the quizzes following the videos that you’ll watch
  • the paired programming assignments
  • the individual programming assignments
  • the take-home exams

You will receive a separate grade for each of the above categories, and then it will be aggregated together to determine a final grade. Here are some more details on each, and then how the results will be combined.

Video Viewing Participation Quizzes

The quizzes are intended to be straightforward, and are intended to help keep you up to date in watching the videos. When a class day has a series of videos to watch, you’ll follow that with a quick of typically 3-5 questions, so there will be approximately 12-15 questions per week. You’ll simply receive a total percentage grade for your quizzes at the end of the term.

Paired programming and individual programming assignments

Each paired programming assignment will receive one of these four grades. (Thanks to Robert Talbert for inspiration)

  • E: Exemplary work: All specified functionality is working correctly.
  • M: Meets expectations. The core functionality of the assignment has been correctly completed, but one or more of the exemplary-level aspects may not be working correctly.
  • R: Revision recommended. The assigned task has been partially completed to a level indicated some understanding of the concepts, but the core required functionality has not been completely achieved.
  • N: Not assessable. The work is not complete enough to indicate that a baseline level of understanding has been achieved. This likely applies when the work has not been turned in or has very large gaps in functionality or in implementation.

For the programming assignments, correctness will be determined based on a set of automated tests that will be provided. This way, you know what your grade will be when you submit your work. (The one exception is that we will review your code to verify that you haven’t tailored your code too directly to the specific tests that we have written.)

Take-home exams

There will be a total of 20 questions divided roughly evenly over the three take-home exams. Each question will be designed to test your understanding of a portion of one of the previous homework assignments. These questions will be graded similarly to the assignments:

  • M: Meets expectations. All specified functionality is working correctly.
  • R: Retake recommended. The assigned task has been partially completed to a level indicated some understanding of the concepts, but the specified functionality has not been completely achieved.
  • N: Not assessable. The work is not complete enough to indicate that a baseline level of understanding has been achieved. This likely applies when the work has not been turned in or has very large gaps in functionality or in implementation.

As with the assignments, there will be automated tests that you can use to determine if you are achieving the goals successfully. The key difference with the take-home exams from the assignments is that you are not permitted to collaborate with others. I’ll have more detail on that when the first exam draws near.

Your aggregate grade

For the individual and for the paired assignments, you can resubmit your work as many times as you like during the term to improve your grade. (Since the correctness will be determined mostly via tests, you’ll essentially know what your grade for an assignment is before you’ve submitted it.)

For the take-home exam questions, you can similarly resubmit, but if you have decided to ask me for help on the problem because you want to learn better how to do it, you will instead need to resubmit a similar but different problem that I will assign.

The more items you successfully complete in each category, the higher your course grade will be.

The below descriptions indicate minimum criteria for earning grades of A-, B-, C-, and D-. Below these criteria an explanation follows regarding how these can get plus/minus boosted (e.g., how a B- might become a B or a B+).

To receive a course grade of A-, you must have earned all of the following:

  • at least 90% of the questions correct for the video viewing participation quizzes
  • a score of M or E on at least 11 of the 12 paired assignments, but the last assignment must be one of them
  • a score of M or E on all 7 individual assignments
  • a score of M on at least 18 of the 20 take-home exam questions

To receive a course grade of B-, you must have earned all of the following:

  • at least 80% of the questions correct for the video viewing participation quizzes
  • a score of M or E on at least 10 of the 12 paired assignments
  • a score of M or E on at least 6 of the 7 individual assignments
  • a score of M on at least 16 of the 20 take-home exam questions

To receive a course grade of C-, you must have earned all of the following:

  • at least 70% of the questions correct for the video viewing participation quizzes
  • a score of M or E on at least 9 of the 12 paired assignments
  • a score of M or E on at least 5 of the 7 individual assignments
  • a score of M on at least 14 of the 20 take-home exam questions

To receive a course grade of D-, you must have earned all of the following:

  • at least 60% of the questions correct for the video viewing participation quizzes
  • a score of M or E on at least 8 of the 12 paired assignments
  • a score of M or E on at least 4 of the 7 individual assignments
  • a score of M on at least 12 of the 20 take-home exam questions

You can boost your course grade (remove a minus and/or add a plus) with exemplary grades. There are two ways to do this:

  • You receive a boost at a particular level if at least half of the required number of paired assignments received a grade of E
  • You receive a boost at a particular level if at least half of the required number of individual assignments received a grade of E.

For example, suppose you have reached the B- level. Suppose further that either

  1. 5 of your paired assignments got a grade of E (that’s at least half of the 10 required for B-), OR
  2. 3 of your individual assignments got a grade of E (that’s at least half of the 6 required for B-).

In the above situation, you would receive a grade of B. If both of the above were true, you would receive a grade of B+.

I will be using Moodle for all grading. You should be able to view your current grades at any time by clicking the “hamburger” button at the top left of the Moodle page, and then selecting “Grades”.

Late policy

Each assignment and take-home exam will have a specific time for which it will be due, and your electronic submissions are timestamped. You have seven “late-days” that you can use at anytime during the term, with no explanation or request needed. If you are unable to coordinate with your partner, if you are sick, etc., these are all exactly the sorts of situations for which these late-days apply. You automatically use up a late-day for every 24 hour period that passes when you turn in an assignment late. For example, if you turn in two assignments late, each 17 hours after the due time, that counts as two late-days. Likewise, if you submit a single assignment 30 hours after the due time, that also counts as two late-days.

Once your seven late-days are used up, you may request that they be refreshed with a new set of seven late-days. To do so, you need to send me an email explaining how the late days got used up, and send me a list of your schedule for the remaining assignments in the term. However, if you do not request those extra late days, assignments will not receive a grade if they are late and there are no late days left.

Make sure to look carefully at the schedule at the end of this syllabus. There isn’t any extra room at the end of the term, so getting behind on assignments means that there will be severe crunch later on in the term!

Quizzes

For quizzes in particular, Moodle does not allow late submissions. If you need to do a quiz late, send me an email and tell me, and I will extend the quiz deadline for you (and adjust your late-days accordingly).

How to get help

There are lots of resources for help in this course!

  • I have two kinds of office hours, described above.
  • We have a course prefect, who will hold prefect sessions.
  • We have two lab assistants with expertise in this course, who will be holding lab assistant hours.

Working together

  • Each programming assignment will either be a “team” problem assignment or an “individual” assignment.
  • When working on team problems, you and your partner should engage in the pair programming model. We’ll be using the programming environment Repl.it, which allows you to code together remotely using “multiplayer” mode. This is similar to collaborating on a Google doc, except that it’s a programming environment. One of you is “driving,” i.e. actually using the keyboard and mouse. The other is actively engaged following along, stopping bugs, and providing ideas. If you are not in the same room as your partner, you can use the Repl.it chat window to communicate with each other, though an even better approach would be to use Zoom, Google Hangouts, Facetime, a phone call, or some other voice approach. You should make sure that over the course of an assignment that you spend roughly the same amount of time each “driving.” I will also ask you to turn in a form rating the work that your partner does.
  • If you are determined to work alone on the team assignments, that’s fine. I will expect, however, that you do work of the same amount and quality as those students with partners. You can change whether or not you work alone each “cycle” that I assign new partners.

Instructional continuity

In these unprecedented times, we will need to exhibit flexibility and patience with each other throughout the term. I have done my best to design the course so that everyone can be successful, regardless of personal circumstances. Communication will be key; please keep me updated about your situation in addition to reaching out to the other relevant offices on campus. If you experience significant technological problems that limit your ability to participate, please contact the ITS Helpdesk at 507-222-5999 or helpdesk@carleton.edu. For announcements of known technical issues, visit the Helpdesk portal. If your personal situation (due to COVID-19 illness or other circumstances) begins to impact your ability to engage with the course, please contact the Dean of Students Office.

Collaboration, plagiarism, and the difference between the two

There are two different kinds of working together: collaborating and plagiarism.

Collaborating

Collaborating is good. You are encouraged to collaborate on ideas and program design. Programming is often a social effort, and there is much you can learn by talking out the ideas in this class with each other. If a piece of your program utilizes someone else’s idea, i.e., someone other than the program author(s), you must give that person credit in your credits.txt file. When in doubt, give credit.

Plagiarism

Plagiarism is bad. DON’T DO IT!

  • Any programs that you turn in should be your work of the author(s) only.
  • Even if the program author(s) share ideas with others, the program itself must be written by the author(s).
  • If a piece of your program utilizes someone else’s idea, you must make sure to give that person credit in program comments.

The following are examples of plagiarism.

  • Taking someone else’s program, changing the variables and comments around, putting your name at the top, and turning it in.
  • Finding a similar program on the internet, changing the variables and comments around, putting your name at the top, and turning it in.
  • Finding a similar program in a book, changing the variables and comments around, putting your name at the top, and turning it in.

I am compelled by Carleton policy to submit plagiarism cases that I find to the Dean of Students, who in turns brings the evidence before the Academic Standing Committee. The academic penalty for a finding of responsibility can range from a grade of zero in the specific assignment to an F in the course.

Course outline

This is a rough schedule of what we’ll be covering throughout the term. The actual Moodle page itself will be the precise and accurate description of what is due and when, and what readings you should be looking at. This overview is intended simply to give you a rough idea as to what to expect.

# Date Planned topic Reading Assignment due
1 M Sep 14 PL and class overview Major Programming Paradigms (Tues) Intro (Tues)
2 W Sep 16 Scheme programming Dybvig Scheme book, sections 2.1 and 2.2 (Wed) Scheme lab 1
3 F Sep 18 Scheme programming Dybvig Scheme book, sections 2.3 and 2.4 (Fri) Scheme lab 2
4 M Sep 21 Compilers vs interpreters, Scheme environments Dybvig, sections 2.5 and 2.6, Stack Overflow: What is Currying? Scheme Binary Search trees
5 W Sep 23 Map, fold/reduce, in-class examples, tail recursion Tail call optimization sections 1 and 3 Scheme Lazy Lists
6 F Sep 25 Tail recursion, C programming, reference vs value model Assignments: Variable Model…, (Skim: see note 1 below): C Tutorial Scheme Currying/Higher Order
7 M Sep 28 C programming, stack/heap/static memory Memory: Stack vs Heap, C header files Scheme Sieve
8 W Sep 30 None, exam day None, exam day Take-home exam
9 F Oct 2 C header files, linked list example Pointer Fun with Binky, Pointers in C C lab 1
10 M Oct 5 C include guards, C strings Header / include guards, Strings C lab 2
11 W Oct 7 Interp 1 discussion Wikipedia: Compiler, Wikipedia: Interpreter Vector part 1
12 F Oct 9 BNF, derivations Grammars and trees / BNF Vector part 2
13 M Oct 12 Interp 2 discussion, tokenizing, parsing    
14 W Oct 14 Lambda calculus?   Interp 1: Linked list
15 F Oct 16 Interp 3 discussion, parsing, interpreting Scott PLP 2.3 (prologue) (using under fair use) Interp 2: Talloc
  M Oct 19 MIDTERM BREAK   BREAK
16 W Oct 21 Recursive descent parsing Scott PLP 2.3.1  
17 F Oct 23 Interp 4 discussion, parsing None; catching up Interp 3: Tokenizer
18 M Oct 26 None, exam day None, exam day Take-home exam
19 W Oct 28 Recursive descent parsing (RDP), predict sets Scott PLP 2.3.2 (subsection marked “Predict sets”, pp.79-82)  
20 F Oct 30 Interp 5 and 6 discussion, RDP None; catching up Interp 4: Parser
21 M Nov 2 Scoping Scope and extent  
22 W Nov 4 Interp 7 discussion, Stack vs heap implementations The Environment Model of Evaluation Interp 5: If/let
23 F Nov 6 Memory implementations A Fast Storage Allocator (buddy memory alloation) Interp 6: Quote
24 M Nov 9 Dangling pointers Dangling References  
25 W Nov 11 Interp 8 discussion, Garbage collection Wikipedia: Reference Counting (first 3 sections), Tracing Garbage Collection Interp 7: Define / lambda
26 F Nov 13 None, exam day None, exam day Take-home exam
27 M Nov 16 Interp 9 discussion, Parameter passing techniques Evaluation strategy (skip “Nondeterministic strategies” at end)  
28 W Nov 18 Catchup; time checking, polymorphism(?)   Interp 8: Primitives
EW       Interp 9: Complete