open Syntax (* Interpreter with linear instructions : eval11 *) (* Value : プログラムの実行結果を表す型 *) type v = VNum of int | VFun of c * v list | VCont of c * s * 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 = CNil | CCons of i * c | CAppend of c * c and s = SNil | SCons of v * s | SAppend of s * s and t = TNil | Trail of c * s type m = (c * s * 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