Homework 0
Preparing for the Course

Due: Thursday, August 28, at 10:00 AM

Introduction

The first task is a short survey about your programming goals, background, and preferences. I will use this information to help us assemble teams for the course project.

The second task is a short set of questions to help you focus your reading of a small compiler. We will discuss the compiler, these questions, and more in Session 2.

The Fizzbuzz Compiler

The Fizzbuzz language allows us to write programs that solve the Fizz Buzz problem, a toy problem much discussed as a question in interviews for software developer positions.

Download this zip file containing the Fizz Buzz compiler.

The Fizz Buzz compiler is written in Python. It compiles programs written in the Fizzbuzz into Python.

Your assignment is to review the compiler in preparation for Session 2.

First, familiarize yourself with the source language:

  1. Read the README file in the code distribution. It includes the grammar of the source language.
  2. You can then learn more about the language by reading two sample programs in the programs/ directory.
  3. Next, use the example in the README file to compile one of the sample programs to create a Python target file.

Now, dig into the code for the compiler:

The code distribution also incudes numerous PyUnit tests that demonstrate the components of the compiler and ensure that they work correctly. Check them out, and study them closely if you think they will help you understand the code.

If you are comfortable reading code, they will only scratch the surface of the things you might think about.

If you are a bit uncomfortable reading a program this large and spread out, don't worry. One of the goals of a project course is to grow into the skills and experience you'll need. On top of that, we will be learning a lot this semester about the data structures and algorithms we use to write compilers — starting Thursday!

The Assignment

Project Survey

Write answers to each of these questions related to your participation in the course project.

  1. Why are you taking this course? What do you hope to learn?

    Don't say merely "for my major". Be more specific, even if it's only "I have to take a Foundations course this semester, and this is the only one I can take."
  2. List 2 to 4 programming languages that you would be interested in using to write your compiler.

    You may give me a ranked list, numbered from most preferred to least preferred, or an unranked list. A ranked list gives me better information for assembling teams.
  3. List the names of 0 to 3 people in the class you would be interested in working with on the compiler project.

    Put an * next to the name of any person with whom you have already discussed working together.
  4. List the names of 0 to 3 people in the class you would rather not work with on the compiler project.

    This list may even include your friends. Sometimes, it's good to have a break from our friends when doing schoolwork. (And not all friends make good work partners.)

The Fizzbuzz Compiler

Write answers to each of these questions related to your the Fizzbuzz compiler.

  1. What kind of tokens can the compiler recognize in a program?
  2. Whitespace is insignificant in a Fizzbuzz program. Which line(s) of code in which files ignore it?
  3. Why doesn't the compiler ever send a message to the scanner?
  4. What kind of nodes can appear in an abstract syntax tree?
  5. Which line of code throws an error if there is an illegal statement in the program?
  6. What kinds of type errors does the compiler check for?
  7. Which function in the code generator produces the most code in a target program?
  8. What is the most confusing thing you saw in the code?

Deliverables

By the due time and date, use the course submission system to submit the following files electronically:

You may submit a plain text file or a PDF file.

No hard copy is required.