PreviousUpNext

15.3.253  src/lib/compiler/front/typer-stuff/deep-syntax/variables-and-constructors.api

## variables-and-constructors.api
## (C) 2001 Lucent Technologies, Bell Labs

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



# Datastructures describing variable and
# enum constructor declarations.
#
# In particular, the datatypes
#
#     Variable
#     Constructor
#
# provide the value types bound by the symbol table
# for those two namespaces -- see OVERVIEW section in
#
#     src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg


stipulate
    package id  =  inlining_data;                               # inlining_data         is from   src/lib/compiler/front/typer-stuff/basics/inlining-data.pkg
    package sy  =  symbol;                                      # symbol                is from   src/lib/compiler/front/basics/map/symbol.pkg
    package syp =  symbol_path;                                 # symbol_path           is from   src/lib/compiler/front/typer-stuff/basics/symbol-path.pkg
    package ty  =  types;                                       # types                 is from   src/lib/compiler/front/typer-stuff/types/types.pkg
    package vh  =  varhome;                                     # varhome               is from   src/lib/compiler/front/typer-stuff/basics/varhome.pkg
herein

    api Variables_And_Constructors {

        Variable
            # This records per-variable information
            # in deep syntax trees:  src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.api
            # It appears in:
            #     VARIABLE_IN_EXPRESSION
            #     VARIABLE_IN_PATTERN
            #     OVERLOAD_DECLARATIONS
            #     NAMED_RECURSIVE_VALUES
            # 'var_type' is a ref because we frequently
            # update it in place when computing and
            # generalizing pattern types:  See
            #     src/lib/compiler/front/typer/types/unify-and-generalize-types-g.pkg
            #
            = ORDINARY_VARIABLE
                {
                  path:                 syp::Symbol_Path,
                  var_type:             Ref( ty::Type ),
                  varhome:              vh::Varhome,                    # 
                  inlining_data:        id::Inlining_Data
                }

            | OVERLOADED_IDENTIFIER
                {
                  name:         sy::Symbol,
                  type_scheme:  ty::Type_Scheme,
                  alternatives: Ref( List  { indicator: ty::Type,
                                             variant:   Variable
                                           }
                                   )
                }
            | ERRORVAR
            ;


#       Constructor
#           =
#           ty::Valcon;


        Variable_Or_Constructor
          #
          = VARIABLE Variable
          | CONSTRUCTOR  ty::Valcon                                             # "VALCON" == "VALUE_CONSTRUCTOR" -- e.g. FOO in   Foo = FOO;
          ;


        make_ordinary_variable:  (sy::Symbol, vh::Varhome) ->  Variable;


        bogus_valcon:      ty::Valcon;
        bogus_exception:   ty::Valcon;

    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext