eval
(* 型の宣言 *)type t = Num of int
| Plus of t * t
type v = VNum of int
(* 値を文字列に変換する関数 *)
let v_to_string v = match v with
VNum (n) -> string_of_int n
(* インタープリタ *)
let rec eval t e = match t with
Num (n) -> VNum (n)
| Plus (t0, t1) -> (let v1 = eval t1 e
in let v0 = eval t0 e
in (match (v1, v0) with (VNum (n1), VNum (n0))
-> VNum (n1 + n0)))
let f t = eval t []