1signature Database= 2sig 3 4(* Database *) 5 6datatype component = 7 Str (* structure *) 8 | Exc of string (* exception constructor with name *) 9 | Typ of string (* type constructor with name *) 10 | Val of string (* value with name *) 11 | Con of string (* value constructor with name *) 12 | Term of string * string option (* term and optional kind *) 13 14(* An entry consist of a component and the name of its structure: *) 15 16type entry = { comp : component, file : string, line : int } 17 18(* Table represented by ordered binary tree: *) 19 20datatype 'contents table = 21 Empty 22 | Node of string * 'contents * 'contents table * 'contents table 23 24(* The database is a table of sorted lists of entries: *) 25 26type database = entry list table 27 28val writebase : string * database -> unit 29val readbase : string -> database 30 31val keycompare : string * string -> order 32val lookup : database * string -> entry list 33 34(* Extract the name from an entry: *) 35 36val getname : entry -> string 37 38end (* sig *)