open Syntax (* Interpreter with linear trail : eval12 *) (* Value : プログラムの実行結果を表す型 *) type v = VNum of int | VFun of c * v list | VCont of t | VEnv of v list | VK of c and i = INum of v | IAccess of int | IPush_closure of c | IReturn | IPush_env | IPop_env | IOperations of op_t | ICall | IControl of c | IPrompt of c and c = i list and s = v list and t = (c * s) list type m = t list (* プログラムの実行結果を文字列にする関数 *) (* Value.to_string : Value.t -> string *) let rec to_string value = match value with VNum (n) -> string_of_int n | VFun (_) -> "" | VCont (_) -> "" | VEnv (_) -> "" | VK (_) -> "" (* プログラムの実行結果をプリントする関数 *) (* Value.print : Value.t -> unit *) let print exp = let str = to_string exp in print_string str