FP: Assignment 2 (Oct. 22)

Ken Wakita

13:20-15:50 at W831


Assignment

Published date
Oct. 22, 2018
Due date
To be placed on OCW-i
Method of Submission
Upload answer2.ml at the respective page of OCW-i.
Delayed Submission
Each submission is weighed according to half-value period of 10 days. That means if you submit a perfect answer 30 days after the due date, you will receive \(1/8\) the full points. In other words, you lose \(1 - 1/2^{1/10} \approx 6.7\text {%}\) points each day after the due date has passed. It is very wise to keep the due date.1

Problem

Complete the definition of unparse that takes an AST (abstract syntax tree as defined in syntax.ml) of the Min Caml compiler and generates its source program.

Obtaining the template file
Download a template answer2.ml and save it where you built min-caml.top. The template contains 25 test cases.
Examining the AST
Run min-caml.top and type in ast <a min-caml expression>, where <a min-caml expression> is the expression that you want to examine.
Testing your unparser

If you are (half-) finished with the assignment, run the code with ocaml answer2.ml

answer2.ml must stay at the directory where you built min-caml.top and you must run the ocaml answer2.ml command at this directory.

Use ocaml. Not min-caml.top. answer2.ml is written in OCaml.


Back to Top


  1. この半減期はトイチ金融よりも遥かに非情なので気をつけて下さい./ This half-value period is much worse than the interest rate of the meanest loan office; time is money.