From 83ed1022f9fb4e2042d048d6576898d5d4bef26b Mon Sep 17 00:00:00 2001 From: Son Ho Date: Wed, 8 Dec 2021 16:00:06 +0100 Subject: Generate iterators for Contexts.env --- src/Contexts.ml | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/Contexts.ml b/src/Contexts.ml index 2d09cb25..cc28dd27 100644 --- a/src/Contexts.ml +++ b/src/Contexts.ml @@ -13,10 +13,45 @@ type binder = { (** Environment value: mapping from variable to value, abstraction (only used in symbolic mode) or stack frame delimiter. *) -type env_elem = Var of binder * typed_value | Abs of abs | Frame -[@@deriving show] - -type env = env_elem list [@@deriving show] +type env_elem = Var of (binder[@opaque]) * typed_value | Abs of abs | Frame +[@@deriving + show, + visitors + { + name = "iter_env_elem"; + variety = "iter"; + ancestors = [ "iter_abs" ]; + nude = true (* Don't inherit [VisitorsRuntime.iter] *); + concrete = true; + }, + visitors + { + name = "map_env_elem"; + variety = "map"; + ancestors = [ "map_abs" ]; + nude = true (* Don't inherit [VisitorsRuntime.iter] *); + concrete = true; + }] + +type env = env_elem list +[@@deriving + show, + visitors + { + name = "iter_env"; + variety = "iter"; + ancestors = [ "iter_env_elem" ]; + nude = true (* Don't inherit [VisitorsRuntime.iter] *); + concrete = true; + }, + visitors + { + name = "map_env"; + variety = "map"; + ancestors = [ "map_env_elem" ]; + nude = true (* Don't inherit [VisitorsRuntime.iter] *); + concrete = true; + }] type interpreter_mode = ConcreteMode | SymbolicMode [@@deriving show] -- cgit v1.2.3