Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
e4ea68cd
Commit
e4ea68cd
authored
Sep 19, 2002
by
Ronny Wichers Schreur
🏢
Browse files
major rewrite dynamics
parent
e5c806d3
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
backend/backendconvert.icl
View file @
e4ea68cd
...
...
@@ -916,7 +916,7 @@ convertSelector moduleIndex selectorDefs is_strict {fs_index}
declareDynamicTemp
::
PredefinedSymbols
->
BackEnder
declareDynamicTemp
predefs
=
appBackEnd
(
BEDeclareDynamicTypeSymbol
predefs
.[
PD_StdDynamic
].
pds_def
predefs
.[
PD_DynamicTemp
].
pds_def
)
=
appBackEnd
(
BEDeclareDynamicTypeSymbol
predefs
.[
PD_StdDynamic
].
pds_def
predefs
.[
PD_
Dyn_
DynamicTemp
].
pds_def
)
predefineSymbols
::
DclModule
PredefinedSymbols
->
BackEnder
predefineSymbols
{
dcl_common
}
predefs
...
...
@@ -1693,7 +1693,8 @@ convertRootExpr aliasDummyId (Case kees=:{case_expr, case_guards}) main_dcl_modu
Yes
ident
->
DefaultCaseFail
ident
_
->
abort
"backendconvert:defaultCase, case without id"
->
DefaultCaseFail
{
id_name
=
"kees_be"
,
id_info
=
nilPtr
}
// -> abort "backendconvert:defaultCase, case without id"
// otherwise
=
DefaultCaseNone
convertRootExpr
_
(
FailExpr
fail_ident
)
_
...
...
@@ -1826,6 +1827,8 @@ where
=
beFunctionSymbol
glob_object
glob_module
convertSymbol
{
symb_kind
=
SK_LocalMacroFunction
glob_object
}
=
beFunctionSymbol
glob_object
main_dcl_module_n
convertSymbol
{
symb_kind
=
SK_GeneratedCaseFunction
_
index
}
=
beFunctionSymbol
index
main_dcl_module_n
convertSymbol
{
symb_kind
=
SK_GeneratedFunction
_
index
}
=
beFunctionSymbol
index
main_dcl_module_n
convertSymbol
{
symb_kind
=
SK_GeneratedCaseFunction
_
index
}
...
...
frontend/check.icl
View file @
e4ea68cd
...
...
@@ -2453,7 +2453,8 @@ check_module2 mod_name mod_modification_time mod_imported_objects mod_imports mo
(
x_main_dcl_module
,
cs
)
=
cs
!
cs_x
.
x_main_dcl_module_n
cs
=
cs
<=<
adjustPredefSymbol
PD_ModuleConsSymbol
x_main_dcl_module
STE_Constructor
<=<
adjustPredefSymbol
PD_ModuleConsSymbol
x_main_dcl_module
STE_Constructor
(
dcl_modules
,
icl_functions
,
macro_defs
,
hp_expression_heap
,
cs
)
=
checkExplicitImportCompleteness
imports
.
si_explicit
dcl_modules
icl_functions
macro_defs
heaps
.
hp_expression_heap
cs
...
...
@@ -3387,19 +3388,19 @@ where
#
(
pre_mod
,
cs_predef_symbols
)
=
cs_predef_symbols
![
PD_StdDynamic
]
|
pre_mod
.
pds_def
==
mod_index
=
(
class_members
,
class_instances
,
fun_types
,
{
cs
&
cs_predef_symbols
=
cs_predef_symbols
}
<=<
adjustPredefSymbol
PD_
TypeObjectType
mod_index
STE_Type
<=<
adjustPredefSymbol
PD_
TypeConsSymbol
mod_index
STE_
Constructor
<=<
adjustPredefSymbol
PD_
PV_Placeholder
mod_index
STE_Constructor
<=<
adjustPredefSymbol
PD_
UPV_Placeholder
mod_index
STE_Constructor
<=<
adjustPredefSymbol
PD_
UV_Placeholder
mod_index
STE_Constructor
<=<
adjustPredefSymbol
PD_
unify
mod_index
STE_
DclFunction
<=<
adjustPredefSymbol
PD_
coerce
mod_index
STE_
DclFunction
<=<
adjustPredefSymbol
PD_
undo_indirections
mod_index
STE_
DclFunction
<=<
adjustPredefSymbol
PD_Dyn
amicTemp
mod_index
STE_
Type
<=<
adjustPredefSymbol
PD_Dyn
amicType
mod_index
(
STE_
Field
unused
)
<=<
adjustPredefSymbol
PD_Dyn
amicValue
mod_index
(
STE_
Field
unused
)
<=<
adjustPredefSymbol
PD_
TypeID
mod_index
STE_
Type
<=<
adjustPredefSymbol
PD_ModuleID
mod_index
STE_Constructor
)
<=<
adjustPredefSymbol
PD_
Dyn_DynamicTemp
mod_index
STE_Type
<=<
adjustPredefSymbol
PD_
Dyn_Type
mod_index
STE_
Type
<=<
adjustPredefSymbol
PD_
Dyn_TypeScheme
mod_index
STE_Constructor
<=<
adjustPredefSymbol
PD_
Dyn_TypeApp
mod_index
STE_Constructor
<=<
adjustPredefSymbol
PD_
Dyn_TypeVar
mod_index
STE_Constructor
<=<
adjustPredefSymbol
PD_
Dyn_TypePatternVar
mod_index
STE_
Constructor
<=<
adjustPredefSymbol
PD_
Dyn_ModuleID
mod_index
STE_
Constructor
<=<
adjustPredefSymbol
PD_
Dyn_Unifier
mod_index
STE_
Type
<=<
adjustPredefSymbol
PD_Dyn
_unify
mod_index
STE_
DclFunction
<=<
adjustPredefSymbol
PD_Dyn
_initial_unifier
mod_index
STE_
DclFunction
<=<
adjustPredefSymbol
PD_Dyn
_normalise
mod_index
STE_
DclFunction
<=<
adjustPredefSymbol
PD_
Dyn_bind_global_type_pattern_var
mod_index
STE_
DclFunction
)
#
(
pre_mod
,
cs_predef_symbols
)
=
cs_predef_symbols
![
PD_StdGeneric
]
#
type_bimap
=
predefined_idents
.[
PD_TypeBimap
]
|
pre_mod
.
pds_def
==
mod_index
...
...
frontend/compilerSwitches.dcl
View file @
e4ea68cd
...
...
@@ -7,7 +7,7 @@ switch_import_syntax one_point_three two_point_zero :== two_point_zero
SwitchPreprocessor
preprocessor
no_preprocessor
:==
preprocessor
SwitchGenerics
on
off
:==
o
ff
SwitchGenerics
on
off
:==
o
n
SwitchGenericInfo
on
off
:==
on
// MV...
...
...
@@ -16,5 +16,5 @@ SwitchGenericInfo on off :== on
USE_DummyModuleName
yes
no
:==
yes
switch_dynamics
on
off
:==
o
ff
;
// to turn dynamics on or off
switch_dynamics
on
off
:==
o
n
;
// to turn dynamics on or off
// ...MV
frontend/compilerSwitches.icl
View file @
e4ea68cd
...
...
@@ -7,7 +7,7 @@ switch_import_syntax one_point_three two_point_zero :== two_point_zero
SwitchPreprocessor
preprocessor
no_preprocessor
:==
preprocessor
SwitchGenerics
on
off
:==
o
ff
SwitchGenerics
on
off
:==
o
n
SwitchGenericInfo
on
off
:==
on
// MV...
...
...
@@ -16,5 +16,5 @@ SwitchGenericInfo on off :== on
USE_DummyModuleName
yes
no
:==
yes
switch_dynamics
on
off
:==
o
ff
;
// to turn dynamics on or off
switch_dynamics
on
off
:==
o
n
;
// to turn dynamics on or off
// ...MV
frontend/convertDynamics.dcl
View file @
e4ea68cd
...
...
@@ -3,16 +3,8 @@
*/
definition
module
convertDynamics
import
syntax
,
transform
,
convertcases
import
syntax
,
transform
convertDynamicPatternsIntoUnifyAppls
::
{!
GlobalTCType
}
!{#
CommonDefs
}
!
Int
!*{!
Group
}
!*{#
FunDef
}
!*
PredefinedSymbols
!*
VarHeap
!*
TypeHeaps
!*
ExpressionHeap
(
Optional
*
File
)
{#
DclModule
}
!
IclModule
/* TD */
[
String
]
->
(!*{!
Group
},
!*{#
FunDef
},
!*
PredefinedSymbols
,
!*{#{#
CheckedTypeDef
}},
!
ImportedConstructors
,
!*
VarHeap
,
!*
TypeHeaps
,
!*
ExpressionHeap
,
Optional
*
File
)
/*
convertDynamicPatternsIntoUnifyAppls :: {! GlobalTCType} !{# CommonDefs} !*{! Group} !*{#FunDef} !*PredefinedSymbols
!*{#{# CheckedTypeDef}} !ImportedConstructors !*VarHeap !*TypeHeaps !*ExpressionHeap
-> (!*{! Group}, !*{#FunDef}, !*PredefinedSymbols, !*{#{# CheckedTypeDef}}, !ImportedConstructors, !*VarHeap, !*TypeHeaps, !*ExpressionHeap)
*/
get_module_id_app
::
!*
PredefinedSymbols
->
(
App
,
Expression
,!*
PredefinedSymbols
)
frontend/convertDynamics.icl
View file @
e4ea68cd
This diff is collapsed.
Click to expand it.
frontend/overloading.icl
View file @
e4ea68cd
...
...
@@ -1093,8 +1093,9 @@ where
|
isEmpty
fi_dynamics
=
update_dynamics
funs
type_pattern_vars
fun_defs
fun_env
symbol_heap
type_code_info
var_heap
error
predef_symbols
// MV ...
#
(_,
module_id_app
,
predef_symbols
)
=
get_module_id_app
predef_symbols
// # (_,module_id_app,predef_symbols)
// = get_module_id_app predef_symbols
#
module_id_app
=
undef
// ... MV
#
(
type_code_info
,
symbol_heap
,
type_pattern_vars
,
var_heap
,
error
)
=
convertDynamicTypes
fi_dynamics
(
type_code_info
,
symbol_heap
,
type_pattern_vars
,
var_heap
,
error
)
...
...
@@ -1107,6 +1108,7 @@ where
=
updateExpression
fi_group_index
tb
.
tb_rhs
{
ui_instance_calls
=
[],
ui_symbol_heap
=
symbol_heap
,
ui_fun_defs
=
fun_defs
,
ui_local_vars
=
fi_local_vars
,
ui_fun_env
=
fun_env
,
ui_var_heap
=
var_heap
,
ui_error
=
error
,
ui_has_type_codes
=
False
,
// MV ...
ui_x
=
{
x_type_code_info
=
type_code_info
,
x_predef_symbols
=
predef_symbols
,
x_main_dcl_module_n
=
main_dcl_module_n
,
x_internal_type_id
=
module_id_app
,
x_module_id
=
No
}}
// ... MV
...
...
@@ -1149,8 +1151,9 @@ where
remove_overloaded_function
type_pattern_vars
fun_index
(
ok
,
fun_defs
,
fun_env
,
symbol_heap
,
type_code_info
,
var_heap
,
error
,
predef_symbols
)
|
ok
// MV ...
#
(_,
module_id_app
,
predef_symbols
)
=
get_module_id_app
predef_symbols
// # (_,module_id_app,predef_symbols)
// = get_module_id_app predef_symbols
#
module_id_app
=
undef
// ... MV
#
(
fun_def
,
fun_defs
)
=
fun_defs
![
fun_index
]
(
CheckedType
st
=:{
st_context
},
fun_env
)
=
fun_env
![
fun_index
]
...
...
@@ -1165,18 +1168,27 @@ where
=
updateExpression
fun_info
.
fi_group_index
tb_rhs
{
ui_instance_calls
=
[],
ui_local_vars
=
fun_info
.
fi_local_vars
,
ui_symbol_heap
=
symbol_heap
,
ui_var_heap
=
var_heap
,
ui_fun_defs
=
fun_defs
,
ui_fun_env
=
fun_env
,
ui_error
=
error
,
// MV ...
ui_has_type_codes
=
False
,
ui_x
=
{
x_type_code_info
=
type_code_info
,
x_predef_symbols
=
predef_symbols
,
x_main_dcl_module_n
=
main_dcl_module_n
,
x_internal_type_id
=
module_id_app
,
x_module_id
=
No
}}
#
(
tb_rhs
,
{
ui_instance_calls
,
ui_local_vars
,
ui_symbol_heap
,
ui_var_heap
,
ui_fun_defs
,
ui_fun_env
,
ui_error
,
ui_x
=
{
x_type_code_info
=
type_code_info
,
x_predef_symbols
=
predef_symbols
}})
#
(
tb_rhs
,
{
ui_instance_calls
,
ui_local_vars
,
ui_symbol_heap
,
ui_var_heap
,
ui_fun_defs
,
ui_fun_env
,
ui_has_type_codes
,
ui_error
,
ui_x
=
{
x_type_code_info
=
type_code_info
,
x_predef_symbols
=
predef_symbols
}})
=
build_type_identification
tb_rhs
ui
#
// ... MV
(
tb_args
,
var_heap
)
=
foldSt
retrieve_class_argument
rev_variables
(
tb_args
,
ui_var_heap
)
fun_info
=
mark_type_codes
ui_has_type_codes
fun_info
fun_def
=
{
fun_def
&
fun_body
=
TransformedBody
{
tb_args
=
tb_args
,
tb_rhs
=
tb_rhs
},
fun_arity
=
length
tb_args
,
fun_info
=
{
fun_info
&
fi_calls
=
fun_info
.
fi_calls
++
ui_instance_calls
,
fi_local_vars
=
ui_local_vars
}
}
#!
ok
=
ui_error
.
ea_ok
=
(
ok
,
{
ui_fun_defs
&
[
fun_index
]
=
fun_def
},
ui_fun_env
,
ui_symbol_heap
,
type_code_info
,
var_heap
,
ui_error
,
predef_symbols
)
=
(
False
,
fun_defs
,
fun_env
,
symbol_heap
,
type_code_info
,
var_heap
,
error
,
predef_symbols
)
where
// this is a ugly way to mark this function for conversion in convertDynamics
// FIXME: find a better way to mark the function
mark_type_codes
True
info
=:{
fi_dynamics
=[]}
=
{
info
&
fi_dynamics
=
[
nilPtr
]}
mark_type_codes
_
info
=
info
determine_class_argument
{
tc_class
,
tc_var
}
(
variables
,
var_heap
)
#
(
var_info
,
var_heap
)
=
readPtr
tc_var
var_heap
...
...
@@ -1375,6 +1387,7 @@ where
,
ui_fun_defs
::
!.{#
FunDef
}
,
ui_fun_env
::
!.{!
FunctionType
}
,
ui_error
::
!.
ErrorAdmin
,
ui_has_type_codes
::
!
Bool
,
ui_x
::
!.
UpdateInfoX
}
...
...
@@ -1533,9 +1546,7 @@ where
#
(
dyn_expr
,
ui
)
=
updateExpression
group_index
dyn_expr
ui
(
EI_TypeOfDynamic
uni_vars
type_code
,
ui_symbol_heap
)
=
readPtr
dyn_info_ptr
ui
.
ui_symbol_heap
ui
=
{
ui
&
ui_symbol_heap
=
ui_symbol_heap
}
|
isEmpty
uni_vars
=
(
DynamicExpr
{
dyn
&
dyn_expr
=
dyn_expr
,
dyn_type_code
=
type_code
},
ui
)
=
(
DynamicExpr
{
dyn
&
dyn_expr
=
dyn_expr
,
dyn_type_code
=
TCE_UniType
uni_vars
type_code
},
ui
)
=
(
DynamicExpr
{
dyn
&
dyn_expr
=
dyn_expr
,
dyn_type_code
=
type_code
},
ui
)
updateExpression
group_index
(
MatchExpr
cons_symbol
expr
)
ui
#
(
expr
,
ui
)
=
updateExpression
group_index
expr
ui
=
(
MatchExpr
cons_symbol
expr
,
ui
)
...
...
@@ -1645,137 +1656,8 @@ where
adjustClassExpression
symb_name
(
Selection
opt_type
expr
selectors
)
ui
#
(
expr
,
ui
)
=
adjustClassExpression
symb_name
expr
ui
=
(
Selection
opt_type
expr
selectors
,
ui
)
adjustClassExpression
symb_name
(
TypeCodeExpression
type_code_expression
)
ui
=
convertTypecode
type_code_expression
ui
where
convertTypecode
TCE_Empty
ui
=
(
EE
,
ui
)
convertTypecode
(
TCE_Var
var_info_ptr
)
ui
=
(
Var
{
var_name
=
a_ij_var_name
,
var_info_ptr
=
var_info_ptr
,
var_expr_ptr
=
nilPtr
},
ui
)
convertTypecode
(
TCE_TypeTerm
var_info_ptr
)
ui
=:{
ui_var_heap
,
ui_error
}
#
(
var_info_ptr
,
(
ui_var_heap
,
ui_error
))
=
getTCDictionary
symb_name
var_info_ptr
(
ui_var_heap
,
ui_error
)
=
(
Var
{
var_name
=
v_tc_name
,
var_info_ptr
=
var_info_ptr
,
var_expr_ptr
=
nilPtr
},
{
ui
&
ui_var_heap
=
ui_var_heap
,
ui_error
=
ui_error
})
// MV ...
convertTypecode
(
TCE_Constructor
index
typecode_exprs
)
ui
=:{
ui_x
={
x_internal_type_id
,
x_type_code_info
={
tci_type_constructors_in_patterns
}
}}
#
ui
=
{
ui
&
ui_x
.
x_type_code_info
.
tci_type_constructors_in_patterns
=
[
index
:
tci_type_constructors_in_patterns
]
}
#
(
typecons_symb
,
ui
)
=
getSymbol
PD_TypeConsSymbol
SK_Constructor
ui
(
constructor
,
ui
)
=
get_constructor
index
ui
(
typecode_exprs
,
ui
)
=
convertTypecodes
typecode_exprs
ui
#
(
ui_internal_type_id
,
ui
)
=
get_module_id
ui
=
(
App
{
app_symb
=
typecons_symb
,
app_args
=
USE_DummyModuleName
[
constructor
,
ui_internal_type_id
,
typecode_exprs
]
[
constructor
,
typecode_exprs
]
,
app_info_ptr
=
nilPtr
},
ui
)
where
get_module_id
ui
=:{
ui_x
={
x_module_id
=
Yes
{
lb_dst
}}}
=
(
Var
(
freeVarToVar
lb_dst
),
ui
)
get_module_id
ui
#
(
dst
=:{
var_info_ptr
},
ui
)
=
newVariable
"module_id"
VI_Empty
ui
#
dst_fv
=
varToFreeVar
dst
1
#
let_bind
=
{
lb_src
=
x_internal_type_id
,
lb_dst
=
dst_fv
,
lb_position
=
NoPos
}
#
ui
=
{
ui
&
ui_local_vars
=
[
dst_fv
:
ui
.
ui_local_vars
]
,
ui_x
=
{
ui
.
ui_x
&
x_module_id
=
Yes
let_bind
}
}
=
(
Var
dst
,
ui
)
freeVarToVar
::
FreeVar
->
BoundVar
freeVarToVar
{
fv_name
,
fv_info_ptr
}
=
{
var_name
=
fv_name
,
var_info_ptr
=
fv_info_ptr
,
var_expr_ptr
=
nilPtr
}
newVariable
::
String
!
VarInfo
!*
UpdateInfo
->
*(!
BoundVar
,!*
UpdateInfo
)
newVariable
var_name
var_info
ui
=:{
ui_var_heap
}
#
(
var_info_ptr
,
ui_var_heap
)
=
newPtr
var_info
ui_var_heap
=
(
{
var_name
=
{
id_name
=
var_name
,
id_info
=
nilPtr
},
var_info_ptr
=
var_info_ptr
,
var_expr_ptr
=
nilPtr
},
{
ui
&
ui_var_heap
=
ui_var_heap
})
// ... MV
convertTypecode
(
TCE_Selector
selections
var_info_ptr
)
ui
=
(
Selection
NormalSelector
(
Var
{
var_name
=
a_ij_var_name
,
var_info_ptr
=
var_info_ptr
,
var_expr_ptr
=
nilPtr
})
selections
,
ui
)
convertTypecode
(
TCE_UniType
uni_vars
type_code
)
ui
#
(
let_binds
,
ui
)
=
createUniversalVariables
uni_vars
ui
(
let_expr
,
ui
)
=
convertTypecode
type_code
ui
(
let_info_ptr
,
ui
)
=
let_ptr
(
length
let_binds
)
ui
=
(
Let
{
let_strict_binds
=
[]
,
let_lazy_binds
=
let_binds
,
let_expr
=
let_expr
,
let_info_ptr
=
let_info_ptr
,
let_expr_position
=
NoPos
},
ui
)
convertTypecodes
[]
ui
#
(
nil_symb
,
ui
)
=
getSymbol
PD_NilSymbol
SK_Constructor
ui
=
(
App
{
app_symb
=
nil_symb
,
app_args
=
[],
app_info_ptr
=
nilPtr
},
ui
)
convertTypecodes
[
typecode_expr
:
typecode_exprs
]
ui
#
(
cons_symb
,
ui
)
=
getSymbol
PD_ConsSymbol
SK_Constructor
ui
(
expr
,
ui
)
=
convertTypecode
typecode_expr
ui
(
exprs
,
ui
)
=
convertTypecodes
typecode_exprs
ui
=
(
App
{
app_symb
=
cons_symb
,
app_args
=
[
expr
,
exprs
],
app_info_ptr
=
nilPtr
},
ui
)
createUniversalVariables
var_info_ptrs
ui
=
createVariables2
True
var_info_ptrs
ui
createVariables2
generate_universal_placeholders
var_info_ptrs
ui
=
mapSt
create_variable
var_info_ptrs
ui
where
create_variable
var_info_ptr
ui
#
(
placeholder_symb
,
ui
)
=
getSymbol
PD_UPV_Placeholder
SK_Constructor
ui
cyclic_var
=
{
var_name
=
v_tc_name
,
var_info_ptr
=
var_info_ptr
,
var_expr_ptr
=
nilPtr
}
cyclic_fv
=
varToFreeVar
cyclic_var
1
=
({
lb_src
=
App
{
app_symb
=
placeholder_symb
,
app_args
=
[
Var
cyclic_var
,
Var
cyclic_var
],
app_info_ptr
=
nilPtr
},
lb_dst
=
varToFreeVar
cyclic_var
1
,
lb_position
=
NoPos
},
{
ui
&
ui_local_vars
=
[
cyclic_fv
:
ui
.
ui_local_vars
]})
getSymbol
::
!
Int
!((
Global
Int
)
->
SymbKind
)
!*
UpdateInfo
->
(
SymbIdent
,*
UpdateInfo
)
getSymbol
index
symb_kind
ui
=:{
ui_x
}
#
({
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
}
}
=
(
symbol
,
{
ui
&
ui_x
=
ui_x
})
get_constructor
::
!
Int
!*
UpdateInfo
->
(!
Expression
,!*
UpdateInfo
)
get_constructor
index
ui
=:{
ui_x
=
{
x_type_code_info
={
tci_instances
}}}
/*
** MV
** Inefficiency. The correct gtci_type referred to by index has to be selected from the list of
** instances (tci_instances). A rather inefficient linear search is used to look up the type. It
** is a temporary solution.
*/
#
tci_instance
=
filter
(\{
gtci_index
}
->
gtci_index
==
index
)
tci_instances
// {createArray ? GTT_Function & [gtci_index] = gtci_type \\ {gtci_index, gtci_type} <- tci_instances}
|
isEmpty
tci_instance
=
abort
"get_constructor (overloading.icl): internal error"
#
tci_instance
=
(
hd
tci_instance
).
gtci_type
// tci_instances.[index]
#
cons_expr
=
BasicExpr
(
BVS
(
"
\"
"
+++
toString
tci_instance
+++
"
\"
"
))
=
(
cons_expr
,
ui
)
a_ij_var_name
=
{
id_name
=
"a_ij"
,
id_info
=
nilPtr
}
v_tc_name
=
{
id_name
=
"overloadingvTC"
,
id_info
=
nilPtr
}
varToFreeVar
::
BoundVar
Int
->
FreeVar
varToFreeVar
{
var_name
,
var_info_ptr
}
count
=
{
fv_def_level
=
NotALevel
,
fv_name
=
var_name
,
fv_info_ptr
=
var_info_ptr
,
fv_count
=
count
}
adjustClassExpression
symb_name
tce
=:(
TypeCodeExpression
_)
ui
=
(
tce
,
{
ui
&
ui_has_type_codes
=
True
})
adjustClassExpression
symb_name
(
Let
this_let
=:{
let_strict_binds
,
let_lazy_binds
,
let_expr
})
ui
#
(
let_strict_binds
,
ui
)
=
adjust_let_binds
symb_name
let_strict_binds
ui
(
let_lazy_binds
,
ui
)
=
adjust_let_binds
symb_name
let_lazy_binds
ui
...
...
frontend/predef.dcl
View file @
e4ea68cd
...
...
@@ -69,9 +69,10 @@ PD_TypeVar_a31 :== 119
/* Dynamics */
PD_TypeCodeMember
:==
120
PD_DynamicTemp
:==
121
PD_DynamicValue
:==
122
PD_DynamicType
:==
123
PD_TypeCodeClass
:==
121
PD_Dyn_bind_global_type_pattern_var
:==
122
PD_Dyn_ModuleID
:==
123
/* identifiers present in the hashtable */
...
...
@@ -138,19 +139,18 @@ PD_UTSListClass :== 163
PD_StdDynamic
:==
164
PD_TypeCodeClass
:==
165
PD_TypeObjectType
:==
166
PD_TypeConsSymbol
:==
167
PD_unify
:==
168
PD_coerce
:==
169
PD_PV_Placeholder
:==
170
// Pattern variable (occurs only in pattern)
PD_UPV_Placeholder
:==
171
// Universal Pattern Variable (occurs only in pattern; universally quantified variable)
PD_UV_Placeholder
:==
172
// Universal Variable (occurs only in dynamic; universally quantified variable)
PD_undo_indirections
:==
173
PD_TypeID
:==
174
PD_ModuleID
:==
175
PD_ModuleConsSymbol
:==
176
PD_Dyn_DynamicTemp
:==
165
PD_Dyn_Type
:==
166
PD_Dyn_TypeScheme
:==
167
PD_Dyn_TypeApp
:==
168
PD_Dyn_TypeVar
:==
169
PD_Dyn_TypePatternVar
:==
170
PD_Dyn_TypeCons
:==
171
PD_Dyn_tc_name
:==
172
PD_Dyn_Unifier
:==
173
PD_Dyn_unify
:==
174
PD_Dyn_initial_unifier
:==
175
PD_Dyn_normalise
:==
176
/* Generics */
PD_StdGeneric
:==
177
...
...
@@ -202,7 +202,9 @@ PD_bimapId :== 216
PD_TypeGenericDict
:==
217
PD_NrOfPredefSymbols
:==
218
PD_ModuleConsSymbol
:==
218
PD_NrOfPredefSymbols
:==
219
GetTupleConsIndex
tup_arity
:==
PD_Arity2TupleSymbol
+
tup_arity
-
2
GetTupleTypeIndex
tup_arity
:==
PD_Arity2TupleType
+
tup_arity
-
2
...
...
@@ -219,10 +221,6 @@ buildPredefinedModule :: !*PredefinedSymbols -> (!ScannedModule, !.PredefinedSym
// changes requires recompile of {static,dynamic}-linker plus all dynamics ever made
UnderscoreSystemDynamicModule_String
:==
"_SystemDynamic"
DynamicRepresentation_String
:==
"DynamicTemp"
T_ypeObjectTypeRepresentation_String
:==
"T_ypeObjectType"
// List-type
PD_ListType_String
:==
"_List"
PD_ConsSymbol_String
:==
"_Cons"
...
...
frontend/predef.icl
View file @
e4ea68cd
...
...
@@ -69,9 +69,10 @@ PD_TypeVar_a31 :== 119
/* Dynamics */
PD_TypeCodeMember
:==
120
PD_DynamicTemp
:==
121
PD_DynamicValue
:==
122
PD_DynamicType
:==
123
PD_TypeCodeClass
:==
121
PD_Dyn_bind_global_type_pattern_var
:==
122
PD_Dyn_ModuleID
:==
123
/* identifiers present in the hashtable */
...
...
@@ -138,19 +139,18 @@ PD_UTSListClass :== 163
PD_StdDynamic
:==
164
PD_TypeCodeClass
:==
165
PD_TypeObjectType
:==
166
PD_TypeConsSymbol
:==
167
PD_unify
:==
168
PD_coerce
:==
169
PD_PV_Placeholder
:==
170
// Pattern variable (occurs only in pattern)
PD_UPV_Placeholder
:==
171
// Universal Pattern Variable (occurs only in pattern; universally quantified variable)
PD_UV_Placeholder
:==
172
// Universal Variable (occurs only in dynamic; universally quantified variable)
PD_undo_indirections
:==
173
PD_TypeID
:==
174
PD_ModuleID
:==
175
PD_ModuleConsSymbol
:==
176
PD_Dyn_DynamicTemp
:==
165
PD_Dyn_Type
:==
166
PD_Dyn_TypeScheme
:==
167
PD_Dyn_TypeApp
:==
168
PD_Dyn_TypeVar
:==
169
PD_Dyn_TypePatternVar
:==
170
PD_Dyn_TypeCons
:==
171
PD_Dyn_tc_name
:==
172
PD_Dyn_Unifier
:==
173
PD_Dyn_unify
:==
174
PD_Dyn_initial_unifier
:==
175
PD_Dyn_normalise
:==
176
/* Generics */
PD_StdGeneric
:==
177
...
...
@@ -202,7 +202,9 @@ PD_bimapId :== 216
PD_TypeGenericDict
:==
217
PD_NrOfPredefSymbols
:==
218
PD_ModuleConsSymbol
:==
218
PD_NrOfPredefSymbols
:==
219
(<<=)
infixl
...
...
@@ -299,21 +301,29 @@ predefined_idents
[
PD_FromThenTo
]
=
i
"_from_then_to"
,
[
PD_TypeCodeClass
]
=
i
"TC"
,
[
PD_TypeObjectType
]
=
i
T_ypeObjectTypeRepresentation_String
,
[
PD_TypeConsSymbol
]
=
i
"T_ypeConsSymbol"
,
[
PD_PV_Placeholder
]
=
i
"PV_Placeholder"
,
[
PD_UPV_Placeholder
]
=
i
"UPV_Placeholder"
,
[
PD_UV_Placeholder
]
=
i
"UV_Placeholder"
,
[
PD_unify
]
=
i
"_unify"
,
[
PD_coerce
]
=
i
"_coerce"
,
[
PD_StdDynamic
]
=
i
UnderscoreSystemDynamicModule_String
,
[
PD_undo_indirections
]
=
i
"_undo_indirections"
,
[
PD_DynamicTemp
]
=
i
DynamicRepresentation_String
,
[
PD_ModuleConsSymbol
]
=
i
"__Module"
,
[
PD_TypeID
]
=
i
"T_ypeID"
,
[
PD_ModuleID
]
=
i
"ModuleID"
,
[
PD_Dyn_DynamicTemp
]
=
i
DynamicRepresentation_String
,
[
PD_Dyn_Type
]
=
i
"_Type"
,
[
PD_Dyn_TypeScheme
]
=
i
"_TypeScheme"
,
// FIXME: change constructor name T_ypeConsSymbol to T_ypeApp (also in dynamic linker)
[
PD_Dyn_TypeApp
]
=
i
"T_ypeConsSymbol"
,
[
PD_Dyn_TypeVar
]
=
i
"_TypeVar"
,
[
PD_Dyn_TypePatternVar
]
=
i
"_TypePatternVar"
,
[
PD_Dyn_TypeCons
]
=
i
"_TypeCons"
,
[
PD_Dyn_tc_name
]
=
i
"_tc_name"
,
[
PD_Dyn_Unifier
]
=
i
"_Unifier"
,
[
PD_Dyn_unify
]
=
i
"_unify"
,
[
PD_Dyn_initial_unifier
]
=
i
"_initial_unifier"
,
[
PD_Dyn_bind_global_type_pattern_var
]
=
i
"_bind_global_type_pattern_var"
,
// FIXME: change constructor name ModuleID to _ModuleID (also in dynamic linker?)
[
PD_Dyn_ModuleID
]
=
i
"ModuleID"
,
[
PD_Dyn_normalise
]
=
i
"_normalise"
,
[
PD_Dyn_tc_name
]
=
i
"_tc_name"
,
[
PD_Dyn_tc_name
]
=
i
"_tc_name"
,
[
PD_Dyn_tc_name
]
=
i
"_tc_name"
,
[
PD_StdGeneric
]
=
i
"StdGeneric"
,
[
PD_TypeBimap
]
=
i
"Bimap"
,
[
PD_ConsBimap
]
=
i
"_Bimap"
,
...
...
@@ -358,15 +368,15 @@ predefined_idents
[
PD_bimapId
]
=
i
"bimapId"
,
[
PD_TypeGenericDict
]
=
i
"GenericDict"
,
[
PD_ModuleConsSymbol
]
=
i
"__Module"
,
[
PD_StdMisc
]
=
i
"StdMisc"
,
[
PD_abort
]
=
i
"abort"
,
[
PD_undef
]
=
i
"undef"
,
[
PD_Start
]
=
i
"Start"
,
[
PD_DynamicType
]
=
i
"type"
,
[
PD_DynamicValue
]
=
i
"value"
[
PD_Start
]
=
i
"Start"
}
=:
idents
where
...
...
@@ -480,23 +490,26 @@ where
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_FromTo
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_FromThenTo
)
<<-
(
local_predefined_idents
,
IC_Class
,
PD_TypeCodeClass
)
<<-
(
local_predefined_idents
,
IC_Type
,
PD_TypeObjectType
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_TypeConsSymbol
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_PV_Placeholder
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_UPV_Placeholder
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_UV_Placeholder
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_unify
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_coerce
)
/* MV */
<<-
(
local_predefined_idents
,
IC_Module
,
PD_StdDynamic
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_undo_indirections
)
<<-
(
local_predefined_idents
,
IC_Type
,
PD_DynamicTemp
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_ModuleConsSymbol
)
<<-
(
local_predefined_idents
,
IC_Type
,
PD_TypeID
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_ModuleID
)
<<-
(
local_predefined_idents
,
IC_Module
,
PD_StdGeneric
)
<<-
(
local_predefined_idents
,
IC_Class
,
PD_TypeCodeClass
)
<<-
(
local_predefined_idents
,
IC_Module
,
PD_StdDynamic
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_ModuleConsSymbol
)
<<-
(
local_predefined_idents
,
IC_Type
,
PD_Dyn_DynamicTemp
)
<<-
(
local_predefined_idents
,
IC_Type
,
PD_Dyn_Type
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_Dyn_TypeScheme
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_Dyn_TypeApp
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_Dyn_TypeVar
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_Dyn_TypePatternVar
)
<<-
(
local_predefined_idents
,
IC_Type
,
PD_Dyn_TypeCons
)
<<-
(
local_predefined_idents
,
IC_Type
,
PD_Dyn_Unifier
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_Dyn_unify
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_Dyn_initial_unifier
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_Dyn_normalise
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_Dyn_bind_global_type_pattern_var
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_Dyn_ModuleID
)
<<-
(
local_predefined_idents
,
IC_Module
,
PD_StdGeneric
)
<<-
(
local_predefined_idents
,
IC_Type
,
PD_TypeBimap
)
<<-
(
local_predefined_idents
,
IC_Expression
,
PD_ConsBimap
)
<<-
(
local_predefined_idents
,
IC_Type
,
PD_TypeUNIT
)
...
...
@@ -548,10 +561,9 @@ where
<<-
(
local_predefined_idents
,
IC_Field
bimap_type
,
PD_map_to
)
<<-
(
local_predefined_idents
,
IC_Field
bimap_type
,
PD_map_from
)