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 associates data with key. If trie already has some value associated with key, then the value will be overwritten (rebound)
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 associated with 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 key find a value associated with a longest substring of key. Returns a pair - a length of matched key and the value, associated with that key.