Commit 597e5e94 authored by John van Groningen's avatar John van Groningen

store predefined identifiers in CAF

parent d9780ce1
......@@ -462,7 +462,7 @@ backEndConvertModulesH predefs {fe_icl =
#! backEnd
= adjustStrictListFunctions fe_arrayInstances.ali_list_first_instance_indices fe_arrayInstances.ali_tail_strict_list_first_instance_indices predefs fe_dcls icl_used_module_numbers main_dcl_module_n backEnd;
#! (rules, backEnd)
= convertRules [(index, icl_functions.[index]) \\ (_, index) <- functionIndices] main_dcl_module_n predefs.[PD_DummyForStrictAliasFun].pds_ident (backEnd -*-> "convertRules")
= convertRules [(index, icl_functions.[index]) \\ (_, index) <- functionIndices] main_dcl_module_n predefined_idents.[PD_DummyForStrictAliasFun] (backEnd -*-> "convertRules")
#! backEnd
= appBackEnd (BEDefineRules rules) (backEnd -*-> "BEDefineRules")
#! backEnd
......
......@@ -47,7 +47,7 @@ backEndInterface outputFileName commandLineArgs listTypes typesPath predef_symbo
| not compatible
= (False, var_heap, attrHeap, errorFile, files)
# varHeap
= backEndPreprocess predef_symbols.[PD_DummyForStrictAliasFun].pds_ident functionIndices fe_icl var_heap
= backEndPreprocess predefined_idents.[PD_DummyForStrictAliasFun] functionIndices fe_icl var_heap
with
functionIndices
= flatten [[member \\ member <- group.group_members] \\ group <-: fe_components]
......
This diff is collapsed.
......@@ -62,7 +62,7 @@ get_unboxed_list_indices_and_decons_u_ident cs=:{cs_predef_symbols,cs_x}
# decons_u_index=decons_u_symbol.pds_def
# (nil_u_index,cs_predef_symbols)=cs_predef_symbols![PD_nil_u].pds_def
# cs={cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictLists}
= (stdStrictLists_index,cons_u_index,decons_u_index,nil_u_index,decons_u_symbol.pds_ident,cs)
= (stdStrictLists_index,cons_u_index,decons_u_index,nil_u_index,predefined_idents.[PD_decons_u],cs)
make_unboxed_list type_symbol expr_heap cs
# (stdStrictLists_index,cons_u_index,decons_u_index,nil_u_index,decons_u_ident,cs) = get_unboxed_list_indices_and_decons_u_ident cs
......@@ -79,7 +79,7 @@ get_unboxed_tail_strict_list_indices_and_decons_u_ident cs=:{cs_predef_symbols,c
# decons_uts_index=decons_uts_symbol.pds_def
# (nil_uts_index,cs_predef_symbols)=cs_predef_symbols![PD_nil_uts].pds_def
# cs={cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictLists}
= (stdStrictLists_index,cons_uts_index,decons_uts_index,nil_uts_index,decons_uts_symbol.pds_ident,cs)
= (stdStrictLists_index,cons_uts_index,decons_uts_index,nil_uts_index,predefined_idents.[PD_decons_uts],cs)
make_unboxed_tail_strict_list type_symbol expr_heap cs
# (stdStrictLists_index,cons_uts_index,decons_uts_index,nil_uts_index,decons_uts_ident,cs) = get_unboxed_tail_strict_list_indices_and_decons_u_ident cs
......@@ -96,7 +96,7 @@ get_overloaded_list_indices_and_decons_ident cs=:{cs_predef_symbols,cs_x}
# decons_index=decons_symbol.pds_def
# (nil_index,cs_predef_symbols)=cs_predef_symbols![PD_nil].pds_def
# cs={cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictLists}
= (stdStrictLists_index,cons_index,decons_index,nil_index,decons_symbol.pds_ident,cs)
= (stdStrictLists_index,cons_index,decons_index,nil_index,predefined_idents.[PD_decons],cs)
make_overloaded_list type_symbol expr_heap cs
# (stdStrictLists_index,cons_index,decons_index,nil_index,decons_ident,cs) = get_overloaded_list_indices_and_decons_ident cs
......@@ -795,11 +795,13 @@ where
| glob_module==cPredefinedModuleIndex
# index=glob_object.ds_index+FirstConstructorPredefinedSymbolIndex
| index==PD_OverloadedConsSymbol
# ({pds_ident,pds_def},cs) = cs!cs_predef_symbols.[pd_cons_symbol]
# ({pds_def},cs) = cs!cs_predef_symbols.[pd_cons_symbol]
# pds_ident = predefined_idents.[pd_cons_symbol]
# glob_object = {glob_object & ds_index=pds_def,ds_ident=pds_ident}
= ({pattern & ap_symbol.glob_object=glob_object},cs)
| index==PD_OverloadedNilSymbol
# ({pds_ident,pds_def},cs) = cs!cs_predef_symbols.[pd_nil_symbol]
# ({pds_def},cs) = cs!cs_predef_symbols.[pd_nil_symbol]
# pds_ident = predefined_idents.[pd_nil_symbol]
# glob_object = {glob_object & ds_index=pds_def,ds_ident=pds_ident}
= ({pattern & ap_symbol.glob_object=glob_object},cs)
= abort "replace_overloaded_symbol_in_pattern"
......@@ -1239,26 +1241,28 @@ where
-> (!Expression, ![FreeVar], !*ExpressionState, !u:ExpressionInfo, !*CheckState)
check_id_expression {ste_kind = STE_Empty} is_expr_list free_vars id e_input e_state e_info cs=:{cs_error,cs_predef_symbols,cs_x}
# ({pds_ident=from_ident}) = cs_predef_symbols.[PD_From]
({pds_ident=from_then_ident}) = cs_predef_symbols.[PD_FromThen]
({pds_ident=from_to_ident}) = cs_predef_symbols.[PD_FromTo]
({pds_ident=from_then_to_ident}) = cs_predef_symbols.[PD_FromThenTo]
# local_predefined_idents = predefined_idents
# from_ident = local_predefined_idents.[PD_From]
from_then_ident = local_predefined_idents.[PD_FromThen]
from_to_ident = local_predefined_idents.[PD_FromTo]
from_then_to_ident = local_predefined_idents.[PD_FromThenTo]
| id==from_ident || id==from_then_ident || id==from_to_ident || id==from_then_to_ident
= (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cNeedStdEnum})
// instead of giving an error message remember that StdEnum should have been imported.
// Error will be given in function check_needed_modules_are_imported
# ({pds_ident=createArray_ident}) = cs_predef_symbols.[PD__CreateArrayFun]
({pds_ident=uselect_ident}) = cs_predef_symbols.[PD_UnqArraySelectFun]
({pds_ident=update_ident}) = cs_predef_symbols.[PD_ArrayUpdateFun]
({pds_ident=usize_ident}) = cs_predef_symbols.[PD_UnqArraySizeFun]
# createArray_ident = local_predefined_idents.[PD__CreateArrayFun]
uselect_ident = local_predefined_idents.[PD_UnqArraySelectFun]
update_ident = local_predefined_idents.[PD_ArrayUpdateFun]
usize_ident = local_predefined_idents.[PD_UnqArraySizeFun]
| id==createArray_ident || id==uselect_ident || id==update_ident || id==usize_ident
= (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cNeedStdArray})
// instead of giving an error message remember that StdArray should have been be imported.
// Error will be given in function check_needed_modules_are_imported
| id==cs_predef_symbols.[PD_cons].pds_ident || id==cs_predef_symbols.[PD_decons].pds_ident
|| id==cs_predef_symbols.[PD_cons_u].pds_ident || id==cs_predef_symbols.[PD_decons_u].pds_ident
|| id==cs_predef_symbols.[PD_cons_uts].pds_ident || id==cs_predef_symbols.[PD_decons_uts].pds_ident
|| id==cs_predef_symbols.[PD_nil].pds_ident || id==cs_predef_symbols.[PD_nil_u].pds_ident || id==cs_predef_symbols.[PD_nil_uts].pds_ident
| id==local_predefined_idents.[PD_cons] || id==local_predefined_idents.[PD_decons]
|| id==local_predefined_idents.[PD_cons_u] || id==local_predefined_idents.[PD_decons_u]
|| id==local_predefined_idents.[PD_cons_uts] || id==local_predefined_idents.[PD_decons_uts]
|| id==local_predefined_idents.[PD_nil] || id==local_predefined_idents.[PD_nil_u] || id==local_predefined_idents.[PD_nil_uts]
= (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cNeedStdStrictLists})
// instead report that StdStrictLists should be imported in function check_needed_modules_are_imported
= (EE, free_vars, e_state, e_info, { cs & cs_error = checkError id "undefined" cs_error })
......@@ -2249,8 +2253,7 @@ buildPattern mod_index (APK_Macro is_dcl_macro) {glob_module,glob_object} args o
getPredefinedGlobalSymbol :: !Index !Index !STE_Kind !Int !*CheckState -> (!Global DefinedSymbol, !*CheckState)
getPredefinedGlobalSymbol symb_index module_index req_ste_kind arity cs=:{cs_predef_symbols,cs_symbol_table}
# (pre_def_mod, cs_predef_symbols) = cs_predef_symbols![module_index]
# mod_id = pre_def_mod.pds_ident
# mod_id = predefined_idents.[module_index]
# (mod_entry, cs_symbol_table) = readPtr mod_id.id_info cs_symbol_table
| mod_entry.ste_kind == STE_ClosedModule
# (glob_object, cs) = get_predefined_symbol symb_index req_ste_kind arity mod_entry.ste_index
......@@ -2261,8 +2264,7 @@ getPredefinedGlobalSymbol symb_index module_index req_ste_kind arity cs=:{cs_pre
where
get_predefined_symbol :: !Index !STE_Kind !Int !Index !*CheckState -> (!DefinedSymbol,!*CheckState)
get_predefined_symbol symb_index req_ste_kind arity mod_index cs=:{cs_predef_symbols,cs_symbol_table,cs_error}
# (pre_def_symb, cs_predef_symbols) = cs_predef_symbols![symb_index]
symb_id = pre_def_symb.pds_ident
# symb_id = predefined_idents.[symb_index]
(symb_entry, cs_symbol_table) = readPtr symb_id.id_info cs_symbol_table
cs = { cs & cs_predef_symbols = cs_predef_symbols, cs_symbol_table = cs_symbol_table }
| symb_entry.ste_kind == req_ste_kind
......
......@@ -138,11 +138,13 @@ convertDynamicPatternsIntoUnifyAppls global_type_instances common_defs main_dcl_
True
# arity = 2
// get tuple arity 2 constructor
# ({pds_module, pds_def, pds_ident}, predefined_symbols) = predefined_symbols![GetTupleConsIndex arity]
# ({pds_module, pds_def}, predefined_symbols) = predefined_symbols![GetTupleConsIndex arity]
# pds_ident = predefined_idents.[GetTupleConsIndex arity]
# twoTuple_symb = { symb_name = pds_ident, symb_kind = SK_Constructor { glob_module = pds_module, glob_object = pds_def}, symb_arity = arity }
// get tuple, type and value selectors
# ({pds_def, pds_ident}, predefined_symbols) = predefined_symbols![GetTupleConsIndex arity]
# ({pds_def}, predefined_symbols) = predefined_symbols![GetTupleConsIndex arity]
# pds_ident = predefined_idents.[GetTupleConsIndex arity]
# twotuple = {ds_ident = pds_ident, ds_arity = arity, ds_index = pds_def}
# type_selector = TupleSelect twotuple 1
# value_selector = TupleSelect twotuple 0
......@@ -933,7 +935,8 @@ where
# (ci=:{ci_predef_symb})
= ci;
# ({pds_module, pds_def, pds_ident}, ci_predef_symb) = ci_predef_symb![PD_ModuleConsSymbol]
# ({pds_module, pds_def}, ci_predef_symb) = ci_predef_symb![PD_ModuleConsSymbol]
# pds_ident = predefined_idents.[PD_ModuleConsSymbol]
# module_symb1 = { symb_name = pds_ident, symb_kind = SK_Constructor { glob_module = pds_module, glob_object = pds_def}, symb_arity = 0 }
# ci
= { ci & ci_predef_symb = ci_predef_symb };
......@@ -1187,13 +1190,15 @@ getResultType case_info_ptr ci=:{ci_expr_heap}
getSymbol :: Index ((Global Index) -> SymbKind) Int !*ConversionInfo -> (SymbIdent, !*ConversionInfo)
getSymbol index symb_kind arity ci=:{ci_predef_symb}
# ({pds_module, pds_def, pds_ident}, ci_predef_symb) = ci_predef_symb![index]
# ({pds_module, pds_def}, ci_predef_symb) = ci_predef_symb![index]
# pds_ident = predefined_idents.[index]
ci = {ci & ci_predef_symb = ci_predef_symb}
symbol = { symb_name = pds_ident, symb_kind = symb_kind { glob_module = pds_module, glob_object = pds_def}, symb_arity = arity }
= (symbol, ci)
getTupleSymbol arity ci=:{ci_predef_symb}
# ({pds_def, pds_ident}, ci_predef_symb) = ci_predef_symb![GetTupleConsIndex arity]
# ({pds_def}, ci_predef_symb) = ci_predef_symb![GetTupleConsIndex arity]
# pds_ident = predefined_idents.[GetTupleConsIndex arity]
= ( {ds_ident = pds_ident, ds_arity = arity, ds_index = pds_def}, {ci & ci_predef_symb = ci_predef_symb })
getGlobalIndex :: Index !*ConversionInfo -> (Global Index, !*ConversionInfo)
......@@ -1203,7 +1208,8 @@ getGlobalIndex index ci=:{ci_predef_symb}
getConstructor :: Index Int !*ConversionInfo -> (Global DefinedSymbol, !*ConversionInfo)
getConstructor index arity ci=:{ci_predef_symb}
# ({pds_module, pds_def, pds_ident}, ci_predef_symb) = ci_predef_symb![index]
# ({pds_module, pds_def}, ci_predef_symb) = ci_predef_symb![index]
# pds_ident = predefined_idents.[index]
defined_symbol = { ds_ident = pds_ident, ds_arity = arity, ds_index = pds_def}
= ( {glob_object = defined_symbol, glob_module = pds_module} , {ci & ci_predef_symb = ci_predef_symb} )
......@@ -1274,14 +1280,16 @@ where
get_module_id_app :: !*PredefinedSymbols -> (App,Expression,!*PredefinedSymbols)
get_module_id_app predef_symbols
// get module id symbol
# ({pds_module, pds_def, pds_ident}, predef_symbols) = predef_symbols![PD_ModuleConsSymbol]
# ({pds_module, pds_def}, predef_symbols) = predef_symbols![PD_ModuleConsSymbol]
# pds_ident = predefined_idents.[PD_ModuleConsSymbol]
# module_symb =
{ app_symb = { symb_name = pds_ident, symb_kind = SK_Constructor { glob_module = pds_module, glob_object = pds_def}, symb_arity = 0 }
, app_args = []
, app_info_ptr = nilPtr
}
# ({pds_module, pds_def, pds_ident}, predef_symbols) = predef_symbols![PD_ModuleID]
# ({pds_module, pds_def}, predef_symbols) = predef_symbols![PD_ModuleID]
# pds_ident = predefined_idents.[PD_ModuleID]
# module_id_symb =
{ app_symb = { symb_name = pds_ident, symb_kind = SK_Constructor { glob_module = pds_module, glob_object = pds_def}, symb_arity = 1 }
, app_args = [App module_symb]
......
......@@ -19,12 +19,11 @@ markExplImpSymbols :: !Int !*(!*{!*{!u:ExplImpInfo}}, !*SymbolTable)
updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable)
optStoreInstanceWithClassSymbol :: Declaration !Ident !*SymbolTable
-> .SymbolTable
optStoreInstanceWithClassSymbol :: Declaration !Ident !*SymbolTable -> .SymbolTable
solveExplicitImports :: !(IntKeyHashtable [(Int,Position,[ImportNrAndIdents])]) !{#Int} !Index
!*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState)
-> (!.SolvedImports,!(!v:{#DclModule},!.{#Int},!{!.ExplImpInfo},!.CheckState))
!*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState)
-> (!.SolvedImports,! (!v:{#DclModule},!.{#Int},!{!.ExplImpInfo},!.CheckState))
checkExplicitImportCompleteness :: ![([Declaration], Position)] !*{#DclModule} !*{#FunDef} !*{#*{#FunDef}} !*ExpressionHeap !*CheckState
-> (!.{#DclModule},!.{#FunDef},!*{#*{#FunDef}},!.ExpressionHeap,!.CheckState)
......
......@@ -42,13 +42,11 @@ markExplImpSymbols component_nr (expl_imp_info, cs_symbol_table)
# (eii, expl_imp_info) = replaceTwoDimArrElt component_nr i TemporarilyFetchedAway expl_imp_info
(eii_ident, eii) = get_eei_ident eii
= (eii_ident, { expl_imp_info & [component_nr, i] = eii })
updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable)
updateExplImpForMarkedSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers inst_indices}
dcl_modules expl_imp_infos cs_symbol_table
= foldSt (addExplImpInfo mod_index decl inst_indices) component_numbers
(dcl_modules, expl_imp_infos, cs_symbol_table)
updateExplImpForMarkedSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers inst_indices} dcl_modules expl_imp_infos cs_symbol_table
= foldSt (addExplImpInfo mod_index decl inst_indices) component_numbers (dcl_modules, expl_imp_infos, cs_symbol_table)
updateExplImpForMarkedSymbol _ _ entry dcl_modules expl_imp_infos cs_symbol_table
= (dcl_modules, expl_imp_infos, cs_symbol_table)
......@@ -59,19 +57,15 @@ addExplImpInfo mod_index decl instances { cai_component_nr, cai_index } (dcl_mod
= replaceTwoDimArrElt cai_component_nr cai_index TemporarilyFetchedAway expl_imp_infos
(di_belonging, dcl_modules, cs_symbol_table)
= get_belonging_symbol_nrs decl dcl_modules cs_symbol_table
di
= { di_decl = decl, di_instances = instances, di_belonging = di_belonging }
new_expl_imp_info
= ExplImpInfo eii_ident (ikhInsert` False mod_index di eii_declaring_modules)
di = { di_decl = decl, di_instances = instances, di_belonging = di_belonging }
new_expl_imp_info = ExplImpInfo eii_ident (ikhInsert` False mod_index di eii_declaring_modules)
= (dcl_modules, { expl_imp_infos & [cai_component_nr,cai_index] = new_expl_imp_info }, cs_symbol_table)
where
get_belonging_symbol_nrs :: !Declaration !v:{#DclModule} !u:(Heap SymbolTableEntry)
-> (!.NumberSet,!v:{#DclModule},!u:Heap SymbolTableEntry)
-> (!.NumberSet,!v:{#DclModule},!u: Heap SymbolTableEntry)
get_belonging_symbol_nrs decl dcl_modules cs_symbol_table
# (all_belonging_symbols, dcl_modules)
= getBelongingSymbols decl dcl_modules
nr_of_belongs
= nrOfBelongingSymbols all_belonging_symbols
# (all_belonging_symbols, dcl_modules) = getBelongingSymbols decl dcl_modules
nr_of_belongs = nrOfBelongingSymbols all_belonging_symbols
(_, belonging_bitvect, cs_symbol_table)
= foldlBelongingSymbols set_bit all_belonging_symbols (0, bitvectCreate nr_of_belongs, cs_symbol_table)
= (bitvectToNumberSet belonging_bitvect, dcl_modules, cs_symbol_table)
......@@ -131,15 +125,12 @@ getBelongingSymbolsFromID (ID_Record _ x) = x
getBelongingSymbolsFromID _ = No
solveExplicitImports :: !(IntKeyHashtable [(Int,Position,[ImportNrAndIdents])]) !{#Int} !Index
!*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState)
-> (!.SolvedImports,!(!v:{#DclModule},!.{#Int},!{!.ExplImpInfo},!.CheckState))
!*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState)
-> (!.SolvedImports,! (!v:{#DclModule},!.{#Int},!{!.ExplImpInfo},!.CheckState))
solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod (dcl_modules, visited_modules, expl_imp_info, cs)
# import_indices
= ikhSearch` importing_mod expl_imp_indices_ikh
expl_imp_indices
= [ imports \\ imports=:(_, _, [_:_]) <- import_indices ]
impl_imports
= [ (mod_index, position) \\ imports=:(mod_index, position, []) <- import_indices ]
# import_indices = ikhSearch` importing_mod expl_imp_indices_ikh
expl_imp_indices = [ imports \\ imports=:(_, _, [_:_]) <- import_indices ]
impl_imports = [ (mod_index, position) \\ imports=:(mod_index, position, []) <- import_indices ]
(expl_imports, state)
= mapSt (solve_expl_imp_from_module expl_imp_indices_ikh modules_in_component_set importing_mod)
expl_imp_indices (dcl_modules, visited_modules, expl_imp_info, cs)
......@@ -203,20 +194,15 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
eii_declaring_modules (bitvectResetAll visited_modules)
= case found of
Yes _
# eii_declaring_modules
= foldSt (store_belonging belong_nr ini_symbol_nr) path eii_declaring_modules
(belong_decl, dcl_modules)
= get_nth_belonging_decl position belong_nr decl dcl_modules
# eii_declaring_modules = foldSt (store_belonging belong_nr ini_symbol_nr) path eii_declaring_modules
(belong_decl, dcl_modules) = get_nth_belonging_decl position belong_nr decl dcl_modules
-> ([belong_decl:decls_accu], dcl_modules, eii_declaring_modules, visited_modules, cs_error)
_
# cs_error
= case need_all of
True
# cs_error
= pushErrorAdmin (newPosition import_ident position) cs_error
cs_error
= checkError belong_ident ("of "+++eii_ident.id_name+++" not exported by the specified module")
cs_error
# cs_error = pushErrorAdmin (newPosition import_ident position) cs_error
cs_error = checkError belong_ident ("of "+++eii_ident.id_name+++" not exported by the specified module") cs_error
-> popErrorAdmin cs_error
_
-> cs_error
......@@ -271,23 +257,18 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
-> ([], dcl_modules)
numerate_belongs {id_info} (i, cs_symbol_table)
# (ste, cs_symbol_table)
= readPtr id_info cs_symbol_table
new_ste
= { ste & ste_kind = STE_BelongingSymbol i, ste_previous = ste }
# (ste, cs_symbol_table) = readPtr id_info cs_symbol_table
new_ste = { ste & ste_kind = STE_BelongingSymbol i, ste_previous = ste }
= (i+1, writePtr id_info new_ste cs_symbol_table)
get_opt_nr_and_ident position eii_ident {ii_ident=ii_ident=:{id_info}} (cs_error, cs_symbol_table)
# ({ste_kind}, cs_symbol_table)
= readPtr id_info cs_symbol_table
# ({ste_kind}, cs_symbol_table) = readPtr id_info cs_symbol_table
= case ste_kind of
STE_BelongingSymbol i
-> (Yes (i, ii_ident), (cs_error, cs_symbol_table))
_
# cs_error
= pushErrorAdmin (newPosition import_ident position) cs_error
cs_error
= checkError ii_ident ("does not belong to "+++eii_ident.id_name) cs_error
# cs_error = pushErrorAdmin (newPosition import_ident position) cs_error
cs_error = checkError ii_ident ("does not belong to "+++eii_ident.id_name) cs_error
-> (No, (popErrorAdmin cs_error, cs_symbol_table))
search_expl_imp_symbol expl_imp_indices_ikh modules_in_component_set importing_mod imported_mod
......@@ -322,14 +303,12 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
-> belonging_accu
Yes _
-> [(di_decl, ini, imported_mod):belonging_accu]
new_eii
= ExplImpInfo eii_ident new_eii_declaring_modules
new_eii = ExplImpInfo eii_ident new_eii_declaring_modules
-> (True, ([di_decl:di_instances++decls_accu], new_belonging_accu, visited_modules,
{ expl_imp_info & [ini_symbol_nr] = new_eii }))
// otherwise GOTO next alternative
_
# eii
= ExplImpInfo eii_ident eii_declaring_modules
# eii = ExplImpInfo eii_ident eii_declaring_modules
-> (False, (decls_accu, belonging_accu, visited_modules, { expl_imp_info & [ini_symbol_nr] = eii }))
depth_first_search expl_imp_indices_ikh modules_in_component_set
......@@ -450,10 +429,8 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
= (expl_imp_info, popErrorAdmin cs_error)
do_a_lot_just_to_read_an_array_2 i expl_imp_info
# (eii, expl_imp_info)
= replace expl_imp_info i TemporarilyFetchedAway
(eii_ident, eii)
= get_eei_ident eii
# (eii, expl_imp_info) = replace expl_imp_info i TemporarilyFetchedAway
(eii_ident, eii) = get_eei_ident eii
= (eii_ident, { expl_imp_info & [i] = eii })
impDeclToNameSpaceString (ID_Function _) = "function/macro"
......
......@@ -3573,7 +3573,8 @@ buildTypeApp td_module {td_name, td_arity, td_index} args
buildPredefTypeApp :: !Int [AType] !PredefinedSymbols -> !AType
buildPredefTypeApp predef_index args predefs
# {pds_ident, pds_module, pds_def} = predefs.[predef_index]
# {pds_module, pds_def} = predefs.[predef_index]
# pds_ident = predefined_idents.[predef_index]
# global_index = {glob_module = pds_module, glob_object = pds_def}
# type_symb = MakeTypeSymbIdent global_index pds_ident (length args)
= makeAType (TA type_symb args) TA_Multi
......@@ -3715,7 +3716,8 @@ where
buildPredefConsPattern :: !Int ![FreeVar] !Expression !PredefinedSymbols
-> AlgebraicPattern
buildPredefConsPattern predef_index vars expr predefs
# {pds_ident, pds_module, pds_def} = predefs.[predef_index]
# {pds_module, pds_def} = predefs.[predef_index]
# pds_ident = predefined_idents.[predef_index]
# cons_def_symbol = {
ds_ident = pds_ident,
ds_arity = length vars,
......@@ -3840,7 +3842,8 @@ buildCaseCONSExpr arg_expr cons_info_var arg_var body_expr predefs heaps
buildPredefConsApp :: !Int [Expression] !PredefinedSymbols !*Heaps
-> (!Expression, !*Heaps)
buildPredefConsApp predef_index args predefs heaps=:{hp_expression_heap}
# {pds_ident, pds_module, pds_def} = predefs.[predef_index]
# {pds_module, pds_def} = predefs.[predef_index]
# pds_ident = predefined_idents.[predef_index]
# global_index = {glob_module = pds_module, glob_object = pds_def}
# symb_ident = {
symb_name = pds_ident,
......@@ -3862,7 +3865,8 @@ buildCONS cons_info arg predefs heaps :== buildPredefConsApp PD_ConsCONS [cons_i
buildPredefFunApp :: !Int [Expression] !PredefinedSymbols !*Heaps
-> (!Expression, !*Heaps)
buildPredefFunApp predef_index args predefs heaps=:{hp_expression_heap}
# {pds_ident, pds_module, pds_def} = predefs.[predef_index]
# {pds_module, pds_def} = predefs.[predef_index]
# pds_ident = predefined_idents.[predef_index]
# global_index = {glob_module = pds_module, glob_object = pds_def}
# symb_ident = {
symb_name = pds_ident,
......@@ -3879,7 +3883,8 @@ buildIsomapIdApp predefs heaps :== buildPredefFunApp PD_isomap_ID [] predefs hea
buildIsoToSelectionExpr :: !Expression !PredefinedSymbols -> Expression
buildIsoToSelectionExpr record_expr predefs
# {pds_module, pds_def, pds_ident} = predefs . [PD_iso_to]
# {pds_module, pds_def} = predefs . [PD_iso_to]
# pds_ident = predefined_idents . [PD_iso_to]
# selector = {
glob_module = pds_module,
glob_object = {ds_ident = pds_ident, ds_index = pds_def, ds_arity = 1}}
......@@ -3887,7 +3892,8 @@ buildIsoToSelectionExpr record_expr predefs
buildIsoFromSelectionExpr :: !Expression !PredefinedSymbols -> Expression
buildIsoFromSelectionExpr record_expr predefs
# {pds_module, pds_def, pds_ident} = predefs . [PD_iso_from]
# {pds_module, pds_def} = predefs . [PD_iso_from]
# pds_ident = predefined_idents . [PD_iso_from]
# selector = {
glob_module = pds_module,
glob_object = {ds_ident = pds_ident, ds_index = pds_def, ds_arity = 1}}
......@@ -4108,7 +4114,7 @@ where
= (fresh_vars, heaps)
collect_local_vars body_expr fun_arg_vars heaps=:{hp_var_heap, hp_expression_heap}
# dummy_pds = {pds_ident=makeIdent "dummy", pds_module=NoIndex,pds_def=NoIndex}
# dummy_pds = {pds_module=NoIndex,pds_def=NoIndex}
#! cs =
{ cos_error = {ea_file = stderr, ea_ok = True, ea_loc=[]}
, cos_var_heap = hp_var_heap
......@@ -4177,7 +4183,8 @@ makeIntExpr value = BasicExpr (BVI (toString value)) BT_Int
makeStringExpr :: String !PredefinedSymbols -> Expression
makeStringExpr str predefs
#! {pds_ident, pds_module, pds_def} = predefs.[PD_StringType]
#! {pds_module, pds_def} = predefs.[PD_StringType]
#! pds_ident = predefined_idents.[PD_StringType]
#! type_symb = MakeTypeSymbIdent { glob_module = pds_module, glob_object = pds_def } pds_ident 0
= BasicExpr (BVS str) (BT_String (TA type_symb []))
......
......@@ -26,7 +26,7 @@ set_hte_mark :: !Int !*HashTable -> *HashTable
:: BoxedIdent = {boxed_ident::!Ident}
//putIdentInHashTable :: !String !IdentClass !*HashTable -> (!Ident, !*HashTable)
putIdentInHashTable :: !String !IdentClass !*HashTable -> (!BoxedIdent, !*HashTable)
putPredefinedIdentInHashTable :: !Ident !IdentClass !*HashTable -> !*HashTable
remove_icl_symbols_from_hash_table :: !*HashTable -> *HashTable
......@@ -80,29 +80,6 @@ where
char = name.[index]
= hash_value name index (val << 2 + toInt char)
/*
putIdentInHashTable :: !String !IdentClass !*HashTable -> (!Ident, !*HashTable)
putIdentInHashTable name ident_class {hte_symbol_heap,hte_entries}
# hash_val = hashValue name
(entries,hte_entries) = replace hte_entries hash_val HTE_Empty
(ident, hte_symbol_heap, entries) = insert name ident_class hte_symbol_heap entries
hte_entries = update hte_entries hash_val entries
= (ident, { hte_symbol_heap = hte_symbol_heap, hte_entries = hte_entries })
where
insert :: !String !IdentClass !*SymbolTable *HashTableEntry -> (!Ident, !*SymbolTable, !*HashTableEntry)
insert name ident_class hte_symbol_heap HTE_Empty
# (hte_symbol_ptr, hte_symbol_heap) = newPtr EmptySymbolTableEntry hte_symbol_heap
= ({ id_name = name, id_info = hte_symbol_ptr}, hte_symbol_heap, HTE_Ident name hte_symbol_ptr ident_class HTE_Empty HTE_Empty)
insert name ident_class hte_symbol_heap (HTE_Ident hte_name hte_symbol_ptr hte_class hte_left hte_right)
# cmp = (name,ident_class) =< (hte_name,hte_class)
| cmp == Equal
= ({ id_name = hte_name, id_info = hte_symbol_ptr}, hte_symbol_heap, HTE_Ident hte_name hte_symbol_ptr hte_class hte_left hte_right)
| cmp == Smaller
#! (ident, hte_symbol_heap, hte_left) = insert name ident_class hte_symbol_heap hte_left
= (ident, hte_symbol_heap, HTE_Ident hte_name hte_symbol_ptr hte_class hte_left hte_right)
#! (ident, hte_symbol_heap, hte_right) = insert name ident_class hte_symbol_heap hte_right
= (ident, hte_symbol_heap, HTE_Ident hte_name hte_symbol_ptr hte_class hte_left hte_right)
*/
putIdentInHashTable :: !String !IdentClass !*HashTable -> (!BoxedIdent, !*HashTable)
putIdentInHashTable name ident_class {hte_symbol_heap,hte_entries,hte_mark}
# hash_val = hashValue name
......@@ -115,14 +92,11 @@ where
insert name ident_class hte_mark0 hte_symbol_heap HTE_Empty
# (hte_symbol_ptr, hte_symbol_heap) = newPtr EmptySymbolTableEntry hte_symbol_heap
# ident = { id_name = name, id_info = hte_symbol_ptr}
// = ({boxed_ident=ident}, hte_symbol_heap, HTE_Ident ident ident_class hte_mark0 HTE_Empty HTE_Empty)
# boxed_ident={boxed_ident=ident}
= (boxed_ident, hte_symbol_heap, HTE_Ident boxed_ident ident_class hte_mark0 HTE_Empty HTE_Empty)
// insert name ident_class hte_mark0 hte_symbol_heap (HTE_Ident hte_ident=:{id_name,id_info} hte_class hte_mark hte_left hte_right)
insert name ident_class hte_mark0 hte_symbol_heap (HTE_Ident hte_ident=:{boxed_ident={id_name,id_info}} hte_class hte_mark hte_left hte_right)
# cmp = (name,ident_class) =< (id_name,hte_class)
| cmp == Equal
// = ({boxed_ident=hte_ident}, hte_symbol_heap, HTE_Ident hte_ident hte_class (hte_mark bitand hte_mark0) hte_left hte_right)
= (hte_ident, hte_symbol_heap, HTE_Ident hte_ident hte_class (hte_mark bitand hte_mark0) hte_left hte_right)
| cmp == Smaller
#! (boxed_ident, hte_symbol_heap, hte_left) = insert name ident_class hte_mark0 hte_symbol_heap hte_left
......@@ -130,6 +104,29 @@ where
#! (boxed_ident, hte_symbol_heap, hte_right) = insert name ident_class hte_mark0 hte_symbol_heap hte_right
= (boxed_ident, hte_symbol_heap, HTE_Ident hte_ident hte_class hte_mark hte_left hte_right)
putPredefinedIdentInHashTable :: !Ident !IdentClass !*HashTable -> !*HashTable
putPredefinedIdentInHashTable predefined_ident=:{id_name} ident_class {hte_symbol_heap,hte_entries,hte_mark}
# hash_val = hashValue id_name
(entries,hte_entries) = replace hte_entries hash_val HTE_Empty
(hte_symbol_heap, entries) = insert id_name ident_class hte_mark hte_symbol_heap entries
hte_entries = update hte_entries hash_val entries
= { hte_symbol_heap = hte_symbol_heap, hte_entries = hte_entries,hte_mark=hte_mark }
where
insert :: !String !IdentClass !Int !*SymbolTable *HashTableEntry -> (!*SymbolTable, !*HashTableEntry)
insert name ident_class hte_mark0 hte_symbol_heap HTE_Empty
# hte_symbol_heap = writePtr predefined_ident.id_info EmptySymbolTableEntry hte_symbol_heap
# boxed_ident={boxed_ident=predefined_ident}
= (hte_symbol_heap, HTE_Ident boxed_ident ident_class hte_mark0 HTE_Empty HTE_Empty)
insert name ident_class hte_mark0 hte_symbol_heap (HTE_Ident hte_ident=:{boxed_ident={id_name,id_info}} hte_class hte_mark hte_left hte_right)
# cmp = (name,ident_class) =< (id_name,hte_class)
| cmp == Equal
= (hte_symbol_heap, HTE_Ident hte_ident hte_class (hte_mark bitand hte_mark0) hte_left hte_right)
| cmp == Smaller
#! (hte_symbol_heap, hte_left) = insert name ident_class hte_mark0 hte_symbol_heap hte_left
= (hte_symbol_heap, HTE_Ident hte_ident hte_class hte_mark hte_left hte_right)
#! (hte_symbol_heap, hte_right) = insert name ident_class hte_mark0 hte_symbol_heap hte_right
= (hte_symbol_heap, HTE_Ident hte_ident hte_class hte_mark hte_left hte_right)
remove_icl_symbols_from_hash_table :: !*HashTable -> *HashTable
remove_icl_symbols_from_hash_table hash_table=:{hte_entries}
# hte_entries=remove_icl_symbols_from_array 0 hte_entries
......
......@@ -376,12 +376,12 @@ where
# index=glob_object.ds_index+FirstConstructorPredefinedSymbolIndex
| index==PD_OverloadedConsSymbol
# new_cons_index=pd_cons_symbol-FirstConstructorPredefinedSymbolIndex
# new_cons_ident=cons_and_nil_idents.[new_cons_index]
# new_cons_ident=predefined_idents.[pd_cons_symbol]
# glob_object = {glob_object & ds_index=new_cons_index,ds_ident=new_cons_ident}
= {pattern & ap_symbol.glob_object=glob_object}
| index==PD_OverloadedNilSymbol
# new_nil_index=pd_nil_symbol-FirstConstructorPredefinedSymbolIndex
# new_nil_ident=cons_and_nil_idents.[new_nil_index]
# new_nil_ident=predefined_idents.[pd_nil_symbol]
# glob_object = {glob_object & ds_index=new_nil_index,ds_ident=new_nil_ident}
= {pattern & ap_symbol.glob_object=glob_object}
= abort "replace_overloaded_symbol_in_pattern"
......
......@@ -1636,7 +1636,8 @@ where
getSymbol :: !Int !(!(Global !Int) -> !SymbKind) !Int !*UpdateInfo -> (SymbIdent,*UpdateInfo)
getSymbol index symb_kind arity ui=:{ui_x}
# ({pds_module, pds_def, pds_ident}, ui_x) = ui_x!x_predef_symbols.[index]
# ({pds_module, pds_def}, ui_x) = ui_x!x_predef_symbols.[index]
# pds_ident = predefined_idents.[index]
symbol = { symb_name = pds_ident, symb_kind = symb_kind { glob_module = pds_module, glob_object = pds_def}, symb_arity = arity }
= (symbol, { ui & ui_x = ui_x})
......
......@@ -10,5 +10,5 @@ import syntax, hashtable, scanner, predef
cWantIclFile :== True
cWantDclFile :== False
wantModule :: !Bool !Ident !Position !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols (ModTimeFunction *Files) !*Files
-> (!Bool, !ParsedModule, !*HashTable, !*File, !*PredefinedSymbols, !*Files)
wantModule :: !Bool !Ident !Position !Bool !*HashTable !*File !SearchPaths (ModTimeFunction *Files) !*Files
-> (!Bool, !ParsedModule, !*HashTable, !*File, !*Files)
This diff is collapsed.
......@@ -4,5 +4,5 @@ import StdEnv
import syntax, parse, predef
scanModule :: !ParsedModule ![Ident] !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols (ModTimeFunction *Files) !*Files
-> (!Bool, !ScannedModule, !IndexRange, ![FunDef], !Optional ScannedModule, ![ScannedModule],!Int,!Int,!*HashTable, !*File, !*PredefinedSymbols, !*Files)
scanModule :: !ParsedModule ![Ident] !Bool !*HashTable !*File !SearchPaths (ModTimeFunction *Files) !*Files
-> (!Bool, !ScannedModule, !IndexRange, ![FunDef], !Optional ScannedModule, ![ScannedModule],!Int,!Int,!*HashTable, !*File, !*Files)
This diff is collapsed.
......@@ -6,10 +6,9 @@ cPredefinedModuleIndex :== 1
:: PredefinedSymbols :== {# PredefinedSymbol}