PreviousUpNext

15.4.621  src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack-entry.pkg

## symbolmapstack-entry.pkg

# Compiled by:
#     src/lib/compiler/front/typer-stuff/typecheckdata.sublib



# Here we define the eight types of values which
# may be entered into our compiler symbol tables
# -- one for each logical namespace.
#
# For more information, see the OVERVIEW section in
#
#     src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg


stipulate
    package sy  =  symbol;                                                                      # symbol                        is from   src/lib/compiler/front/basics/map/symbol.pkg
    package tdt =  type_declaration_types;                                                      # type_declaration_types        is from   src/lib/compiler/front/typer-stuff/types/type-declaration-types.pkg
    package vac =  variables_and_constructors;                                                  # variables_and_constructors    is from   src/lib/compiler/front/typer-stuff/deep-syntax/variables-and-constructors.pkg
    package mld =  module_level_declarations;                                                   # module_level_declarations     is from   src/lib/compiler/front/typer-stuff/modules/module-level-declarations.pkg
    package fix =  fixity;                                                                      # fixity                        is from   src/lib/compiler/front/basics/map/fixity.pkg
    package err =  error_message;                                                               # error_message                 is from   src/lib/compiler/front/basics/errormsg/error-message.pkg
herein


    package   symbolmapstack_entry
    : (weak)  Symbolmapstack_Entry                                                                      # Symbolmapstack_Entry          is from   src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack-entry.api
    {
        fun err s
            =
            err::impossible ("Namings: " + s);

        Symbolmapstack_Entry
          #
          = NAMED_VARIABLE     vac::Variable
          #
          | NAMED_CONSTRUCTOR  tdt::Valcon
          | NAMED_TYPE         tdt::Type
          #
          | NAMED_API          mld::Api
          | NAMED_PACKAGE      mld::Package
          | NAMED_GENERIC_API  mld::Generic_Api
          | NAMED_GENERIC      mld::Generic
          #
          | NAMED_FIXITY       fix::Fixity
          ;



        #  'greater_than' is used for symbol table sorting in symbolmapstack.pkg
        #
        fun greater_than
              (
                (symbol_1, symbolmapstack_entry_1),
                (symbol_2, symbolmapstack_entry_2)
              )
            =
            case (int::compare ( namespace symbolmapstack_entry_1,
                                 namespace symbolmapstack_entry_2
                 )             )
                #
                EQUAL   =>  sy::symbol_gt (symbol_1, symbol_2);
                GREATER =>  TRUE;
                LESS    =>  FALSE;
            esac
            where
                # I hope the following gets optimized
                # into an identity function on tags:            XXX QUERO FIXME -- check that it does.
                #
                fun namespace (NAMED_VARIABLE     _) => 0;
                    namespace (NAMED_CONSTRUCTOR  _) => 1;
                    namespace (NAMED_TYPE         _) => 2;
                    namespace (NAMED_API          _) => 3;
                    namespace (NAMED_PACKAGE      _) => 4;
                    namespace (NAMED_GENERIC_API  _) => 5;
                    namespace (NAMED_GENERIC      _) => 6;
                    namespace (NAMED_FIXITY       _) => 7;
                end;
            end;
    };                                                                                  # package symbolmapstack_entry 
end;                                                                                    # stipulate



Comments and suggestions to: bugs@mythryl.org

PreviousUpNext