## fast-symbol.pkg
## (C) 2001 Lucent Technologies, Bell Labs
# Compiled by:
#
src/lib/compiler/front/basics/basics.sublibpackage fast_symbol {
stipulate
include package symbol; # symbol is from
src/lib/compiler/front/basics/map/symbol.pkg hash = hash_string::hash_string;
herein
Symbol = Symbol;
# Another version of symbols but hash numbers
# have no increments according to their namespace
Raw_Symbol
=
RAWSYM (Unt, String);
fun raw_symbol hash_and_name # Build a raw symbol from a (hashcode, name) pair
=
RAWSYM hash_and_name;
fun make_raw_symbol name
=
RAWSYM ( hash name, name );
# Build a symbol from a raw symbol
# belonging to the same space as
# a reference symbol:
#
fun same_space_symbol (SYMBOL (i, s)) (RAWSYM (i', s'))
=
SYMBOL (i' + (i - hash s), s');
# Build symbols in the various name spaces from raw symbols
fun make_value_symbol (RAWSYM (hash, name)) = SYMBOL (hash + value_namespace_tag, name);
fun make_type_symbol (RAWSYM (hash, name)) = SYMBOL (hash + type_namespace_tag, name);
fun make_fixity_symbol (RAWSYM (hash, name)) = SYMBOL (hash + fixity_namespace_tag, name);
fun make_label_symbol (RAWSYM (hash, name)) = SYMBOL (hash + label_namespace_tag, name);
fun make_typevar_symbol (RAWSYM (hash, name)) = SYMBOL (hash + typevar_namespace_tag, name);
fun make_api_symbol (RAWSYM (hash, name)) = SYMBOL (hash + api_namespace_tag, name);
fun make_package_symbol (RAWSYM (hash, name)) = SYMBOL (hash + package_namespace_tag, name);
fun make_generic_symbol (RAWSYM (hash, name)) = SYMBOL (hash + generic_namespace_tag, name);
fun make_generic_api_symbol (RAWSYM (hash, name)) = SYMBOL (hash + generic_api_namespace_tag, name);
fun make_value_and_fixity_symbols (RAWSYM (hash, name))
=
( SYMBOL (hash + value_namespace_tag, name),
SYMBOL (hash + fixity_namespace_tag, name)
);
fun make_value_symbol' name = SYMBOL (hash name + value_namespace_tag, name);
fun make_type_symbol' name = SYMBOL (hash name + type_namespace_tag, name);
fun make_fixity_symbol' name = SYMBOL (hash name + fixity_namespace_tag, name);
fun make_label_symbol' name = SYMBOL (hash name + label_namespace_tag, name);
fun make_typevar_symbol' name = SYMBOL (hash name + typevar_namespace_tag, name);
fun make_api_symbol' name = SYMBOL (hash name + api_namespace_tag, name);
fun make_package_symbol' name = SYMBOL (hash name + package_namespace_tag, name);
fun make_generic_symbol' name = SYMBOL (hash name + generic_namespace_tag, name);
fun make_generic_api_symbol' name = SYMBOL (hash name + generic_api_namespace_tag, name);
end;
};