PreviousUpNext

15.3.182  src/lib/compiler/back/low/tools/match-compiler/match-g.api

# Interface with the match compiler to generate Mythryl code

# Compiled by:
#     src/lib/compiler/back/low/tools/match-compiler.lib

###                "No man really becomes a fool
###                 until he stops asking questions.
###
###                           -- Charles Steinmetz



stipulate
    package raw =  adl_raw_syntax_form;                                         # adl_raw_syntax_form           is from   src/lib/compiler/back/low/tools/adl-syntax/adl-raw-syntax-form.pkg
herein

    # This api is implemented in:
    #     src/lib/compiler/back/low/tools/match-compiler/match-gen-g.pkg
    #
    api Match_G {
        #
        package mc:             Match_Compiler;                                 # Match_Compiler                is from   src/lib/compiler/back/low/tools/match-compiler/match-compiler.api
        package lit_map:        Map                                             # Map                           is from   src/lib/src/map.api
                            where  key::Key == raw::Literal; 

        Valcon_Form
                 =
                 VALCON_FORM  (List( raw::Id ),
                                                   raw::Constructor,
                                                   raw::Sumtype)
               | EXCEPTION  (List( raw::Id ),
                      raw::Id,
                      Null_Or( raw::Type ));

        package dictionary
            :
            api {
                Dictionary;
                #
                bind_api_identifier:   (Dictionary, raw::Id, Dictionary      ) -> Dictionary;
                insert_cons:       (Dictionary, raw::Id, Valcon_Form) -> Dictionary;
                #
                lookup_sig:                (Dictionary, raw::Id) -> Null_Or( Dictionary       );
                lookup_cons:       (Dictionary, raw::Id) -> Null_Or( Valcon_Form );
                #
                empty:              Dictionary;
            };

        Compiled_Type_Info = dictionary::Dictionary;

        init:    Void -> Void;

        compile_types:  List(raw::Declaration) -> Compiled_Type_Info;

        compile:  Compiled_Type_Info -> List( raw::Clause ) -> mc::Compiled_Dfa;

        report:   { warning:  String -> Void,
                    error:    String -> Void, 
                    log:      String -> Void, 
                    dfa:      mc::Compiled_Dfa,
                    rules:    List( raw::Clause )
                   }
                   -> Void;

        code_gen: { root:           raw::Expression,
                    dfa:            mc::Compiled_Dfa,
                    fail:           Void -> raw::Expression,
                    literals:   Ref(  lit_map::Map(  raw::Id ) ) 
                   }
                   -> raw::Expression;

        is_complex:  List(raw::Clause) -> Bool;

    };                                                                          # api Match_G
end;                                                                            # stipulate


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext