13:20-15:50 at W831
answer2.ml
at the respective page of OCW-i.
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.
The AST is ast
(\(P\))
Correctness of unparsing:
For any Min Caml program \(P\): ast
(\(P\)) = ast
(unparse
(ast
(\(P\))))
In other words, for an AST \(t\) = ast
(\(P\)), ast
(unparse
(\(t\))) = \(t\).
It is desirable for unparse
to generate properly indented programs that look nice to human eyes. An answer that gives a beautifully indented out will get extra bonus points. The amount of bonus is written in the top page.
answer2.ml
and save it where you built min-caml.top
. The template contains 25 test cases.
min-caml.top
and type in ast <a min-caml expression>
, where <a min-caml expression>
is the expression that you want to examine.
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
この半減期はトイチ金融よりも遥かに非情なので気をつけて下さい./ This half-value period is much worse than the interest rate of the meanest loan office; time is money.↩