PreviousUpNext

15.3.278  src/lib/compiler/front/typer/main/typer-junk.api

## typer-junk.api

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

# The center of the typechecker is
#
#     src/lib/compiler/front/typer/main/type-package-language-g.pkg
#
# -- see it for a higher-level overview.
# It calls us for utility functions to build
# deep_syntax trees from raw_syntax trees.




###                     "[...] teaching of modern Christian creationism
###                      should be fought as a form of child abuse."
###
###                                            -- Donna Haraway



stipulate
    package di  =  debruijn_index;                              # debruijn_index                is from   src/lib/compiler/front/typer/basics/debruijn-index.pkg
    package ds  =  deep_syntax;                                 # deep_syntax                   is from   src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.pkg
    package err =  error_message;                               # error_message                 is from   src/lib/compiler/front/basics/errormsg/error-message.pkg
    package pcs =  per_compile_stuff;                           # per_compile_stuff             is from   src/lib/compiler/front/typer-stuff/main/per-compile-stuff.pkg
    package raw =  raw_syntax;                                  # raw_syntax                    is from   src/lib/compiler/front/parser/raw-syntax/raw-syntax.pkg
    package sta =  stamp;                                       # stamp                         is from   src/lib/compiler/front/typer-stuff/basics/stamp.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 syx =  symbolmapstack;                              # symbolmapstack                is from   src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg
    package tvs =  typevar_set;                                 # typevar_set                   is from   src/lib/compiler/front/typer/main/type-variable-set.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
