CS 421: Programming Languages and Compilers
Machine Problems for Fall 2012
Topic: Issued: Due at 11:59pm CT on: Automatic extension
(with 20% penalty)
until 11:59pm CT on:
MP1 OCaml: Basic OCaml Tuesday, Aug 28 Tuesday, Sep 4 Thursday, Sep 6
MP2 Pattern Matching and Recursion Tuesday, Sep 4 Tuesday, Sep 11 Thursday, Sep 13
MP3 Recursion Patterns, Higher-Order Functions Tuesday, Sep 11 Tuesday, Sep 18 Thursday, Sep 20
MP4 Continuation-Passing Style Tuesday, Sep 18 Tuesday, Sep 25 Thursday, Sep 27
MP5 Working with ADTs: Implementing CPS Thursday, Sep 27 Thursday, Oct 4 Saturday, Oct 6
MP6 A Unification-Based Type Inferencer Tuesday, Oct 7 Thursday, Oct 18 Saturday, Oct 20
MP7 Unification Algorithm Wednesday, Oct 17 Wednesday, Oct 24 Friday, Oct 26
MP8 A Lexer for MicroML Tuesday, Oct 23 Tuesday, Oct 30 Thursday, Nov 1
MP9 A Parser for MicroML Tuesday, Oct 30 Thursday, Nov 8 Saturday, Nov 10
MP10 An Evaluator for MicorML Friday, Nov 16 Thurdsday, Nov 29 Saturday, Dec 1
MP11 A Transition Semantics Evaluator for CPS Sunday, Dec 2 Sunday, Dec 9 Tuesday, Dec 11

Hand Written Assignments for Fall 2012
Topic: Issued: Due at 11:59pm CT on: Automatic extension
(with 20% penalty)
until 11:59pm CT on:
HW1 Evaluation and Evironments Saturday, Sep 1 Tuesday, Sep 11 Thursday, Sep 13
HW2 Evaluating the application of a function Tuesday, Sep 11 Tuesday, Sep 18 Thursday, Sep 20
HW3 Order of Evaluation Tuesday, Sep 18 Tuesday, Sep 25 Thursday, Sep 27
HW4 Algebraic Datatypes Tuesday, Sep 25 Tuesday, Oct 2 Thursday, Oct 4
HW5 Polymorphic Type Inference Tuesday, Oct 2 Tuesday, Oct 16 Thursday, Oct 18
HW6 Unification Tuesday, Oct 16 Tuesday, Oct 23 Thursday, Oct 23
HW7 Regular Expression Tuesday, Oct 23 Tuesday, Oct 30 Thursday, Nov 1
HW8 Parse Trees, Ambiguous Grammars, and LR and Recursive Descent Parsing Tuesday, Oct 30 Tuesday, Nov 6 Thursday, Nov 8
HW9 Operational and Transition Semantics Friday, Nov 16 Thurdsday, Nov 29 Saturday, Dec 1
HW10 Lambda Calculus Tuesday, Nov 27 Wednesday, Dec 5 Wednesday, Dec 7
HW11 Hoare Logic Tuesday, Dec 4 Monday, Dec 10 No Extension

Note: The late penaly is 20% of the total number of points possible on the base part of the assignment, plus 20% of the total points possible on the extra credit, if you attempt the extra credit. It is not 20% of the number of points your earn.

Guide for Doing MPs
A guide for how to attack an MP:
  1. Download mpXgrader.tar.gz and untar it (tar xzf mpXgrader.tar.gz where X is the number of the MP). This will create an mpXgrader directory. Go into that directory.
  2. Copy the mpX-skeleton.ml file as mpX.ml. To make sure you have all the necessary pieces, start by executing make. This will create the grader executable. Run the executable (./grader). Examine the failing test cases for places where errors produced by your code. At this point, everything should compile, but the score will be 0.
  3. Read and understand the problem for the handout that you wish to begin working on. (Usually, working from top to bottom makes most sense.) There is a tests file in this directory. This is an important file containing the an incomplete set of test cases; you'll want to add more cases to test your code more thoroughly. Reread the problem from the handout, examining any sample output given. Open the tests file in the mpXgrader directory. Find the test cases given for that problem. Add your own test cases by following the same pattern as of the existing test cases. Try to get a good coverage of your function's behaviour. You should even try to have enough cases to guarantee that you will catch any errors. (This is not always possible, but a desirable goal.) And yes, test cases should be written even before starting the implementation of your function. This is a good software development practice.
  4. If necessary, reread the statement of the problem once more. Place your code for the solution in mpX.ml, replacing the stub found there for it. Implement your function. Try to do this in a step-wise fashion. When you think you have a solution (or enough of a part of one to compile and be worth testing), save you work and execute make and the ./grader again. Examine the passing and failing test cases again. Each failure is an instance where your code failed to give the right output for the given input, and you will need to examine your code to figure out why. When you are finished making a round of corrections, run make, followed by ./grader again. Continue until you find no more errors.
  5. When your code no longer generates any errors for the problem on which you were working, return to steps 3) and 4) to proceed with the next problem you wish to solve, until there are no more problems to be solved.
  6. When you have finished all problems (or given up and left the problem with the version given in the skeleton file), you will need to copy your solution file to an EWS Linux machine, if it is not already there. Once it is on an EWS Linux machine, you need to run the handin program on it. Please refer to the FAQ handin instructions for details.
Interactive Debugging
In addition to running "make" and "grader", you probably want to test your code interactively at the top level:
  1. Enter the directory with your source file.
  2. Type ocaml at the command line.
  3. Type #load "mpXcommon.cmo";; at the OCaml prompt, where X is the number of the assignment (this loads in the common stuff that we give you in compiled form by default).
  4. Type #use "mpX.ml";; at the OCaml prompt, where X is the number of the assignment. This loads in your code, and adds the functions you have defined to the identifiers recognized at top level.
  5. Type in commands followed by ';;' at the OCaml prompt to test your code interactively. Anything that you can do in a code file, you can do interactively. For example, you can define identifiers using 'let x = ...', etc...
  6. With each MP, you will be given a solution in compiled form. You may interactively test the solution to a problem, after having loaded "mpXcommon.cmo", by loading the solution file by typing #load "solution.cmo";;. After that, if you are supposed to write a function called, say splat, and wish to fine out what it does on an input, say 39.2, you make execute the solution's version of splat by typing Solution.splat 39.2;;. Notice the capitalization.