## symbol.pkg
# Compiled by:
#
src/lib/compiler/back/low/tools/line-number-database.lib### "If names are not correct, language will not
### be in accordance with the truth of things."
###
### -- Confucius (c 551 - 478 BCE)
package unique_symbol
: Unique_Symbol # Unique_Symbol is from
src/lib/compiler/back/low/tools/line-number-db/symbol.api{
package h= hashtable; # hashtable is from
src/lib/src/hashtable.pkg Symbol = SYMBOL (Ref( String ), Unt);
fun equal (SYMBOL (a, _), SYMBOL (b, _)) = a == b;
fun compare (SYMBOL (a, _), SYMBOL (b, _)) = string::compare (*a, *b);
fun hash (SYMBOL(_, w)) = w;
fun to_string (SYMBOL (s, _)) = *s;
exception NOT_THERE;
fun hash_it (SYMBOL (REF s, _))
=
hash_string::hash_string s;
fun eq (SYMBOL (REF x, a), SYMBOL (REF y, b))
=
a == b and x == y;
table = h::make_hashtable (hash_it, eq) { size_hint => 117, not_found_exception => NOT_THERE }
: h::Hashtable (Symbol, Symbol);
look_up = h::look_up table;
insert = h::set table;
fun from_string name
=
{ symbol = SYMBOL (REF name, hash_string::hash_string name);
#
look_up symbol
except
_ = { insert (symbol, symbol);
symbol;
};
};
};