BTree implementation with few features, but good enough for the Nim compiler's needs.
BTree[Key; Val] = object root: Node[Key, Val] entries: int ## number of key-value pairs
proc add[Key, Val](b: var BTree[Key, Val]; key: Key; val: Val)
proc contains[Key, Val](b: BTree[Key, Val]; key: Key): bool
proc getOrDefault[Key, Val](b: BTree[Key, Val]; key: Key): Val
proc hasNext[Key, Val](b: BTree[Key, Val]; index: int): bool
proc initBTree[Key, Val](): BTree[Key, Val]
proc len[Key, Val](b: BTree[Key, Val]): int {.inline.}
proc next[Key, Val](b: BTree[Key, Val]; index: int): (Key, Val, int)
iterator pairs[Key, Val](b: BTree[Key, Val]): (Key, Val)