|
|
|
|
@@ -58,119 +58,119 @@ and cek_value s =
|
|
|
|
|
|
|
|
|
|
(* make-if-frame *)
|
|
|
|
|
and make_if_frame then_expr else_expr env =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "if"); Hashtbl.replace _d "then" then_expr; Hashtbl.replace _d "else" else_expr; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "if"; cf_env = env; cf_name = else_expr; cf_body = then_expr; cf_remaining = Nil; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-when-frame *)
|
|
|
|
|
and make_when_frame body_exprs env =
|
|
|
|
|
(let _d = Hashtbl.create 3 in Hashtbl.replace _d "type" (String "when"); Hashtbl.replace _d "body" body_exprs; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "when"; cf_env = env; cf_name = Nil; cf_body = body_exprs; cf_remaining = Nil; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-begin-frame *)
|
|
|
|
|
and make_begin_frame remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 3 in Hashtbl.replace _d "type" (String "begin"); Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "begin"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-let-frame *)
|
|
|
|
|
and make_let_frame name remaining body local =
|
|
|
|
|
(let _d = Hashtbl.create 5 in Hashtbl.replace _d "type" (String "let"); Hashtbl.replace _d "name" name; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "body" body; Hashtbl.replace _d "env" local; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "let"; cf_env = local; cf_name = name; cf_body = body; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-define-frame *)
|
|
|
|
|
and make_define_frame name env has_effects effect_list =
|
|
|
|
|
(let _d = Hashtbl.create 5 in Hashtbl.replace _d "type" (String "define"); Hashtbl.replace _d "name" name; Hashtbl.replace _d "env" env; Hashtbl.replace _d "has-effects" has_effects; Hashtbl.replace _d "effect-list" effect_list; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "define"; cf_env = env; cf_name = name; cf_body = Nil; cf_remaining = Nil; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = has_effects; cf_extra2 = effect_list })
|
|
|
|
|
|
|
|
|
|
(* make-set-frame *)
|
|
|
|
|
and make_set_frame name env =
|
|
|
|
|
(let _d = Hashtbl.create 3 in Hashtbl.replace _d "type" (String "set"); Hashtbl.replace _d "name" name; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "set"; cf_env = env; cf_name = name; cf_body = Nil; cf_remaining = Nil; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-arg-frame *)
|
|
|
|
|
and make_arg_frame f evaled remaining env raw_args head_name =
|
|
|
|
|
(let _d = Hashtbl.create 7 in Hashtbl.replace _d "type" (String "arg"); Hashtbl.replace _d "f" f; Hashtbl.replace _d "evaled" evaled; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Hashtbl.replace _d "raw-args" raw_args; Hashtbl.replace _d "head-name" (let _or = head_name in if sx_truthy _or then _or else Nil); Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "arg"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = f; cf_args = evaled; cf_results = raw_args; cf_extra = (let _or = head_name in if sx_truthy _or then _or else Nil); cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-call-frame *)
|
|
|
|
|
and make_call_frame f args env =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "call"); Hashtbl.replace _d "f" f; Hashtbl.replace _d "args" args; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "call"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = Nil; cf_f = f; cf_args = args; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-cond-frame *)
|
|
|
|
|
and make_cond_frame remaining env scheme_p =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "cond"); Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Hashtbl.replace _d "scheme" scheme_p; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "cond"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = scheme_p; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-case-frame *)
|
|
|
|
|
and make_case_frame match_val remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "case"); Hashtbl.replace _d "match-val" match_val; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "case"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = match_val; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-thread-frame *)
|
|
|
|
|
and make_thread_frame remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 3 in Hashtbl.replace _d "type" (String "thread"); Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "thread"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-map-frame *)
|
|
|
|
|
and make_map_frame f remaining results env =
|
|
|
|
|
(let _d = Hashtbl.create 6 in Hashtbl.replace _d "type" (String "map"); Hashtbl.replace _d "f" f; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "results" results; Hashtbl.replace _d "env" env; Hashtbl.replace _d "indexed" (Bool false); Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "map"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = f; cf_args = Nil; cf_results = results; cf_extra = (Bool false); cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-map-indexed-frame *)
|
|
|
|
|
and make_map_indexed_frame f remaining results env =
|
|
|
|
|
(let _d = Hashtbl.create 6 in Hashtbl.replace _d "type" (String "map"); Hashtbl.replace _d "f" f; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "results" results; Hashtbl.replace _d "env" env; Hashtbl.replace _d "indexed" (Bool true); Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "map"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = f; cf_args = Nil; cf_results = results; cf_extra = (Bool true); cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-filter-frame *)
|
|
|
|
|
and make_filter_frame f remaining results current_item env =
|
|
|
|
|
(let _d = Hashtbl.create 6 in Hashtbl.replace _d "type" (String "filter"); Hashtbl.replace _d "f" f; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "results" results; Hashtbl.replace _d "current-item" current_item; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "filter"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = f; cf_args = Nil; cf_results = results; cf_extra = current_item; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-reduce-frame *)
|
|
|
|
|
and make_reduce_frame f remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "reduce"); Hashtbl.replace _d "f" f; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "reduce"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = f; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-for-each-frame *)
|
|
|
|
|
and make_for_each_frame f remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "for-each"); Hashtbl.replace _d "f" f; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "for-each"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = f; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-some-frame *)
|
|
|
|
|
and make_some_frame f remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "some"); Hashtbl.replace _d "f" f; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "some"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = f; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-every-frame *)
|
|
|
|
|
and make_every_frame f remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "every"); Hashtbl.replace _d "f" f; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "every"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = f; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-scope-frame *)
|
|
|
|
|
and make_scope_frame name remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "scope"); Hashtbl.replace _d "name" name; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "scope"; cf_env = env; cf_name = name; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-provide-frame *)
|
|
|
|
|
and make_provide_frame name value remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 5 in Hashtbl.replace _d "type" (String "provide"); Hashtbl.replace _d "name" name; Hashtbl.replace _d "value" value; Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "provide"; cf_env = env; cf_name = name; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = value; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-scope-acc-frame *)
|
|
|
|
|
and make_scope_acc_frame name value remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 6 in Hashtbl.replace _d "type" (String "scope-acc"); Hashtbl.replace _d "name" name; Hashtbl.replace _d "value" (let _or = value in if sx_truthy _or then _or else Nil); Hashtbl.replace _d "emitted" (List []); Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "scope-acc"; cf_env = env; cf_name = name; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = (let _or = value in if sx_truthy _or then _or else Nil); cf_extra2 = (List []) })
|
|
|
|
|
|
|
|
|
|
(* make-reset-frame *)
|
|
|
|
|
and make_reset_frame env =
|
|
|
|
|
(let _d = Hashtbl.create 2 in Hashtbl.replace _d "type" (String "reset"); Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "reset"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = Nil; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-dict-frame *)
|
|
|
|
|
and make_dict_frame remaining results env =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "dict"); Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "results" results; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "dict"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = results; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-and-frame *)
|
|
|
|
|
and make_and_frame remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 3 in Hashtbl.replace _d "type" (String "and"); Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "and"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-or-frame *)
|
|
|
|
|
and make_or_frame remaining env =
|
|
|
|
|
(let _d = Hashtbl.create 3 in Hashtbl.replace _d "type" (String "or"); Hashtbl.replace _d "remaining" remaining; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "or"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-dynamic-wind-frame *)
|
|
|
|
|
and make_dynamic_wind_frame phase body_thunk after_thunk env =
|
|
|
|
|
(let _d = Hashtbl.create 5 in Hashtbl.replace _d "type" (String "dynamic-wind"); Hashtbl.replace _d "phase" phase; Hashtbl.replace _d "body-thunk" body_thunk; Hashtbl.replace _d "after-thunk" after_thunk; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "dynamic-wind"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = Nil; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = phase; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-reactive-reset-frame *)
|
|
|
|
|
and make_reactive_reset_frame env update_fn first_render_p =
|
|
|
|
|
(let _d = Hashtbl.create 4 in Hashtbl.replace _d "type" (String "reactive-reset"); Hashtbl.replace _d "env" env; Hashtbl.replace _d "update-fn" update_fn; Hashtbl.replace _d "first-render" first_render_p; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "reactive-reset"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = Nil; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = update_fn; cf_extra2 = first_render_p })
|
|
|
|
|
|
|
|
|
|
(* make-deref-frame *)
|
|
|
|
|
and make_deref_frame env =
|
|
|
|
|
(let _d = Hashtbl.create 2 in Hashtbl.replace _d "type" (String "deref"); Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "deref"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = Nil; cf_f = Nil; cf_args = Nil; cf_results = Nil; cf_extra = Nil; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* make-ho-setup-frame *)
|
|
|
|
|
and make_ho_setup_frame ho_type remaining_args evaled_args env =
|
|
|
|
|
(let _d = Hashtbl.create 5 in Hashtbl.replace _d "type" (String "ho-setup"); Hashtbl.replace _d "ho-type" ho_type; Hashtbl.replace _d "remaining" remaining_args; Hashtbl.replace _d "evaled" evaled_args; Hashtbl.replace _d "env" env; Dict _d)
|
|
|
|
|
(CekFrame { cf_type = "ho-setup"; cf_env = env; cf_name = Nil; cf_body = Nil; cf_remaining = remaining_args; cf_f = Nil; cf_args = evaled_args; cf_results = Nil; cf_extra = ho_type; cf_extra2 = Nil })
|
|
|
|
|
|
|
|
|
|
(* frame-type *)
|
|
|
|
|
and frame_type f =
|
|
|
|
|
|