Module cluster_folding

Implements the functionality to traverse the clusters frontiers in roughly breadth first order.

Copyright © (C) 2015, Pablo Lamela, Simon Thompson

Authors: Pablo Lamela Seijas (P.Lamela-Seijas@kent.ac.uk), Simon Thompson (S.J.Thompson@kent.ac.uk).

Description

Implements the functionality to traverse the clusters frontiers in roughly breadth first order.

Data Types

acc()

acc() = #acc{cluster_labels = da_map:da_map({comm | {ex, 1 | 2}, string()}, cluster:cluster(tree:tree_node())), exp_funs = sets:set({atom(), integer()})}

Record for use as accumulator when folding through cluster borders. Contains the following fields:

cluster_counters()

cluster_counters() = #cluster_counters{}

Record that keeps counters used for naming functions and ordering them in the files. Contains the following fields:

cluster_dicts()

cluster_dicts() = #cluster_dicts{comm_clus = cluster_dict:cluster_dict(tree:tree_node()), ex_clus1 = cluster_dict:cluster_dict(tree:tree_node()), ex_clus2 = cluster_dict:cluster_dict(tree:tree_node())}

Record for keeping the updated cluster dictionaries. Contains the following fields:

cluster_info()

cluster_info() = #cluster_info{}

Record for keeping information about a particular cluster. Contains the following fields:

environment_info()

environment_info() = #environment_info{}

Record that contains environment information like the free and bound variables at the root of a cluster. Contains the following fields:

tree_info()

tree_info() = #tree_info{tree1 = tree:tree(), tree2 = tree:tree(), tree1_args = dict:dict({FunName::string(), Arity::non_neg_integer()}, [ArgName::string()]), tree2_args = dict:dict({FunName::string(), Arity::non_neg_integer()}, [ArgName::string()]), mapping = da_map:da_map(tree:tree_node(), tree:tree_node())}

Record for keeping the tree and mapping information. Contains the following fields:

Function Index

find_actual_exported_vars_for_asym_label/3 Gets the exported variables for the top node of the cluster linked to AsymLabel, considering only the tree specified by Pos.
find_actual_free_vars_for_asym_label/3 Gets the free variables for the top node of the cluster linked to AsymLabel, considering only the tree specified by Pos.
find_exported_vars_for_sym_label/3 Gets the exported variables for the top nodes of the clusters linked to the Name, with type SymType.
find_free_vars_for_sym_label/3 Gets the free variables for the top nodes of the clusters linked to the Name, with type SymType.
fold_clusters/4 Folds a function through the frontiers of the clusters in roughly breadth first order.
get_children_from_node_list/5 Gets all the children for a list of nodes and maps them to the placeholders on the nodes, (their left alternative if common).
get_frontier_children_from_node_list/5 Gets all the children for a list of nodes and maps them to the placeholders on the nodes, (their left alternative if common).
get_leaf_as_is_or_default/3 Obtains information about whether the cluster is a leaf or not.
get_type_list/2 Returns a list with the correspondence of types, clusters, and trees.
is_in_scope/4 Returns true if the function specified (Name and Arity) is in both of sets of inscope functions (Inscope1 and Inscope2), or false if it is in none.
isolate_type_class/1 Returns the symmetric cluster type.
merge_environments/2 Merges the list of free vars of two nodes.

Function Details

find_actual_exported_vars_for_asym_label/3

find_actual_exported_vars_for_asym_label(AsymLabel::{ClustType, string()}, Pos::1 | 2, Acc::cluster_folding:acc()) -> [string()]

Gets the exported variables for the top node of the cluster linked to AsymLabel, considering only the tree specified by Pos. It first tries to get them from Acc, otherwise it infers it from the node itself.

find_actual_free_vars_for_asym_label/3

find_actual_free_vars_for_asym_label(AsymLabel::{ClustType, string()}, Pos::1 | 2, Acc::cluster_folding:acc()) -> [string()]

Gets the free variables for the top node of the cluster linked to AsymLabel, considering only the tree specified by Pos. It first tries to get them from Acc, otherwise it infers it from the node itself.

find_exported_vars_for_sym_label/3

find_exported_vars_for_sym_label(SymType::comm | ex, Name::string(), Name::cluster_folding:acc()) -> [string()]

Gets the exported variables for the top nodes of the clusters linked to the Name, with type SymType. It first tires to get them from Acc, otherwise it infers it from the nodes themselves.

find_free_vars_for_sym_label/3

find_free_vars_for_sym_label(SymType::comm | ex, Name::string(), Name::cluster_folding:acc()) -> [string()]

Gets the free variables for the top nodes of the clusters linked to the Name, with type SymType. It first tires to get them from Acc, otherwise it infers it from the nodes themselves.

fold_clusters/4

fold_clusters(Fun, AccIn::Acc, ClustInfo, TreeInfo) -> AccOut::Acc

Folds a function through the frontiers of the clusters in roughly breadth first order. The arguments of the function are:

get_children_from_node_list/5

get_children_from_node_list(ClustType, Cluster, Tree, TreeInfo, Nodes::[Node]) -> [{PH, Children}]

Gets all the children for a list of nodes and maps them to the placeholders on the nodes, (their left alternative if common).

get_frontier_children_from_node_list/5

get_frontier_children_from_node_list(ClustType, Cluster, Tree, TreeInfo, Nodes::[Node]) -> [{PH, Children}]

Gets all the children for a list of nodes and maps them to the placeholders on the nodes, (their left alternative if common). It only gets the children that are in a different cluster, not the ones that are in the same.

get_leaf_as_is_or_default/3

get_leaf_as_is_or_default(AsymLabel::{ClustType, string()}, Pos::1 | 2, Acc::cluster_folding:acc()) -> boolean()

Obtains information about whether the cluster is a leaf or not. If the information is no there it defaults to false.

get_type_list/2

get_type_list(ClustInfo::cluster_dicts(), TreeInfo::tree_info()) -> [{ClustType, ClusterDict, Tree | na}]

Returns a list with the correspondence of types, clusters, and trees. This can be used to find in which cluster and in which tree a node is.

is_in_scope/4

is_in_scope(Name, Arity, Inscope1::sets:set({Name, Arity}), Inscope2::sets:set({Name, Arity})) -> boolean()

Returns true if the function specified (Name and Arity) is in both of sets of inscope functions (Inscope1 and Inscope2), or false if it is in none. This implementation does not contemplate that it may be in scope for one and not inscope for another, since that would cause wrong behaviour in the common module.

isolate_type_class/1

isolate_type_class(ClustType) -> SymmetricType

Returns the symmetric cluster type. That is, removes the information about which exclusive cluster it is.

merge_environments/2

merge_environments(Env1::[string()], Env2::[string()]) -> [string()]

Merges the list of free vars of two nodes. It removes the repeated ones.


Generated by EDoc, Nov 5 2015, 16:30:19.