herein

    api Typer_Junk {
        #
        Syntactic_Typechecking_Context 
          = AT_TOPLEVEL                                         # At top level -- not inside any module, rigid.               
          | IN_API                                              # Within a api body.                                    
          | IN_PACKAGE                                          # Inside a rigid package, i.e. not inside any generic body. 
          | IN_GENERIC                                          # Inside a generic.                                           
                { debruijn_depth:       di::Debruijn_Depth,
                  flex:                 sta::Stamp -> Bool      # Predicate recognizing flexible stamps.                      
                }                                               # Nomenclature: "Definition of SML" calls typcons from apis "flexible" an all others "rigid".
          ;

         Per_Compile_Stuff
            =
            pcs::Per_Compile_Stuff( ds::Declaration );

         debugging:  Ref(  Bool );

         for' :  List(X)
                 ->
                 (X -> Void)
                 ->
                 Void;

         discard:  X -> Void;
         single:   X -> List(X);

         sort3
             :
             List ((sy::Symbol, X, Y))
             ->
             List ((sy::Symbol, X, Y));

         equalsym:         sy::Symbol;
         bogus_id:         sy::Symbol;

         bogus_exn_id:     sy::Symbol;
         anon_param_name:  sy::Symbol;

         consexp:          ds::Deep_Expression;
         conspat:          ds::Case_Pattern -> ds::Case_Pattern;

         falseexp:         ds::Deep_Expression;
         falsepat:         ds::Case_Pattern;
         nilexp:           ds::Deep_Expression;

         nilpat:           ds::Case_Pattern;
         trueexp:          ds::Deep_Expression;
         truepat:          ds::Case_Pattern;

         tupleexp:         List( ds::Deep_Expression ) -> ds::Deep_Expression;
         tpselexp:         (ds::Deep_Expression, Int) -> ds::Deep_Expression;
         tuplepat:         List( ds::Case_Pattern ) -> ds::Case_Pattern;

         void_expression:  ds::Deep_Expression;
         void_pattern:     ds::Case_Pattern;
         bogus_expression: ds::Deep_Expression;

         bind_varp:  (List( ds::Case_Pattern ),
                       err::Plaint_Sink)
                    -> syx::Symbolmapstack;

    #    is_prim_pattern:  ds::Case_Pattern -> Bool;

         replace_pattern_variables
             :
             ( ds::Case_Pattern,
               Per_Compile_Stuff
             ) 
             ->
             ( ds::Case_Pattern,
               List( ds::Case_Pattern ),
               List( vac::Variable )
             );

         forbid_duplicates_in_list
             :
             ( err::Plaint_Sink,
               String,
               List( sy::Symbol )
             )
             ->
             Void;

         clean_pattern
             :
             err::Plaint_Sink
             ->
             ds::Case_Pattern
             ->
             ds::Case_Pattern;

      /*
        my getCoreExn:  (syx::Symbolmapstack * String) -> vac::Constructor
        my getCoreVariable:  (syx::Symbolmapstack * String) -> vac::var
      */

         complete_match
             :
             ( syx::Symbolmapstack,
               String
             )
             ->
             List( ds::Case_Rule )
             ->
             List( ds::Case_Rule );

         complete_match'
             :
             ds::Case_Rule
             ->
             List( ds::Case_Rule )
             ->
             List( ds::Case_Rule );

         make_apply_pattern
             :
             err::Plaint_Sink
             ->
             ( ds::Case_Pattern,
               ds::Case_Pattern
             )
             ->
             ds::Case_Pattern;

         make_handle_expression
             :
             ( ds::Deep_Expression,
               List( ds::Case_Rule ),
               Per_Compile_Stuff
             )
             ->
             ds::Deep_Expression;

         make_layered_pattern
             :
             ( ds::Case_Pattern,
               ds::Case_Pattern,
               err::Plaint_Sink
             )
             ->
             ds::Case_Pattern;

         make_record_expression
             :
             ( List( (sy::Symbol, ds::Deep_Expression) ),
               err::Plaint_Sink
             )
             ->
             ds::Deep_Expression;

         make_record_pattern
             :
             ( List( (sy::Symbol, ds::Case_Pattern) ),
               Bool,
               err::Plaint_Sink
             )
             ->
             ds::Case_Pattern;

         calculate_strictness
             :
             ( Int,
               tdt::Typoid
             )
             ->
             List( Bool );

         check_bound_typevars
             :
             ( tvs::Typevar_Set,
               List( tdt::Typevar_Ref ),
               err::Plaint_Sink
             )
             ->
             Void;

         do_var_pattern
             :
             ( syp::Symbol_Path,
               syx::Symbolmapstack,
               err::Plaint_Sink,
               Per_Compile_Stuff
             )
             ->
             ds::Case_Pattern;

         sort_record
             :
             ( List( (sy::Symbol, X) ),
               err::Plaint_Sink
             )
             ->
             List( (sy::Symbol, X) );

         make_deep_syntax_for_mutually_recursive_functions
             :
             ((List( ds::Case_Rule ) -> List( ds::Case_Rule )),

               List
                 { var:                 vac::Variable,          # Name of function

                   clauses:                                                                     # Cases defining the function.
                       List
                         { deep_syntax_patterns:   List( ds::Case_Pattern ), 
                           result_typoid:          Null_Or( tdt::Typoid ), 
                           deep_syntax_expression: ds::Deep_Expression
                         }, 

                   raw_typevars:      Ref(  List(  tdt::Typevar_Ref ) ),                        # Type variables appearing in function def.
                                                                                                # Backpatched by last call in type_core_language::type_declaration 

                   source_code_region:  raw::Source_Code_Region
                 },

               Per_Compile_Stuff
             )
             ->
             ( ds::Declaration,
               syx::Symbolmapstack
             );

         wrap_named_recursive_values_list
             :
             ( List( ds::Named_Recursive_Value ),
               Per_Compile_Stuff
             ) 
             ->
             ( ds::Declaration,
               syx::Symbolmapstack
             );

         symbol_naming_label
             :
             ds::Numbered_Label
             ->
             sy::Symbol; 


         convert_deep_syntax_named_recursive_values_list_to_deep_syntax_value_declarations_or_recursive_value_declarations
             :
             List( ds::Named_Recursive_Value )
             ->
             ds::Declaration;

         contains_package_declaration
             :
             raw::Declaration
             ->
             Bool;
    };
end;

## Copyright 1992 by AT&T Bell Laboratories 
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext