PreviousUpNext

15.3.255  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 sumtypes
#
#     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 ds  =  deep_syntax;                                                 # deep_syntax                   is from   src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.pkg
    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 tdt =  type_declaration_types;                                      # type_declaration_types        is from   src/lib/compiler/front/typer-stuff/types/type-declaration-types.pkg
    package vh  =  varhome;                                                     # varhome                       is from   src/lib/compiler/front/typer-stuff/basics/varhome.pkg
herein

    api Variables_And_Constructors {
        #
        Variable
            = PLAIN_VARIABLE
                {
                  path:                 syp::Symbol_Path,
                  vartypoid_ref:        Ref( tdt::Typoid ),                     # Gets set in   generalize_type()       in   src/lib/compiler/front/typer/types/type-core-language-declaration-g.pkg
                  varhome:              vh::Varhome,
                  inlining_data:        id::Inlining_Data
                }
                                                                                # 'Variable' records per-variable information
                                                                                # in deep syntax trees:  src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.api
                                                                                # It appears in:
                                                                                #     ds::VARIABLE_IN_EXPRESSION
                                                                                #     ds::VARIABLE_IN_PATTERN
                                                                                #     ds::OVERLOAD_DECLARATIONS
                                                                                #     ds::NAMED_RECURSIVE_VALUE
                                                                                # 'type_ref' is a ref because we frequently
                                                                                # update it in place when computing and
                                                                                # generalizing pattern types:  See
                                                                                #     src/lib/compiler/front/typer/types/type-core-language-declaration-g.pkg
                                                                                #

            | OVERLOADED_VARIABLE
                {
                  name:                 sy::Symbol,
                  typescheme:           tdt::Typescheme,
                  alternatives:         Ref( List  { indicator: tdt::Typoid,
                                                     variant:   Variable
                                                   }
                                           )
                }
            | ERROR_VARIABLE
            ;


#       Constructor
#           =
#           tdt::Valcon;


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


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


        bogus_valcon:      tdt::Valcon;
        bogus_exception:   tdt::Valcon;

    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext