PreviousUpNext

15.3.287  src/lib/compiler/toplevel/interact/compiler-state.api

## compiler-state.api

# Compiled by:
#     src/lib/compiler/core.sublib



# This defines the core toplevel datastructures
# used to track known symbols, loaded modules etc
# during a compile.
#
# (But see   src/app/makelib/main/makelib-state.pkg
# for a still higher level in the state hierarchy.)
#
# As a rough guide to the lay of the land,
# here we implement references to compiler_mapstack_set
# records, which is to say, compiler_mapstack_set records
# which we can update via side-effect.
#
# compiler_mapstack_set records are defined in
#
#     src/lib/compiler/toplevel/compiler-state/compiler-mapstack-set.sml
#
# and are composed of three principal parts:
#
#    A symbol table holding per-symbol type information etc
#    A linking table tracking loaded libraries.
#    An inlining table tracking cross-module function inlining info.


stipulate
    package cms =  compiler_mapstack_set;                               # compiler_mapstack_set                 is from   src/lib/compiler/toplevel/compiler-state/compiler-mapstack-set.pkg
    package pl  =  property_list;                                       # property_list                         is from   src/lib/src/property-list.pkg
    package sy  =  symbol;                                              # symbol                                is from   src/lib/compiler/front/basics/map/symbol.pkg
herein

    api Compiler_State {

        Compiler_Mapstack_Set
            =
            cms::Compiler_Mapstack_Set;

        Compiler_Mapstack_Set_Jar
          =
          { get_mapstack_set:   Void -> Compiler_Mapstack_Set,
            set_mapstack_set:   Compiler_Mapstack_Set -> Void
          };

        Compiler_State
          =
          { top_level_pkg_etc_defs_jar: Compiler_Mapstack_Set_Jar,
            baselevel_pkg_etc_defs_jar: Compiler_Mapstack_Set_Jar,
            property_list:                      pl::Property_List
          };

        compiler_state:    Void -> Compiler_State;

        get_top_level_pkg_etc_defs_jar: Void -> Compiler_Mapstack_Set_Jar;              #  Interactive top level dictionary 
        get_baselevel_pkg_etc_defs_jar: Void -> Compiler_Mapstack_Set_Jar;
        pervasive_fun_etc_defs_jar:             Compiler_Mapstack_Set_Jar;

        property_list:  Void -> pl::Property_List;


        combined:  Void -> Compiler_Mapstack_Set;

        # Push a given Compiler_State onto the stack,
        # run the thunk, then pop the state:

        run_thunk_in_compiler_state:  ((Void -> X), Compiler_State)   -> X;

        list_bound_symbols:  Void -> List( sy::Symbol );
    };
end;




Comments and suggestions to: bugs@mythryl.org

PreviousUpNext