Revision c2307351f20b1ed3d8532d0db1ec9ece6c6fb8b8 authored by Maika Fujii on 24 June 2021, 05:54:25 UTC, committed by GitHub on 24 June 2021, 05:54:25 UTC
1 parent 583c7de
Raw File
value.ml
open Syntax

(* Interpreter with linearized trails : eval11 *)

(* Value *)
type v = VNum of int
       | VFun of c * v list
       | VContS of t
       | VContC of t
       | VEnv of v list
       | VK of c

and i = INum of int | IAccess of int
      | IPush_closure of c | IReturn
      | IPush_env | IPop_env | IOp of op | ICall
      | IShift of c | IControl of c
      | IShift0 of c | IControl0 of c
      | IReset of c

and c = i list

and s = v list

and t = (c * s) list

and m = t list


(* to_string : v -> string *)
let rec to_string value = match value with
    VNum (n) -> string_of_int n
  | VFun (_) -> "<VFun>"
  | VContS (_) -> "<VContS>"
  | VContC (_) -> "<VContC>"
  | VEnv (_) -> "<VEnv>"
  | VK (_) -> "<VK>"

(* Value.print : v -> unit *)
let print exp =
  let str = to_string exp in
  print_string str
back to top