PreviousUpNext

15.3.294  src/lib/compiler/toplevel/main/translate-raw-syntax-to-execode.api

## translate-raw-syntax-to-execode.api 

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



# Trimmed to contain only compile-related stuff but no linking or execution.
#   -- 07/18/2001 (blume)



###         "We must beware of needless innovations,
###          especially when guided by logic."
###
###                      -- Winston Churchill



stipulate
    package acf =  anormcode_form;              # anormcode_form        is from   src/lib/compiler/back/top/anormcode/anormcode-form.pkg
    package cs  =  code_segment;                # code_segment          is from   src/lib/compiler/execution/code-segments/code-segment.pkg
    package ds  =  deep_syntax;                 # deep_syntax           is from   src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.pkg
    package tmp =  highcode_codetemp;           # highcode_codetemp     is from   src/lib/compiler/back/top/highcode/highcode-codetemp.pkg
    package imp =  import_tree;                 # import_tree           is from   src/lib/compiler/execution/main/import-tree.pkg
    package im  =  inlining_mapstack;           # inlining_mapstack     is from   src/lib/compiler/toplevel/compiler-state/inlining-mapstack.pkg
    package pci =  per_compile_info;            # per_compile_info      is from   src/lib/compiler/front/typer-stuff/main/per-compile-info.pkg
    package ph  =  picklehash;                  # picklehash            is from   src/lib/compiler/front/basics/map/picklehash.pkg
    package pp  =  prettyprinter;               # prettyprinter         is from   src/lib/prettyprint/big/src/prettyprinter.pkg
    package raw =  raw_syntax;                  # raw_syntax            is from   src/lib/compiler/front/parser/raw-syntax/raw-syntax.pkg
    package sci =  sourcecode_info;             # sourcecode_info       is from   src/lib/compiler/front/basics/source/sourcecode-info.pkg
    package syx =  symbolmapstack;              # symbolmapstack        is from   src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg
    package vh  =  varhome;                     # varhome               is from   src/lib/compiler/front/typer-stuff/basics/varhome.pkg
herein

    # This API is implemented by:
    #
    #     src/lib/compiler/toplevel/main/translate-raw-syntax-to-execode-g.pkg
    #
    api Translate_Raw_Syntax_To_Execode_0 {
        #
        Pickle;                         # Pickled format.
        Hash;                           # Dictionary hash id.
        Picklehash = ph::Picklehash;    # 
        Compiledfile_Version;

        make_per_compile_info
            :
            { sourcecode_info:          sci::Sourcecode_Info,
              transform:                ds::Declaration -> ds::Declaration,
              prettyprinter_or_null:    Null_Or pp::Prettyprinter
            }
            ->
            pci::Per_Compile_Info( ds::Declaration );



        # Take raw_syntax_tree, do semantic checks,
        # then return the new symbol table, deep_syntax_tree and pickles
        #
        typecheck_raw_declaration
            :
            { raw_declaration:              raw::Declaration,                                   # Actual raw syntax to compile.
              symbolmapstack:               syx::Symbolmapstack,                                # Symbol table containing info from all .compiled files we depend on.
              per_compile_info:             pci::Per_Compile_Info( ds::Declaration ),
              compiledfile_version:         Compiledfile_Version,
              sourcecode_info:              sci::Sourcecode_Info
            }
            ->
            { deep_syntax_declaration:      ds::Declaration,                                    # Typechecked form of  raw_declaration.
              new_symbolmapstack:           syx::Symbolmapstack,                                # A symbol table delta containing (only) stuff from raw_declaration.
              exported_highcode_variables:  List( tmp::Codetemp ),
              export_picklehash:            Null_Or( Picklehash ),
              symbolmapstack_picklehash:    Hash,
              pickle:                       Pickle
            };



        # Typecheck as above, then additionally compile down to binary code:
        #
        translate_raw_syntax_to_execode
          :
          { sourcecode_info:                        sci::Sourcecode_Info,
            raw_declaration:                        raw::Declaration,                           # Actual raw syntax to compile.

            symbolmapstack:                         syx::Symbolmapstack,                        # Symbol table containing info from all .compiled files we depend on.
            inlining_mapstack:                      im::Picklehash_To_Anormcode_Mapstack,       # Inlining table matching symbolmapstack.

            per_compile_info:                       pci::Per_Compile_Info( ds::Declaration ), 
            compiledfile_version:                   Compiledfile_Version,
            handle_compile_errors:                  String -> Void,
            crossmodule_inlining_aggressiveness:   Null_Or( Int )
          }
          ->
          { code_and_data_segments:                 cs::Code_And_Data_Segments,
            new_symbolmapstack:                     syx::Symbolmapstack,                        # A symbol table delta containing (only) stuff from raw_declaration.
            deep_syntax_declaration:                ds::Declaration,                            # Typechecked form of  raw_declaration -- only for prettyprinting.

            export_picklehash:                      Null_Or( Picklehash ),
            exported_highcode_variables:            List( tmp::Codetemp ),

            symbolmapstack_picklehash:              Hash,
            pickle:                                 Pickle, 
            inline_expression:                      Null_Or( acf::Function ),
            import_trees:                           List( imp::Import_Tree )
          };

    };                                                                                          #  Api Translate_raw_syntax_to_execode_0
end;

api Translate_Raw_Syntax_To_Execode
    =
    Translate_Raw_Syntax_To_Execode_0
        where  Pickle == vector_of_one_byte_unts::Vector
         also  Hash   == picklehash::Picklehash
         also  Compiledfile_Version   == String;


api Toplevel_Translate_raw_syntax_to_execode
    =
    Translate_Raw_Syntax_To_Execode_0
        where  Hash                 == Void
         also  Compiledfile_Version == Void;


## COPYRIGHT (c) 1996 Bell Laboratories 
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2013,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext