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: Daniel Busis (busisd)
Lab assistants / graders: Danielle Eisen (eisend), Adam Huang (huanga2)

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 "Personal office meetings." "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! "Personal office meetings" are designed for one-on-one 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. Please keep these spots just for particularly personal topics; if you're looking for general help with the course material, please go to the open office hours. Thanks!
  • 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.
  • 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 1a scheduled class time so that we can do some discovery activities together. We will continue to meet together as a group on Mondays from 9-9:40am. I will record these sessions so you can see them later if you cannot attend. These Monday 1a sessions are not required but are highly encouraged.

Grading

There won't be any large-scale exams in this course. You'll mostly be doing assignments, but you'll also be doing some online quizzes.

The entire course will be graded on a S/Cr/NC basis.

Likewise, each assignment will similarly be graded on the same scale:

  • An S grade for an assignment will be given for work that successfully achieves the core goals. It might have some bugs or issues and/or miss some of the details, but it demonstrates that the core concept of the assignment was completed.
  • A Cr grade for an assignment will be given for work that is coherent and that clearly makes an attempt to complete the task with the right ideas, but does not succeed at achieving the basic goals of the assignment.
  • An NC grade for an assignment will be given for work that doesn't fall into either of the above two categories.

The quizzes will be 1 point for each question; they will vary regarding how many questions there are. At the end of the term, the quizzes will count as a single assignment, with a single S/Cr/NC grade. A grade of 70% or better on the quizzes earns an S for the quizzes; a grade of 60%-70% on the quizzes will earn a Cr for the quizzes; a grade below that will earn an NC for the quizzes.

You will receive a grade of S in the course if:

  • at least half of all of your assignments earn a grade of S, and
  • at least 2/3 of all of your assignments earn a grade of S or Cr.

You will receive a grade of Cr in the course if:

  • You have not reached the threshold for an S for the course, and
  • at least 2/3 of all of your assignments earn a grade of S or Cr.

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 will have a specific time for which it will be due, and your electronic submissions are timestamped. On any assignment, you can turn it in late up to 48-hours after the deadline, with no penalty. This automatic grace period is designed to cover technology problems you may face, as well as personal challenges. You should treat all assignments as due on the actual due date, and use this grace period only to handle the inevitable non-course-related emergencies that will arise.
  • Once the 48-hour grace period has passed, there is a penalty for turning in assignments late beyond that. Homework turned in within the next 48 hours after the original 48-hour grace period is over will will receive a Cr if the assignment should otherwise have received an S. In all other cases the assignment will receive an NC.

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.

Individual vs team grades

For each assignment that you work on in a team with other students, you'll receive a grade based on the quality of that joint submission. This grade will be used to form part of your overall homework average. Your overall homework score will form part of your course average, which will be used to determine a final grade.

That said, you also must do work of passing quality on your individual assignments and quizzes in order to pass the class.

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. You can use the Repl.it chat window to communicate with each other, though an even better approach would be to use Google Hangouts, or 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 simplly to give you a rough idea as to what to expect.

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