open Syntax (* Defunctionalized interpreter : eval2 *) (* Value : プログラムの実行結果を表す型 *) type v = VNum of int | VFun of e * string * string list * v list | VCont of c * t and c = C0 | CApp0 of e * string list * v list * c | CApp1 of v * c | COp0 of e * string list * v list * op_t * c | COp1 of v * op_t * c | CAppend of c * c and t = TNil | Trail of c (* プログラムの実行結果を文字列にする関数 *) (* Value.to_string : Value.t -> string *) let rec to_string value = match value with VNum (n) -> string_of_int n | VFun (_) -> "" | VCont (_, _) -> "" (* プログラムの実行結果をプリントする関数 *) (* Value.print : Value.t -> unit *) let print exp = let str = to_string exp in print_string str