diff options
author | ronny | 2001-10-05 07:34:56 +0000 |
---|---|---|
committer | ronny | 2001-10-05 07:34:56 +0000 |
commit | c27f421f367a4bc2135e89eba1267af10d339024 (patch) | |
tree | ba1696088a5db21107fb8dfd432569b4667f1cf4 /backend/backendconvert.icl | |
parent | fail explicit cases (diff) |
bind special idents (such as abort, undef from StdMisc) to the correct identifiers
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@828 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backend/backendconvert.icl')
-rw-r--r-- | backend/backendconvert.icl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/backend/backendconvert.icl b/backend/backendconvert.icl index bea9282..1a5dbdf 100644 --- a/backend/backendconvert.icl +++ b/backend/backendconvert.icl @@ -363,6 +363,10 @@ beNoUniVarEquations :== beFunction0 BENoUniVarEquations beUniVarEquationsList :== beFunction2 BEUniVarEquationsList +beBindSpecialModule specialIdentIndex moduleIndex + :== beApFunction0 (BEBindSpecialModule specialIdentIndex moduleIndex) +beBindSpecialFunction specialIdentIndex functionIndex moduleIndex + :== beApFunction0 (BEBindSpecialFunction specialIdentIndex functionIndex moduleIndex) // temporary hack beDynamicTempTypeSymbol @@ -483,6 +487,7 @@ backEndConvertModulesH predefs {fe_icl = with dcl_common = currentDcl.dcl_common + # backEnd = bindSpecialIdents predefs icl_used_module_numbers backEnd #! backEnd = removeExpandedTypesFromDclModules fe_dcls icl_used_module_numbers backEnd = (backEnd -*-> "backend done") where @@ -1076,6 +1081,47 @@ predefineSymbols {dcl_common} predefs // ... sanity check = appBackEnd (BEPredefineConstructorSymbol arity predefs.[index].pds_def cPredefinedModuleIndex symbolKind) + +bindSpecialIdents :: PredefinedSymbols NumberSet -> BackEnder +bindSpecialIdents predefs usedModules + = foldState (bindSpecialModule predefs usedModules) specialModules + where + bindSpecialModule :: PredefinedSymbols NumberSet (Int, BESpecialIdentIndex, [(Int, BESpecialIdentIndex)]) -> BackEnder + bindSpecialModule predefs usedModules (predefIndex, specialIdentIndex, specialFunctions) + | moduleIndex == NoIndex || not (inNumberSet moduleIndex usedModules) + = identity + // otherwise + = beBindSpecialModule specialIdentIndex moduleIndex + o` foldState (bindSpecialFunction predefs) specialFunctions + where + predef + = predefs.[predefIndex] + moduleIndex + = predef.pds_def + + bindSpecialFunction :: PredefinedSymbols (Int, BESpecialIdentIndex) -> BackEnder + bindSpecialFunction predefs (predefIndex, specialIdentIndex) + | predef.pds_def == NoIndex + = identity + // otherwise + = beBindSpecialFunction specialIdentIndex predef.pds_def predef.pds_module + where + predef + = predefs.[predefIndex] + + specialModules + = [ (PD_StdMisc, BESpecialIdentStdMisc, + [ (PD_abort, BESpecialIdentAbort) + , (PD_undef, BESpecialIdentUndef) + ] + ) + , (PD_StdBool, BESpecialIdentStdBool, + [ (PD_AndOp, BESpecialIdentAnd) + , (PD_OrOp, BESpecialIdentOr) + ] + ) + ] + adjustStrictListFunctions :: [Int] [Int] {#PredefinedSymbol} {#DclModule} NumberSet Int *BackEndState -> *BackEndState; adjustStrictListFunctions list_first_instance_indices tail_strict_list_first_instance_indices predefs dcls used_module_numbers main_dcl_module_n backEnd | std_strict_list_module_index==NoIndex || not (inNumberSet std_strict_list_module_index used_module_numbers) |