Legend:
Library
Module
Module type
Parameter
Class
Class type
Prefix Tree
This module provides a trie data structure where a sequence of instructions is used as a key (and an individual instruction as a token). Two implementations are provided, a regular, where insns are compared as-is, and normalized, where instructions are compared using normalized comparison.
In normalized comparison concerete immediate values are ignored, and if instructions have different number of operands, then only then excess operands are excluded from the comparison.
add trie ~key ~data adds data associated with key, if trie already has some data associated with the key, then it will be overwritten
val change : 'at->key->('a option->'a option)-> unit
change trie key f if trie has data associated with key then f will be called with Some data, otherwise it will be called with None. If f returns None then there will be no data associated with key, if f returns Some thing, then thing will be bound to key
val walk : 'at->key->init:'b->f:('b->'a option->'b)->'b
walk trie key ~init ~f walks down the tree starting from the root and ending with the last token of the key. Function f is fold over values associated with all substrings of the key, starting from a zero substring.
longest_match trie k find the value associated with a longest substring of a key k. Returns a pair - a length of matched key and data, associated with that key.