ExecMap as a data structure is becoming somewhat of a burden.
This should be restructured to
Not be recursive; use a map of IDs to nodes instead
Be more consistent; the Cmd, BranchCmd, FinalCmd variants aren't necessary (at least at the top level of nodes)
An idea of a new structure could be:
(* An id of None means it hasn't been executed yet *)
type 'case 'data exec_map_next =
| Single of id option * 'data
| Branch of ('case * id option * 'data)
(* Should this be mutable? *)
type 'data 'case 'next exec_map_node = {
data : 'data;
next : 'next; (* e.g. exec_map_next option, where None means a final command *)
}
type 'node exec_map_entry =
| Node of 'node
| Alias of id
type 'node exec_map = {
root : 'node;
map : (id, 'node exec_map_entry) HashMap.t;
}
Given how much polymorphism is being juggled here, I'm thinking this should be a module type instantiated by each lifter.
ExecMap as a data structure is becoming somewhat of a burden.
This should be restructured to
Cmd
,BranchCmd
,FinalCmd
variants aren't necessary (at least at the top level of nodes)An idea of a new structure could be:
Given how much polymorphism is being juggled here, I'm thinking this should be a module type instantiated by each lifter.